Classify
POST /v1/decision-machine-1/classify puts one text into one label. You send the text and between
2 and 64 labels. The API returns the winning label name, its probability, a confidence number, and
the full score distribution. The model reads the label text itself. A label named billing with
the description payments, invoices, charges, refunds therefore scores better than a bare name.
Typical latency is about 1.2 seconds. No API key is required during the launch period.
When to use it
- You route text into one of several buckets: intents, topics, queues, tiers.
- You need the runner-up scores, not only the winner.
- You want a stable number to threshold on, not a generated word.
- Use Yes / no instead when the two “labels” are one claim and its negation.
- Use Rate instead when the labels are ordered levels, such as calm to angry.
Three example decisions
- A support message arrives. Classify it into
billing,shipping, oraccount, then put it in that queue. - A user sentence arrives at an agent. Classify it over tool descriptions and call the winning tool.
- A document paragraph arrives. Classify it into a taxonomy node, then walk one level deeper.
Request
The API sends "name: description" to the model when a description exists. It sends the bare name
otherwise. The response always returns the label name, never the description.
Response
label— the name of the winning label.probability— the winner’s normalized share, between 0 and 1, rounded to 3 decimals.confidence—1 − normalized entropyoverscores. 1 means one clear winner. 0 means a flat distribution.scores— one normalized probability per label name. The values sum to 1, before 3-decimal rounding.
Two response headers report the input size. x-input-chars is the number of input characters.
x-input-tokens is the input tokens billed for this call. See Pricing.
Reading the numbers
The response above says three things. The winner is billing with a 0.995 share of the
distribution. confidence 0.97 says the distribution has one sharp peak, so the runner-up is far
behind. scores shows the same fact from the other side: shipping scored 0 and account scored
0.005.
Now read an unclear case. The text "Hi, I have a question about my order." over the same labels
returns:
The winner still looks acceptable at 0.52, but confidence 0.067 reports a near-flat
distribution. Two labels sit within 0.01 of each other. Route this message to a person, not to a
queue.
Use both numbers in your rule. Act when probability and confidence are both high. Ask the user
when probability is high and confidence is low. Escalate every other case. Pick the exact
cut-offs per action from your own data, as
Thresholds and confidence routing describes.
Label descriptions move the numbers. The same text over the bare names billing, shipping and
account returned a tie: probability 0.5 for billing, confidence 0.369, with account also
at 0.5. The described labels returned 0.995 and 0.97.
Batching
Send texts instead of text to classify up to 32 texts in one call. The response is always
{"results": [...]}, one entry per text, in input order.
One label set applies to the whole batch. Each text costs one inference call, so a batch of 32 costs 32 calls. See Batching for how batches spread across inference slots.
Limits and gotchas
textholds up to 20,000 characters.textsholds up to 32 items.- The array form of
labelstakes 2 to 64 items. One label returns{"error":{"code":"invalid_request","message":"labels: Too small: expected array to have >=2 items"}}. textandtextsare mutually exclusive. Sending both fails withbody: provide text or texts, not both. Sending neither fails with the same message, which is misleading in that case.- Label names must describe the case. Names such as
type_aandothercarry no meaning for the model. Write a description for every label. - The API chunks texts over 2,000 characters. A label’s score is its maximum over the chunks, so a topic that appears only in the last paragraph still scores high. Cost stays linear in characters. Long text and chunking has the detail.
- The object form of
labelshas no count limit. One label always returnsprobability1 andconfidence1, whatever the text says. Send two or more labels. scoreskeys are the label names you sent, including names with spaces or punctuation.
probability is a normalized share of the label set you sent, not a calibrated truth value. Adding
or removing a label changes every number. Re-tune your thresholds after you change the label set.
Next
- Writing good statements and labels — how to word a label so the model reads it correctly.
- Thresholds and confidence routing — turn
probabilityandconfidenceinto an action. - Intent routing — classify as a router in front of tools or agents.