## Create a decision

`client.decisions.create(DecisionCreateParamsbody, RequestOptionsoptions?): Decision`

**post** `/decisions`

Evaluate ordered classification and scoring questions against shared input. Answers are returned in question order.

Supply input as a string or user messages containing text and inline images. Only user messages with `input_text` and `input_image` parts are supported; non-user roles, function calls, files, audio, and item references are not supported. Images require a data URL, not an external URL or file ID. At most 128 images are allowed across the request.

Each question can return a refusal instead of a scored answer. A refusal has type `refusal` and the corresponding question name, or null if unnamed.

### Parameters

- `body: DecisionCreateParams`

  - `input: string | Array<DecisionInputMessage>`

    The text or images to evaluate for every question. Provide a text string or user messages containing text and inline images. Images must be inline data URLs; at most 128 images are allowed across all messages in one request. External URLs, files, audio, tools, and item references are not supported.

    - `string`

    - `Array<DecisionInputMessage>`

      - `content: string | Array<DecisionInputPart>`

        Text evidence or an ordered list of text and inline image parts.

        - `string`

        - `Array<DecisionInputPart>`

          - `DecisionInputText`

            - `text: string`

            - `type: "input_text"`

              - `"input_text"`

          - `DecisionInputImage`

            An inline image. External URLs and file IDs are not supported.

            - `image_url: string`

              A base64-encoded image in a data URL.

            - `type: "input_image"`

              - `"input_image"`

            - `detail?: "low" | "high" | "auto" | "original" | null`

              The image detail level, using the selected model's image profile. Defaults to auto.

              - `"low"`

              - `"high"`

              - `"auto"`

              - `"original"`

      - `role: "user"`

        - `"user"`

      - `type?: "message"`

        - `"message"`

  - `model: string`

  - `questions: Array<QuestionParamPredicate | QuestionParamChoice | QuestionParamScore>`

    - `QuestionParamPredicate`

      Estimate how likely it is that a statement about the input is true.

      - `instructions: string`

      - `type: "predicate"`

        The type of the object. Always `predicate`.

        - `"predicate"`

      - `name?: string`

    - `QuestionParamChoice`

      Choose from the supplied options based on the input.

      - `choices: Array<Choice>`

        - `value: string | boolean`

          Choice values are typed: a string and a boolean with the same text are distinct.

          - `string`

          - `boolean`

        - `description?: string`

      - `instructions: string`

      - `type: "choice"`

        The type of the object. Always `choice`.

        - `"choice"`

      - `name?: string`

    - `QuestionParamScore`

      Rate the input against the supplied ordered levels.

      - `instructions: string`

      - `levels: Array<Level>`

        - `label: string`

        - `description?: string`

      - `type: "score"`

        The type of the object. Always `score`.

        - `"score"`

      - `name?: string`

  - `safety_identifier?: string | null`

    Opaque caller-provided end-user identifier, scoped by the verified org. Match Responses' limit; this is never the authenticated user identity.

### Returns

- `Decision`

  - `answers: Array<AnswerResourcePredicate | AnswerResourceChoice | AnswerResourceScore | AnswerResourceRefusal>`

    - `AnswerResourcePredicate`

      - `name: string | null`

      - `probability: number`

      - `type: "predicate"`

        The type of the object. Always `predicate`.

        - `"predicate"`

    - `AnswerResourceChoice`

      - `choice: string | boolean`

        Choice values are typed: a string and a boolean with the same text are distinct.

        - `string`

        - `boolean`

      - `confidence: number`

      - `name: string | null`

      - `probabilities: Array<Probability>`

        - `probability: number`

        - `value: string | boolean`

          Choice values are typed: a string and a boolean with the same text are distinct.

          - `string`

          - `boolean`

      - `type: "choice"`

        The type of the object. Always `choice`.

        - `"choice"`

    - `AnswerResourceScore`

      - `confidence: number`

      - `name: string | null`

      - `probabilities: Array<Probability>`

        - `label: string`

        - `probability: number`

        - `value: number`

      - `score: number`

      - `type: "score"`

        The type of the object. Always `score`.

        - `"score"`

    - `AnswerResourceRefusal`

      The model declined to answer this question. Other questions in the same request can still receive answers.

      - `name: string | null`

      - `type: "refusal"`

        The type of the object. Always `refusal`.

        - `"refusal"`

  - `model: string`

  - `usage: Usage`

    - `input_tokens: number`

    - `input_tokens_details: InputTokensDetails`

      - `cache_write_tokens: number`

      - `cached_tokens: number`

    - `output_tokens: number`

    - `output_tokens_details: OutputTokensDetails`

      - `reasoning_tokens: number`

    - `total_tokens: number`

### Example

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const decision = await client.decisions.create({
  input: 'string',
  model: 'model',
  questions: [{ instructions: 'instructions', type: 'predicate' }],
});

console.log(decision.answers);
```

#### Response

```json
{
  "answers": [
    {
      "name": "name",
      "probability": 0,
      "type": "predicate"
    }
  ],
  "model": "model",
  "usage": {
    "input_tokens": -2147483648,
    "input_tokens_details": {
      "cache_write_tokens": -2147483648,
      "cached_tokens": -2147483648
    },
    "output_tokens": -2147483648,
    "output_tokens_details": {
      "reasoning_tokens": -2147483648
    },
    "total_tokens": -2147483648
  }
}
```
