Decisions API

Copy Page as Markdown

Use the Decisions API for fast, structured judgments rather than generated text. It evaluates a state and optional images, then returns typed answers and probabilities your code can use directly.

POST /v1/systemone

For text generation, use SubQ Savant (subq-savant-1.4) Early access on Chat Completions or Responses. Request access.

Make a decision

cURLTypeScriptPython

Request

The JSON body requires:

  • model — a decision model ID, such as subq-snap-1.2. See Models.
  • state — the text, object, or array to evaluate. To ask about a document, send its text. See Documents.
  • questions — 1–128 named noul, choice, or score questions. Each uses instructions and type-specific criteria, which can contain strings, objects, or arrays. Answer keys match the question names, which can be up to 100 characters.

The request must fit the model's 384K-token (393,216) context window. A request over the limit, or close to it, fails with 400.

Optional:

  • images — up to 4 images to evaluate alongside state. See Images.

Noul

A noul is a yes/no gate. Its answer is noul, the probability of yes from 0 to 1. Optional criteria.true and criteria.false describe both outcomes.

Choice

A choice selects one named option. Define 2–255 options in criteria; each option's description may be null. The answer includes choice, a probability for every option, and confidence.

Score

A score uses 2–10 ordered levels. The answer includes a probability-weighted score, so it can fall between levels, plus legend, probabilities, and confidence.

Documents

Use a document to fact-check a claim against its source, find the passage that backs an answer, or tag a record from its text.

The Decisions API takes no files. To ask about a PDF, Word file, or other document, extract its text and send it as state, on its own or as a field next to other data. Run OCR on scanned PDFs first.

  • Label the parts. Mark pages, sections, or passages in the text, like [P2] or --- page 24 ---, so options can name them.
  • Ask where. A choice whose options are those labels returns a probability for each location. Add an option like not_found for when the document doesn't say.

Send the text as a state field, and use the labels as choice options:

cURL

best_passage returns "choice": "P2" with a probability for every label, including not_found.

Images

Add images to judge photos or screenshots alongside the text, such as checking that a listing's photos match its description, or that a screenshot shows a step is done.

Send each image as an object:

{
  "images": [
    { "mediaType": "image/jpeg", "base64": "/9j/4AAQSkZJRgABAQAA..." }
  ]
}
  • mediaType — image/png, image/jpeg, or image/webp.
  • base64 — the file bytes as one line of base64. No URL and no data: prefix.
  • Send up to 4 images. Each can be up to 4 MiB decoded, with an 8 MiB decoded total. The whole request body can be up to 13 MiB.
  • Each image costs 66 to about 1,600 input tokens, set by resolution rather than file size. Downscale anything above about 1.6 megapixels to cut the cost. Image tokens count toward the context window.
  • Video is not supported. Sample up to 4 frames and send them as images.
TypeScriptPython

An invalid image fails with 422 validation_error. A file over 4 MiB:

{
  "detail": {
    "error_type": "validation_error",
    "message": "images/0: image over 4 MiB"
  }
}

Bytes that do not match mediaType fail the same way: images/0: image bytes must match the PNG, JPEG, or WebP mediaType. The same status covers a URL or data: prefix, a bad decode, more than 4 images, or more than 8 MiB decoded in total.

Response

{
  "model": "subq-snap-1.2",
  "answers": {
    "escalate": {
      "type": "noul",
      "noul": 0.92
    },
    "queue": {
      "type": "choice",
      "choice": "nurse_line",
      "probabilities": {
        "nurse_line": 1,
        "primary_care": 0,
        "pharmacy": 0,
        "front_desk": 0
      },
      "confidence": 1
    },
    "acuity": {
      "type": "score",
      "score": 1.86,
      "legend": {
        "0": "Within a week",
        "1": "Within a day",
        "2": "Within an hour"
      },
      "probabilities": {
        "0": 0,
        "1": 0.13,
        "2": 0.87
      },
      "confidence": 0.79
    }
  },
  "usage": {
    "input_tokens": 477,
    "output_tokens": 0
  }
}

You pay only for input tokens; output_tokens is always 0.

Stored decisions, including images, follow the data-retention policy.

Errors

Errors use a detail object:

{
  "detail": {
    "error_type": "validation_error",
    "message": "questions/queue: must have required property 'criteria'"
  }
}
  • 400 — input over the token limit, or a request the model rejects.
  • 401 — missing or invalid credentials.
  • 402 — insufficient credits.
  • 403 — the API key cannot use the requested model.
  • 422 — invalid request (including an invalid or oversized image) or a model that is not a decision model.
  • 429 — rate limit exceeded.
  • 5xx — server error. 503 means the service is temporarily unavailable.