Create Decision
Answer typed questions about a state with calibrated probabilities.
Ask typed questions about a piece of state and get back typed answers with calibrated probabilities. Decision models return no text, so there is no OpenAI SDK method for this endpoint. Call it with plain HTTP.
POST /v1/decisionsAuthentication
AuthorizationBearerrequiredAPI key as bearer token in the Authorization header. Create keys at
Manage API Keys.
Headers
Content-TypestringrequiredMust be application/json.
Body
modelstringrequiredDecision model id. Example: jev-1.13. Browse ids at
Models.
statestring | object | arrayrequiredThe content to evaluate. Either a plain string, or a JSON object or array
of related context. Questions can refer to nested fields by name, e.g.
`listing.title`. Models with media input also accept image, audio,
and video parts, see Media input.
questionsobjectrequiredMap of question id to question. At least one question is required. Each answer comes back under the same id.
Unknown fields are rejected with a 400 instead of being ignored, at the top
level and inside each question. For example, a top-level images field or
criteria on a box question both return a 400. Send images, audio, and
video as parts in state, see Media input.
Question
typestringrequiredWhat kind of answer you want. See Question types.
noulchoicescoreboxinstructionsstring | object | arrayrequiredThe question itself, phrased the way you would ask a human reviewer. Usually a string. An object or array works for structured guidance, e.g. to include an image part, on models that read media there.
criteriaobject | arrayoptionalWhat each possible answer means. The shape depends on type. Required
for choice and score, optional for noul, not used by box.
Response
idstringoptionalUnique request id.
modelstringoptionalThe model id you requested.
answersobjectoptionalMap of question id to answer. Each answer has a type matching its
question plus the fields described below.
usageobjectoptional{ input_tokens, output_tokens }. Only input tokens are billed.
Question types
noul - yes or no
criteria is optional. Use it to spell out what true and false mean
when the question is ambiguous.
{
"type": "noul",
"instructions": "Does this message convey urgency?",
"criteria": {
"true": "Explicitly time-sensitive",
"false": "No urgency expressed"
}
}The answer is { "type": "noul", "noul": 0.96 }, where noul is the
probability that the answer is yes, between 0 and 1. A value near 0.5
means yes and no are about equally likely. It does not mean "medium".
choice - pick one option
criteria maps each option key to a description. A description can be
null when the key speaks for itself.
{
"type": "choice",
"instructions": "Which team should handle this?",
"criteria": {
"billing": "Payments, invoicing, refunds",
"technical": "Bugs, outages, integrations",
"sales": "Pricing, upgrades, new accounts"
}
}| Answer field | Meaning |
|---|---|
choice | The selected option key. |
probabilities | Probability of every option. |
confidence | How concentrated that distribution is. |
score - place on an ordered scale
criteria is an array of levels, lowest first. At least two levels are
required.
{
"type": "score",
"instructions": "How frustrated is the customer?",
"criteria": ["Calm", "Frustrated", "Very angry"]
}| Answer field | Meaning |
|---|---|
score | Probability-weighted position on the scale. Index 0 is the first level, so 1.99 sits almost exactly on the third level. |
probabilities | Probability of every level, keyed by index. |
legend | Index to level text, so you don't have to keep your own mapping. If a level is an image part, the legend returns that image part. |
confidence | How concentrated that distribution is. |
box - locate something in an image
Finds one target in an image in state and returns its bounding box. Takes
type and instructions only, no criteria. Write instructions as a
description of the target, not a command, and name the image it is in.
Not every model supports box. Models without it reject it with a 400.
{
"type": "box",
"instructions": "the product in the listing photo"
}The answer is:
{
"type": "box",
"box": { "top": 0.49, "bottom": 0.89, "left": 0.58, "right": 0.96 },
"confidence": 0.93
}left and right are fractions of the image width, top and bottom are
fractions of its height, measured from the top-left corner. There is no
"not found" answer: four edges always come back, even when the target is not
in the image. Ask a noul question in the same request to check whether it
is there.
Media input
Models with media input accept images, audio, and video inside state.
Check input_modalities on
Models for what each model
reads. Sending a part the model cannot read returns a 400.
Pass state as an array and add each item as a part, the same parts Chat
Completions uses. Text items in the array are plain strings, not
{ "type": "text" } parts.
{
"model": "gemini-decision-1",
"state": [
"Support call recording and the customer's product photo:",
{ "type": "input_audio", "input_audio": { "data": "UklGRiQAAABXQVZF...", "format": "wav" } },
{ "type": "image_url", "image_url": { "url": "data:image/jpeg;base64,/9j/4AAQ..." } }
],
"questions": {
"is_defect": { "type": "noul", "instructions": "The caller describes a hardware defect." },
"photo_shows_damage": { "type": "noul", "instructions": "The photo shows visible damage." }
}
}Parts can also sit deeper in state, e.g. { "listing": { "photo": <image part>, "title": "Lamp" } }.
Questions can then refer to them by field name.
| Part | Shape | Notes |
|---|---|---|
| Image | { "type": "image_url", "image_url": { "url": "..." } } | url is a base64 data URL or a public http(s) URL. A raw base64 string without the data:image/...;base64, prefix is not an image. |
| Audio | { "type": "input_audio", "input_audio": { "data": "...", "format": "wav" } } | data is raw base64 with format (e.g. wav, mp3, ogg, flac), or a base64 data URL. |
| Video | { "type": "video_url", "video_url": { "url": "..." } } | url is a base64 data URL or a public http(s) URL to the video file itself, not a page such as YouTube. |
- Accepted file formats, pixel sizes, and file sizes depend on the model.
Media the model cannot read returns a
400, media above its size limits a413. - Some models also read media parts inside a question's
instructionsandcriteria. Others accept text only there and return a400. - Not every model applies EXIF orientation, so rotate photos before encoding them.
Media counts as input tokens at the normal price.
Reading the probabilities
Probabilities vary slightly from call to call, so branch on bands rather
than exact values. A common pattern is to act automatically when
confidence is above a threshold you tuned on real data, and send
everything else to a human.
const { team } = answers;
if (team.confidence >= 0.8) {
await routeTo(team.choice);
} else {
await sendToReviewQueue(ticket);
}Pick thresholds from the cost of each kind of mistake, not from a round
number. confidence describes how spread out the options are. It does not
tell you whether the action is safe to take.
Tips
- Put every independent question about the same state in one request. They are answered in parallel and billed once for the shared state.
- Keep
instructionsspecific and name the state fields you want the model to look at. - If you need an explanation for a decision, make the decision here, then ask a chat model to explain it.
Errors
All errors share one shape:
{ "error": { "message": "...", "type": "invalid_request_error" } }| Status | error.type | Meaning |
|---|---|---|
400 | validation_error | The body failed schema validation. The message names the offending field. |
400 | invalid_request_error | Unknown model, a model that is not a decision model, or content the model cannot read (for example an image sent to a text-only model). |
401 | authentication_error | Missing or invalid API key. |
402 | invalid_request_error | Not enough credit for the request, an unpaid balance, or a spend limit was reached. |
403 | permission_denied_error | The account is suspended, an Admin key was used, or the model isn't included in your organization's tier. |
404 | not_found_error | The model is deprecated. The message names its replacement. |
408 | timeout_error | The model did not finish before the request timed out. |
413 | invalid_request_error | Media or request body above the model's size limits. |
429 | rate_limit_error | Your organization hit its rate limit for this model. Back off and retry. |
500 | internal_server_error | Unexpected server error. |
502 / 503 | upstream_error | The model is temporarily unavailable. Safe to retry. |
When the model itself rejects a request, the response keeps the model's
4xx status with type upstream_error or invalid_request_error, and
error.code names the cause when it is known (context_length_exceeded,
content_filter, request_too_large).