Decision Models
Ask a decision model typed questions — yes/no, choice, score or box — about text, JSON or media, and get probabilities back in one shape across every model.
A decision model answers typed questions about a state with probabilities, not prose. You describe what to judge, ask questions with a fixed answer type, and read numbers you can threshold, route on or log:
{
"state": "Customer email: 'I was charged twice for my subscription this month, please refund one.'",
"questions": {
"is_bug": { "type": "noul", "instructions": "Is this a software bug report?" },
"team": { "type": "choice", "instructions": "Which team should handle this?",
"options": { "billing": "Payments and refunds", "support": null, "sales": null } },
"urgency": { "type": "score", "instructions": "How urgent is this?", "levels": ["low", "medium", "high"] }
}
}Every decision model takes the same request and returns the same answer shape, so one body can be sent to several models and the answers compared directly.
Question types
| Type | Asks | Answer |
|---|---|---|
noul | A yes/no question. Optional criteria: { "true": "...", "false": "..." } says what each answer means. | probability: the probability of yes, in [0, 1] |
choice | Pick one of options: a list of keys, or a map of key to description (or null). | choice, plus probabilities per option |
score | Place the state on an ordered scale. levels run lowest first; each is a label or { "label", "description" }. | score: the expected level index (0 = the lowest level), plus probabilities and labels per level |
box | Locate something in the request's image. | box: top, bottom, left, right, each in [0, 1] |
Question and option keys are 1–64 characters of A-Z a-z 0-9 _ -. Answers come
back under the same keys.
The request
| Field | Type | Notes |
|---|---|---|
state | string, or a JSON object or array | Required. What the model judges. |
questions | object | Required. Question key to question. |
images | URL, data URI or base64, or a list | Optional; up to 8. |
audio, video, files | same | Optional; on the models that take them, up to 4 each. |
options | object | Optional features, below. |
Options
Options are grouped by what they do. A model that cannot honour a module ignores
it and says so in warnings, so one body still runs everywhere; an unknown
module, field or value is a 400 on every model alike.
| Module | Fields | What it does |
|---|---|---|
caching | key | Reuse a prompt cache across calls that share this key. |
session | id | Keep a run of related calls on the same upstream session. |
routing | prefer (latency, price or throughput), zero_data_retention (bool) | How the call is routed upstream. |
Cache keys and session ids are scoped to your account: two accounts using the same key never share a cache or a session.
Model support
| Model | Question types | Media | Choice options | Score levels | Options |
|---|---|---|---|---|---|
jev-1.14 | noul, choice, score, box | images | 2 or more | 1 or more | session, routing |
microsoft-decision-1.1 | noul, choice, score | images | 2 or more | 1 or more | session, routing |
gemini-decision-1 | noul, choice, score | images, audio, video, files | 2 to 255 | 1 or more | session, routing |
gpt-6-luna-decisions | noul, choice, score | images | 2 or more | 2 to 10 | caching |
gpt-6-luna-decisions takes at most 400 questions per request. A request a
model can't take — a question type it lacks, too many options or levels, a media
kind it doesn't accept — is refused with a 400 that names the field, before
the model is called.
The response
{
"model": "jev-1.14",
"answers": {
"is_bug": { "type": "noul", "status": "ok", "probability": 0.24, "confidence": null },
"team": { "type": "choice", "status": "ok", "choice": "billing",
"probabilities": { "billing": 1.0, "sales": 0.0, "support": 0.0 }, "confidence": 1.0 },
"urgency": { "type": "score", "status": "ok", "score": 1.22,
"probabilities": [0.01, 0.76, 0.23], "labels": ["low", "medium", "high"], "confidence": 0.64 }
},
"raw": { "...": "the model's own answer" },
"usage": { "input_tokens": 400, "cached_tokens": 0, "cache_write_tokens": 0 },
"cost": 0.000021,
"latency_ms": 802,
"warnings": []
}| Field | Meaning |
|---|---|
answers | Question key to its normalised answer. |
raw | The model's own answer, for anything the normalised shape leaves out. |
usage | Input tokens, and how many were read from or written to a cache. |
cost | What this call was charged, in USD — the same figure as the X-Cost header. |
latency_ms | The model's own time, measured inside the gateway, without your network. |
warnings | Fields or options this model ignored. |
Answer statuses
status | Meaning |
|---|---|
ok | The model answered; the answer's numbers are present. |
refused | The model declined to answer this question. |
error | No usable answer, with error saying why. |
A refused or error answer carries no number — never a 0, never a
default. Check status before you read probability, choice, score or
box, or a declined question will be read as a confident "no".
A call where no question got an ok or refused answer is not charged.
On v2
An async result carries the whole
response above as a string in output:
result = requests.get(poll_url, headers=headers).json()
decision = json.loads(result["output"])
print(decision["answers"]["is_bug"]["probability"])The SDKs decode it for you. A decision model typically answers in about a
second, so a single blocking /v1 call is usually the better fit.
Errors
These come from the gateway before the model is called: a 400 on /v1, a
FAILED request carrying the same message on /v2. Each names the field.
| Message (example) | Cause |
|---|---|
state: is required: non-empty text or a JSON object/array | state missing or empty |
questions: is required: a map of question key to question | questions missing, empty or not an object |
questions.logo.type: 'box' is not supported by microsoft-decision-1.1 (supported: choice, noul, score) | A question type the model lacks |
questions.team.options: option keys must be unique | Duplicate option keys |
questions.urgency.levels: gpt-6-luna-decisions takes 2 to 10 levels; got 1 | Outside the model's level range |
video: microsoft-decision-1.1 does not accept video | A media kind the model doesn't take |
images: jev-1.14 takes at most 8 images entries | Too many media entries |
Examples
curl -X POST https://api.segmind.com/v1/jev-1.14 \
-H "x-api-key: $SEGMIND_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"state": "Customer email: I was charged twice this month, please refund one.",
"questions": {
"is_bug": { "type": "noul", "instructions": "Is this a software bug report?" },
"team": { "type": "choice", "instructions": "Which team should handle this?", "options": ["billing", "support", "sales"] }
}
}'With the Python SDK:
import segmind
from segmind.decisions import choice, noul
decision = segmind.decide_sync(
"jev-1.14",
state="Customer email: I was charged twice this month, please refund one.",
questions={
"is_bug": noul("Is this a software bug report?"),
"team": choice("Which team should handle this?", ["billing", "support", "sales"]),
},
)
print(decision.probability("is_bug"), decision.choice("team"), decision.cost)With the JavaScript SDK:
import { decideSync } from 'segmind';
const decision = await decideSync('jev-1.14', {
state: 'Customer email: I was charged twice this month, please refund one.',
questions: {
is_bug: { type: 'noul', instructions: 'Is this a software bug report?' },
team: { type: 'choice', instructions: 'Which team should handle this?', options: ['billing', 'support', 'sales'] },
},
});
console.log(decision.probability('is_bug'), decision.choice('team'), decision.cost);The SDK readers return None / undefined for a refused or errored answer.
Compare two models
Send the same body to each slug and compare answers, cost and latency:
body = dict(
state="Customer email: I was charged twice this month, please refund one.",
questions={"is_bug": noul("Is this a software bug report?")},
)
for slug in ("jev-1.14", "microsoft-decision-1.1"):
d = segmind.decide_sync(slug, **body)
print(slug, d.probability("is_bug"), d.cost, d.latency_ms)Each decision model's page has a playground that does this side by side.
Notes
- Billing is per call, for the tokens the call uses;
coston the response is the exact charge. - No streaming. A decision arrives whole.
- A field a question type does not take, or an unknown top-level field, is
ignored and listed in
warnings.
Structured Outputs
Constrain a chat model's reply to JSON — or to a JSON Schema you supply — with response_format, and know where the JSON arrives for each provider.
Web Search Grounding
Ground Gemini text and image generations in live Google Search results with web_search: true, and read back the queries and sources behind the answer.