Realtime TTS-2 is live. Built for realtime conversation that feels human. Read the Realtime TTS-2 announcement

Decisions

Create decision

Get typed answers to named questions about a state

POST/alpha/decisions

Preview. The /alpha path and the request and response formats may change before this API is marked stable. See release stages.

Send a state and a map of typed questions to the selected decision model. It returns one answer per question: a yes/no probability (noul), a pick from your options (choice), or a rating on your levels (score). Answers are never free text, so your code can branch on them directly.

Choose an API model ID from the model catalog. The Decisions guide explains how to choose a model, run examples, and use the answers in your application. The reference examples use typesafe/jev-latest, a text-only model.

Errors

Request validation returns 400 with error.type: "invalid_request_error" before sending the request to a model. For question validation, error.param names the field to fix. Other errors can omit param.

For example, a request to an available model with state present and "questions": {"q": {"type": "rank"}} returns:

json
{
  "error": {
    "message": "questions.q.type: unknown question type \"rank\"; expected noul, choice or score",
    "type": "invalid_request_error",
    "param": "questions.q.type"
  }
}

Model errors relayed to your application keep their HTTP status and use {"error": {"message": "...", "type": "..."}}. Input that passes request validation can still be rejected by the model, including with 422. A relayed 429 uses rate_limit_error; relayed 5xx errors use api_error, except 504, which uses timeout_error. These rate-limit and server errors have generic messages. Retry transient errors with exponential backoff and honor Retry-After when present.

Check the HTTP status and content type before parsing: authentication, account, and API-key rate-limit errors can use a different body. See Errors in the Decisions guide for status codes and next steps.

Image input

Use the List models API with output_modalities=decisions to find decision models. In the response, check models[].spec.inputModalities. Choose a model whose spec.inputModalities includes image. Sending an image to a text-only model returns 400.

Put image parts directly in the state array alongside text:

json
{
  "state": [
    "Evaluate this screenshot.",
    {
      "type": "image_url",
      "image_url": {
        "url": "data:image/png;base64,<BASE64_IMAGE>",
        "detail": "auto"
      }
    }
  ]
}

This fragment illustrates state; a complete request also requires model and questions.

Field or constraintAccepted values and behavior
image_url.urlInline PNG, JPEG or WebP data URL with standard base64 encoding: data:image/png;base64,..., data:image/jpeg;base64,... or data:image/webp;base64,.... Remote HTTP(S) URLs are rejected.
image_url.detailOptional: auto, low or high. Some models ignore it.
PlacementImage parts must be direct elements of the state array. Nested image parts are treated as data, not image input. A top-level images field is rejected with 400.
Other modalitiesAudio and video input are not supported.

Image-count and request-size limits depend on the selected model. The text-only example model's limits do not apply to all image requests. See Evaluate an image for a complete Python request using a checkout screenshot.

Authorizations

Authorizationstringrequired

Your authentication credentials. For Basic authentication, please populate Basic $INWORLD_API_KEY.

Please make sure your API Key has write permissions for the Router API in order to create, update, and delete routers. You can create a key in one command with the Inworld CLI: inworld workspace add-key.

Body

application/json

modelstringrequired

API model ID selected from the Decisions catalog, for example typesafe/jev-latest.

stateoneOfrequired

The content to evaluate: a string for text, or an object or array for structured data. Image-capable decision models also accept direct image_url parts in the state array, using inline base64 PNG, JPEG or WebP data URLs. Remote URLs are rejected; nested image parts are treated as data, not image input. Audio and video are not supported. See the image input contract for the part format, optional detail and model requirements.

questionsobjectrequired

The questions to answer, keyed by ids you choose. Each answer comes back under the same id. The ids are not sent to the model and do not affect inference.

Response

200 - application/json

modelstring

The provider-qualified model that answered: a specific version (for example typesafe/jev-1.13.0), or the model family (for example typesafe/jev) when no version is reported.

answersobject

One answer per question, keyed by the ids used in questions.

usageobject

Token usage. Decisions are billed on input_tokens only; output tokens are not billed.

Show child attributes

input_tokensinteger

output_tokensinteger

metadataobject

Inworld routing metadata, with the same keys as on chat completions.

Show child attributes

attemptsobject[]

Show child attributes

modelstring

status_codeinteger

duration_msnumber

successboolean

generation_idstring

Unique identifier for this request.

total_duration_msinteger

Total request duration in milliseconds.