state, and returns calibrated probabilities instead of generated text. One request can ask several questions, and each answer comes back as a number or a pick you can branch on directly, with no parsing and no prompt to coax a format out of an LLM.
Use a decision model instead of an LLM agent when the output is a decision, not prose:
- Classifying: which category, team or intent a message belongs to
- Routing: which agent, swarm type or model should handle a task
- Gating: whether a task needs an expensive agent call at all
- Grading: how good an answer is before it ships
Endpoints
All three take your API key in the
x-api-key header.
Request
Several questions go in one request, and the state’s tokens are billed once, so asking three questions about a ticket costs about the same as asking one.
Question Types
Every question has atype, optional instructions saying what to decide, and criteria.
choiceis the most likely option andprobabilitiesholds every option’s probability.scoreis an expected value where the first level is 0. With four levels, ascoreof 2.99 means almost certainly the fourth level.legendmaps each level’s position to its description.confidenceis how sure the model is of achoiceorscoreanswer, from 0 to 1. Send low-confidence answers to a person.
Response
POST /v1/decision/completions returns:
usage.total_cost is the amount charged for the request. See Decision Model Completion for a full request and response.
TypeSafe API Format
POST /v1/systemone takes and returns exactly what the TypeSafe API does, so the TypeSafe SDKs work with base_url set to https://api.swarms.world and a Swarms API key.
modelis required.- The response has only
model,answersandusagewithinput_tokensandoutput_tokens. - The job ID is in the
x-typesafe-request-idresponse header, and the amount charged inx-swarms-total-cost.
Models and Pricing
Decision models are billed per token at the model’s price. CallGET /v1/decision/models for the current models and their input_cost_per_1m and output_cost_per_1m in USD, and see List Decision Models and Estimate Costs for estimating a request’s cost from them.
- The same $1.00 minimum balance as the other completion endpoints applies.
- Nothing is charged when a request fails.
Errors
Related
- API reference: Execute Decision Model Completion, Execute Decision Model Completion (TypeSafe API), Get Decision Models and Prices
- Decision Model Completion: one request with a
noul, achoiceand ascorequestion - List Decision Models and Estimate Costs: prices, pinned versions and cost math
- Gate and Judge an Agent: decide whether to run an agent, then grade its answer
- Pick a Swarm and the Best Draft: choose the swarm type, then the best output