> ## Documentation Index
> Fetch the complete documentation index at: https://docs.liquid.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Make decisions

> Answer typed questions about a state with calibrated probabilities, using TypeSafe's System One API. See [Decisions](https://docs.liquid.ai/api/guides/decisions).



## OpenAPI

````yaml /api/openapi.json post /decisions/v1/systemone
openapi: 3.1.0
info:
  title: Liquid inference API
  version: 1.0.0
  description: >-
    OpenAI-compatible inference API plus native endpoints.


    **Authentication** — Every request needs an API key, sent as a bearer token:
    `Authorization: Bearer $LIQUID_API_KEY`. Create a key on the [API
    keys](https://console.liquid.ai/dashboard/api-keys) page of Liquid Console;
    it is shown once.


    **Batch uploads** — Batch input files are uploaded through a presigned URL
    from `POST /v1/files`; see the [Batch
    guide](https://docs.liquid.ai/api/guides/batch).


    **Decision models** — `POST /decisions/v1/systemone` implements TypeSafe's
    System One API for typed Choice, Score, and Noul decisions from decision
    models such as `d1.1` and `d1-ultra`.
servers:
  - url: https://api.liquid.ai
security:
  - apiKey: []
tags:
  - name: Models
  - name: Chat
  - name: Decision models
  - name: Files
  - name: Batches
  - name: Large uploads
paths:
  /decisions/v1/systemone:
    post:
      tags:
        - Decision models
      summary: Make decisions
      description: >-
        Answer typed questions about a state with calibrated probabilities,
        using TypeSafe's System One API. See
        [Decisions](https://docs.liquid.ai/api/guides/decisions).
      operationId: decisions
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                model:
                  type: string
                  description: >-
                    The decision model id to use. `d1:latest` and
                    `d1-ultra:latest` always point to the newest model of their
                    family; pin an exact id such as `d1-ultra` to keep the same
                    model.
                  example: $DECISION_MODEL_ID
                state:
                  description: >-
                    The content the questions are about: plain text, or
                    structured JSON such as a chat log or record. Omit or send
                    null when the questions stand alone. As in Perplexity's
                    Decisions API, an array state may also hold images as
                    OpenAI-style `{ "type": "image_url", "image_url": { "url":
                    "data:…" } }` parts: they are taken out of the state and
                    checked under the same rules as `images`, which the request
                    must then leave out (sending both returns 422), and a single
                    string left beside them becomes the text state.
                images:
                  type: array
                  items: {}
                  description: >-
                    Up to 8 images the questions are about, for decision models
                    that accept images: those listing `image` in
                    `input_modalities` from GET /decisions/v1/models, such as
                    `d1`. Other models return 422. Each is a base64
                    `data:image/…;base64,` URL or a `{ "content_type", "base64"
                    }` object: JPEG, PNG, or WebP, 5 MB each, within the 4.5 MB
                    request body limit. Remote image URLs are not accepted.
                    Images come before the state in the prompt, in the order
                    sent, and every question sees all of them. On `d1` and
                    `d1-ultra`, an image costs 1.5 input tokens per 32×32-pixel
                    patch that covers it (`ceil(width / 32) × ceil(height / 32)`
                    patches), rounded up per image, and a request is billed its
                    images once, however many questions it asks. The images of a
                    request may cover at most 10,000 patches in all, and no
                    image may be more than 100 times as long as it is wide;
                    either returns 422. This is an extension to the System One
                    API; omit it to stay TypeSafe-compatible.
                questions:
                  type: object
                  additionalProperties: true
                  description: >-
                    Up to 128 named questions; answers come back under the same
                    keys. Each has a `type` ("choice", "score", or "noul") and
                    `instructions` (a string or JSON). A Choice takes `criteria`
                    mapping 2–255 option names to a description or null; a Score
                    takes `criteria` as an ordered list of 2–10 level
                    descriptions; a Noul takes optional `criteria` of `{ "true":
                    …, "false": … }`, used only when both are given and say more
                    than a bare yes and no. A request is billed its state and
                    images once plus each question's own tokens, so asking a
                    state several questions in one request costs far less than
                    asking them in separate requests. Every question still reads
                    the whole state, so the input limits apply to the state,
                    images, and one question together: `d1` and `d1.1` allow
                    65,536 tokens and `d1-ultra` 32,768, and all three 250 KB of
                    text, and they return 422 over either.
              required:
                - model
                - questions
            example:
              model: $DECISION_MODEL_ID
              state: Help! My payouts have been failing for 3 days.
              questions:
                department:
                  type: choice
                  instructions: Which team should handle this?
                  criteria:
                    billing: Payments, invoicing, refunds
                    technical: Bugs, outages, integrations
                    sales: Pricing, upgrades, new accounts
                is_urgent:
                  type: noul
                  instructions: Does this convey urgency?
                frustration:
                  type: score
                  instructions: How frustrated is the customer?
                  criteria:
                    - Calm
                    - Frustrated
                    - Very angry
      responses:
        '200':
          description: Successful response.
          content:
            application/json:
              example:
                model: $DECISION_MODEL_ID
                answers:
                  department:
                    type: choice
                    choice: technical
                    probabilities:
                      billing: 0.31
                      technical: 0.67
                      sales: 0.02
                    confidence: 0.5
                  is_urgent:
                    type: noul
                    noul: 0.95
                  frustration:
                    type: score
                    score: 1.05
                    legend:
                      '0': Calm
                      '1': Frustrated
                      '2': Very angry
                    probabilities:
                      '0': 0
                      '1': 0.95
                      '2': 0.05
                    confidence: 0.92
                usage:
                  input_tokens: 912
                  output_tokens: 0
              schema:
                type: object
                properties:
                  model:
                    type: string
                    description: The model that answered.
                  answers:
                    type: object
                    additionalProperties: true
                    description: >-
                      One answer per question id. Choice: `choice`,
                      `probabilities` per option, `confidence`. Score: `score`
                      (probability-weighted, may fall between levels), `legend`,
                      `probabilities` per level, `confidence`. Noul: `noul`, the
                      probability of yes. Confidence runs from 0 (probability
                      spread evenly) to 1 (all on one answer); for a Score it
                      also counts how far the probability sits from the most
                      likely level, so a split between the two ends of the scale
                      is 0.
                  usage:
                    type: object
                    additionalProperties: true
                    description: >-
                      Token counts: { input_tokens, output_tokens }, plus `cost`
                      in USD when the model is priced. `input_tokens` counts the
                      state and images once and each question's own tokens.
                      Output is always 0.
        '429':
          description: >-
            The organization's request or token limit for the model was
            exceeded.
          headers:
            Retry-After:
              description: Integral seconds until the request can be retried.
              schema:
                type: integer
                minimum: 1
            x-ratelimit-limit-requests:
              description: >-
                Maximum requests per minute (per second when only that limit is
                set), when a request limit applies.
              schema:
                type: integer
                minimum: 1
            x-ratelimit-remaining-requests:
              description: Requests remaining in that window.
              schema:
                type: integer
                minimum: 0
            x-ratelimit-reset-requests:
              description: >-
                Rounded-up duration until that window resets, such as 42s or
                1m0s.
              schema:
                type: string
                pattern: ^([1-9][0-9]*h)?([0-9]+m)?[0-9]+s$
            x-ratelimit-limit-tokens:
              description: >-
                Estimated tokens per minute (per second when only that limit is
                set), when a token limit applies.
              schema:
                type: integer
                minimum: 1
            x-ratelimit-remaining-tokens:
              description: Estimated tokens remaining in that window.
              schema:
                type: integer
                minimum: 0
            x-ratelimit-reset-tokens:
              description: >-
                Rounded-up duration until that window resets, such as 42s or
                1m0s.
              schema:
                type: string
                pattern: ^([1-9][0-9]*h)?([0-9]+m)?[0-9]+s$
          content:
            application/json:
              example:
                error:
                  message: >-
                    Rate limit exceeded for model `$MODEL_ID`. To request a
                    higher limit, contact us at https://www.liquid.ai/connect.
                  type: rate_limit_error
                  param: null
                  code: rate_limit_exceeded
      x-codeSamples:
        - lang: curl
          label: cURL
          source: |-
            curl https://api.liquid.ai/decisions/v1/systemone \
              -H "Authorization: Bearer $LIQUID_API_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                "model": "$DECISION_MODEL_ID",
                "state": "Help! My payouts have been failing for 3 days.",
                "questions": {
                  "department": {
                    "type": "choice",
                    "instructions": "Which team should handle this?",
                    "criteria": {
                      "billing": "Payments, invoicing, refunds",
                      "technical": "Bugs, outages, integrations",
                      "sales": "Pricing, upgrades, new accounts"
                    }
                  },
                  "is_urgent": { "type": "noul", "instructions": "Does this convey urgency?" },
                  "frustration": {
                    "type": "score",
                    "instructions": "How frustrated is the customer?",
                    "criteria": ["Calm", "Frustrated", "Very angry"]
                  }
                }
              }'
components:
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: >-
        A Liquid API key from the [API
        keys](https://console.liquid.ai/dashboard/api-keys) page of Liquid
        Console, sent as `Authorization: Bearer $LIQUID_API_KEY`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.