Skip to content
On this page

Inference

Decisions

Typed, probabilistic answers from a Decisions model: boolean, categorical, and ordered questions over one state document.

Instead of free-form text, a Decisions model answers structured questions — a probability, a category with confidence, or a position on an ordered scale. Send the material to evaluate as state, describe each question in questions, and read the answers back as numbers.

Endpoint

POST/v1/decisionsAPI key (JWT also resolves)

Alias: /api/v1/decisions. Non-streaming: the response is one JSON body. Requests are billed from the model-reported input and output tokens at the model's prices, exactly like chat.

Use a catalog model backed by a Decisions-capable provider, for example jev-1.14. Call GET /v1/models to see what is currently available.

Request

curl -X POST https://api.relayrouter.org/v1/decisions \
-H "Authorization: Bearer $RELAY_API_KEY" \
-H 'content-type: application/json' \
-d '{
"model": "jev-1.14",
"state": {
"ticket": "My checkout page shows a blank screen after I click Pay.",
"customer_tier": "enterprise"
},
"questions": {
"is_bug": {
"type": "noul",
"instructions": "Is the customer reporting a software defect?",
"criteria": {
"true": "The customer describes broken or unexpected behavior.",
"false": "The customer is asking a question or requesting a feature."
}
},
"team": {
"type": "choice",
"instructions": "Which team should own this ticket?",
"criteria": {
"account": "Login, permissions, profile.",
"frontend": "Rendering, layout, browser compatibility.",
"payments": "Checkout, billing, payment processing."
}
},
"urgency": {
"type": "score",
"instructions": "How urgent is this ticket?",
"criteria": ["Can wait", "Fix this week", "Blocking revenue"]
}
}
}'

Top-level fields

FieldTypeDescription
modelrequiredstringA catalog model backed by a Decisions-capable provider.
staterequiredstring | object | arrayThe content to evaluate: a plain string, or a JSON object/array of related context.
questionsrequiredobjectMap of {name: question}. At least one question; each needs a type and non-empty instructions.
session_idstringGroups related requests (max 256 chars). Never sent to the provider.
userstringOptional caller-side identifier (max 256 chars).

Question types

typeCriteriaAnswer
noulbooleanOptional criteria with true and false guidance. Returns a single probability in [0,1].
choicecategoricalcriteria maps each label to its description. Returns the chosen label, a confidence, and the full probability map.
scoreorderedcriteria is an ordered array of labels. Returns a continuous score, a confidence, the legend, and per-position probabilities.

Only these three types

Any other question type is rejected with 400 before the model is called. instructions is required and must not be blank.

Response

{
"id": "gen-dec-...",
"model": "jev-1.14",
"provider": "relayrouter",
"answers": {
"is_bug": { "type": "noul", "noul": 0.96 },
"team": {
"type": "choice",
"choice": "payments",
"confidence": 0.75,
"probabilities": { "account": 0, "frontend": 0.16, "payments": 0.84 }
},
"urgency": {
"type": "score",
"score": 1.99,
"confidence": 0.99,
"legend": {
"0": "Can wait",
"1": "Fix this week",
"2": "Blocking revenue"
},
"probabilities": { "0": 0, "1": 0.01, "2": 0.99 }
}
},
"usage": { "input_tokens": 476, "output_tokens": 70 }
}
  • model is the public id and provider is always relayrouter; internal serving details are never exposed.
  • usage.input_tokens / output_tokens are model-reported and drive billing.
  • confidence, probabilities and legend are present on choice and score answers.

Billing

A Decisions request costs the model's network fee plus input and output tokens at its prices, with the model's token multiplier and any account price override applied. The same balance, allowlist, quota and daily-cap gates as chat apply.

If the model has no capacity at that moment, the call fails with 503 model_busy and is not billed. Retry later.

Errors

StatusCodeMeaning
400invalid_requestMalformed body, missing model/state/questions, an unsupported question type, or blank instructions.
404model_not_availableUnknown, private, disabled, or non-Decisions model.
503model_busyTemporary serving capacity. Retry after Retry-After.
402—Out of credit; top up before retrying.

No failover

Decisions calls do not switch models. You always get an answer from the model you asked for, or an error.

See Errors for the shared error shapes and the SDK for typed helpers.