Decisions API
The Decisions API asks a model structured questions about an input and returns typed answers with probabilities, instead of free text you would have to parse. It is built for classification, triage, moderation and routing logic where you need reliable fields rather than prose. The gateway serves the OpenAI Decisions format at /v1/decisions and the System One format at /v1/systemone, and translates between them so any decision model works with either. Decision models are registered in model_list like any other model, the Playground has a tab for trying questions, and the endpoints are part of the free gateway.
A real-world scenario
A support team receives a few thousand emails a day. Instead of prompting a chat model and parsing its answer, the intake service asks a decision model three questions about each email, is it a refund request, how urgent is it and how frustrated is the customer. The answers come back as true with a probability of 0.97, high with 0.92 and the score level annoyed, so the service can route refunds above a confidence threshold straight to billing and page a human for angry, urgent cases. The Logs page shows every decision with its spend like any other request.
Step by step
In the Admin UI
-
Open
/ui/models-and-endpointsas a proxy admin and add the decision model under Add Model, for exampletypesafe/jev-latestwith the public namesupport-decider. Decision models show the modedecisionsorevaluationin the model list,typesafe/jev-latestis anevaluationmodel, and the Playground accepts both. -
Open
/ui/playgroundand pick the Decisions tab. Choose the decision endpoint,/v1/systemoneor/v1/decisions, and picksupport-decideras the decision model. -
Pick an example from the Example dropdown, such as Route a support ticket, or build your own questions. Each question has a Question name, an Answer type of Choice, Yes / no or Score, and Instructions. Paste the text under Input.
-
Click Send. The result panel shows Calibrated probabilities with a card per question, a probability bar per option and the latency and token counts. Open the cURL tab to copy the equivalent command.
-
Give the intake service's key access to
support-decider. Open Virtual Keys, click the key, click Edit Settings, addsupport-deciderunder Models and click Save. Or with curl:curl -X POST http://localhost:4000/key/update -H "Authorization: Bearer $SPANWAY_MASTER_KEY" -H "Content-Type: application/json" \-d '{"key": "sk-intake-service", "models": ["support-decider"]}'
With curl
curl -X POST http://localhost:4000/v1/decisions \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "support-decider",
"input": "I was charged twice for order 4411 and want one charge refunded today.",
"questions": [
{"name": "is_refund_request", "type": "predicate", "instructions": "Is the customer asking for a refund?"},
{"name": "urgency", "type": "choice", "instructions": "How urgent is this?", "choices": [{"value": "low", "description": "can wait a week"}, {"value": "high", "description": "needs action today"}]},
{"name": "frustration", "type": "score", "instructions": "How frustrated is the customer?", "levels": [{"label": "calm"}, {"label": "annoyed"}, {"label": "angry"}]}
]
}'
| Question type | Answer |
|---|---|
predicate | A probability that the answer is yes, from 0 to 1. |
choice | The picked value in choice, a probabilities list with one {value, probability} entry per choice, and a confidence. |
score | The picked level index in score, a probabilities list with one {value, label, probability} entry per level, and a confidence. |
A request can carry 1 to 128 questions. A choice question takes 2 to 255 choices and a score question 2 to 10 levels. input is a string or user messages mixing text and image parts. audio (up to 4 clips) and videos (up to 2) are accepted only by models that take media, such as clef-omni, as base64 data URLs or {content_type, base64} objects. When the model cannot take them, or cannot take safety_identifier, the call answers 400 <provider> does not support parameters: [...], unless drop_params is true for the deployment or under spanway_settings, in which case the gateway drops them and goes on. Streaming is not supported, and stream: true answers 400 before any provider is called. A request without model uses the gateway's default model, the one the gateway was started with --model.
Expected result
Answers come back in the order of the questions.
{
"model": "support-decider",
"answers": [
{"name": "is_refund_request", "type": "predicate", "probability": 0.97},
{"name": "urgency", "type": "choice", "choice": "high", "probabilities": [{"value": "low", "probability": 0.08}, {"value": "high", "probability": 0.92}], "confidence": 0.92},
{"name": "frustration", "type": "score", "score": 1, "probabilities": [{"value": 0, "label": "calm", "probability": 0.1}, {"value": 1, "label": "annoyed", "probability": 0.7}, {"value": 2, "label": "angry", "probability": 0.2}], "confidence": 0.7}
],
"usage": {"input_tokens": 120, "input_tokens_details": {"cached_tokens": 0, "cache_write_tokens": 0}, "output_tokens": 48, "output_tokens_details": {"reasoning_tokens": 0}, "total_tokens": 168}
}
When the model declines a question, its answer is {"name": "<question>", "type": "refusal"} with no probabilities, so check type before reading the fields.
The spend log row records the request under the calling key with the provider's token usage and cost, and the request appears on the Logs page like any chat completion.
System One format
/v1/systemone takes the same questions in the System One shape, a state and a map of named questions, and answers with the answers keyed by those names. The Playground sends this format by default.
curl -X POST http://localhost:4000/v1/systemone \
-H "Authorization: Bearer $SPANWAY_API_KEY" -H "Content-Type: application/json" \
-d '{
"model": "support-decider",
"state": "I was charged twice for order 4411 and want one charge refunded today.",
"questions": {
"is_refund_request": {"type": "noul", "instructions": "Is the customer asking for a refund?"},
"urgency": {"type": "choice", "instructions": "How urgent is this?", "criteria": {"low": "can wait a week", "high": "needs action today"}},
"frustration": {"type": "score", "instructions": "How frustrated is the customer?", "criteria": ["calm", "mildly annoyed", "angry"]}
}
}'
| Question type | Asks | criteria | Answer |
|---|---|---|---|
noul | A yes or no question. Needs instructions or criteria. | Optional descriptions of what makes it true and false. | noul, the probability of yes. |
choice | Pick one label. | A map of 1 to 255 labels to an optional description. | choice, confidence and probabilities keyed by label. |
score | Pick a level on a scale. | A list of 1 to 10 levels, lowest first. | score (the level index), confidence, legend naming each level and probabilities keyed by level index. |
Expected result:
{
"model": "jev",
"answers": {
"is_refund_request": {"type": "noul", "noul": 0.97},
"urgency": {"type": "choice", "choice": "high", "confidence": 0.91, "probabilities": {"low": 0.09, "high": 0.91}},
"frustration": {"type": "score", "score": 1.0, "confidence": 0.74, "legend": {"0": "calm", "1": "mildly annoyed", "2": "angry"}, "probabilities": {"0": 0.12, "1": 0.74, "2": 0.14}}
},
"usage": {"input_tokens": 182, "output_tokens": 9}
}
Both formats also answer at /decisions and /systemone without the /v1 prefix, for clients that add it themselves.
Supported providers
The endpoint support matrix marks these providers as serving native typed decisions:
The gateway's endpoint support matrix marks 6 provider integrations as supporting this endpoint:
Bespoke Nimble (bespoke), Fireworks AI, Hosted VLLM, Laya (laya), Strands Decider (strands_decider), TypeSafe (typesafe).
Chat models from any provider can also be used as decision models through the gateway's decision guardrail and LLM as a judge integrations, which prompt the model and parse typed answers.
model_list:
- model_name: support-decider
spanway_params:
model: typesafe/jev-latest
api_key: os.environ/TYPESAFE_API_KEY
Decisions in guardrails and routing
Decision models power the decision_model guardrail, which blocks or flags requests based on typed answers, and the Decisions Model classifier of an auto router, which lets a decision model pick the tier.
Endpoints
| Method | Path | Summary |
|---|---|---|
| POST | /decisions | Ask questions about an input (OpenAI Decisions format) |
| POST | /systemone | Ask named questions about a state (System One format) |
| POST | /v1/decisions | Ask questions about an input (OpenAI Decisions format) |
| POST | /v1/systemone | Ask named questions about a state (System One format) |
Errors
| What you see | Why | Fix |
|---|---|---|
400 naming questions | The request has no questions, more than 128, or a question of an unknown type or without its choices or levels. | Fix the question before any provider is called. The Playground's Request form badge lists the issues. |
400 Invalid model name passed in model=support-decider | The key or team may not use the model, or it is not registered. | Add the model to the key or team, or register it under Add Model. |
400 Streaming is not supported for the Decisions API. Send the request without stream, or with stream set to false. | stream: true was sent. | Remove it. Decisions always return one JSON answer. |
400 Invalid Decisions request: ... | The body breaks a rule, for example a choice question with one choice or a score with eleven levels. The text after the colon names the field. | Fix the field it names. |
400 A model name is required for the Decisions API | No model was sent and the gateway has no default model. | Send model. |
400 Unknown Decisions provider '<provider>'. Supported providers: ... | The deployment's provider does not serve decisions. | Use a decision model from a provider in the list. |
400 api_base is required for Decisions provider '<provider>' | The deployment has no address and the provider has no default. | Set api_base on the deployment. |
400 <provider> does not support parameters: [...] | audio, videos or safety_identifier was sent to a model that cannot take it. | Remove the field, or set drop_params: true to have the gateway drop it. |
400 Decisions provider '<provider>' cannot serve this request: ... | The translation between the two formats cannot express the request, for example an option the target format lacks. | Send the request in the model's own format, or change the question. |
400 Requests with '<field>' go through spanway.<function> | The body is in the other format for this route, for example state sent to /v1/decisions. | Send it to the other route, /v1/systemone for state. |
401 Missing API key for Decisions provider '<provider>' | The deployment has no provider key. | Add the key to the deployment on Models + Endpoints. |
| No decision models yet in the Playground | No model group on the gateway has the decisions or evaluation mode. | Add a decision model, the Add a decision model link goes to the Models + Endpoints page. |
| A question comes back refused | The model declined to answer, shown as Model refused to answer in the Playground. | Rephrase the instructions or the input. |
401 from the provider in error.message | The provider key behind the decision model is wrong. | Fix the credential on Models + Endpoints. |
Logs
A refused or failed decision is logged at ERROR as spanway.proxy.proxy_server._handle_llm_api_exception(): Exception occured - spanway_call_id=<id> - <message>, the same line every inference route writes. For a 400 such as a bad question it is normal and needs no action on the gateway, the caller has to fix the request. Several such lines for 401 or 5xx point at a provider key or outage. The log reference lists the line, and the Logs page shows the request with its error.
Related
- Playground page documents every control of the Decisions tab.
- Guardrails covers the
decision_modelguardrail. - Auto routing covers the Decisions Model classifier.
- Exception mapping explains the error bodies.