## Create a decision

`decisions.create(**kwargs) -> 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

- `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 = String`

  - `UnionMember1 = Array[DecisionInputMessage]`

    - `content: String | Array[DecisionInputPart]`

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

      - `String = String`

      - `Parts = Array[DecisionInputPart]`

        - `class DecisionInputText`

          - `text: String`

          - `type: :input_text`

            - `:input_text`

        - `class 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`

            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[Predicate{ instructions, type, name} | Choice{ choices, instructions, type, name} | Score{ instructions, levels, type, name}]`

  - `class Predicate`

    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`

  - `class Choice`

    Choose from the supplied options based on the input.

    - `choices: Array[Choice{ value, description}]`

      - `value: String | bool`

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

        - `String = String`

        - `UnionMember1 = bool`

      - `description: String`

    - `instructions: String`

    - `type: :choice`

      The type of the object. Always `choice`.

      - `:choice`

    - `name: String`

  - `class Score`

    Rate the input against the supplied ordered levels.

    - `instructions: String`

    - `levels: Array[Level{ label, description}]`

      - `label: String`

      - `description: String`

    - `type: :score`

      The type of the object. Always `score`.

      - `:score`

    - `name: String`

- `safety_identifier: String`

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

### Returns

- `class Decision`

  - `answers: Array[Predicate{ name, probability, type} | Choice{ choice, confidence, name, 2 more} | Score{ confidence, name, probabilities, 2 more} | Refusal{ name, type}]`

    - `class Predicate`

      - `name: String`

      - `probability: Float`

      - `type: :predicate`

        The type of the object. Always `predicate`.

        - `:predicate`

    - `class Choice`

      - `choice: String | bool`

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

        - `String = String`

        - `UnionMember1 = bool`

      - `confidence: Float`

      - `name: String`

      - `probabilities: Array[Probability{ probability, value}]`

        - `probability: Float`

        - `value: String | bool`

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

          - `String = String`

          - `UnionMember1 = bool`

      - `type: :choice`

        The type of the object. Always `choice`.

        - `:choice`

    - `class Score`

      - `confidence: Float`

      - `name: String`

      - `probabilities: Array[Probability{ label, probability, value}]`

        - `label: String`

        - `probability: Float`

        - `value: Integer`

      - `score: Float`

      - `type: :score`

        The type of the object. Always `score`.

        - `:score`

    - `class Refusal`

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

      - `name: String`

      - `type: :refusal`

        The type of the object. Always `refusal`.

        - `:refusal`

  - `model: String`

  - `usage: Usage{ input_tokens, input_tokens_details, output_tokens, 2 more}`

    - `input_tokens: Integer`

    - `input_tokens_details: InputTokensDetails{ cache_write_tokens, cached_tokens}`

      - `cache_write_tokens: Integer`

      - `cached_tokens: Integer`

    - `output_tokens: Integer`

    - `output_tokens_details: OutputTokensDetails{ reasoning_tokens}`

      - `reasoning_tokens: Integer`

    - `total_tokens: Integer`

### Example

```ruby
require "openai"

openai = OpenAI::Client.new(api_key: "My API Key")

decision = openai.decisions.create(
  input: "string",
  model: "model",
  questions: [{instructions: "instructions", type: :predicate}]
)

puts(decision)
```

#### 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
  }
}
```
