Skip to navigation

Decision API

View as Markdown

Answers a set of typed questions about one input and returns a calibrated probability for every allowed option. The model does not generate text, so there is nothing to parse.

Models: sarvam-prism (serverless) and clef (Provisioned Throughput; also reads images).

Requires api-subscription-key, or Authorization: Bearer <key>.

Question types: noul (yes/no), choice (one of your options) and score (a level on your ordered scale).

Repeatability: on sarvam-prism, probabilities can vary slightly between identical requests and the top answer is stable; the order of choice options does not affect the answer. On clef, identical requests return identical probabilities.

Images: clef reads base64 images in images; image URLs return 400. sarvam-prism refuses images (image URLs return 400, inline images 422).

Not supported: streaming. temperature returns 422 on both models. sarvam-prism also refuses max_tokens and stream with 422; clef accepts and ignores them. Unknown keys inside a question return 422.

Limits:

  • sarvam-prism: 32,768 tokens per question (state + question + options), 2–255 options per choice, and 2–10 levels per score. If any one question breaks a limit, the whole request fails with 422.
  • clef: 65,536 tokens per request (state, every question and its options, and images), 1–255 options per choice, and 1–10 levels per score. A longer request fails with 400.

There is no cap on the number of questions, and the state is never truncated.

Timeout: each request must finish within 60 seconds. A longer request fails with 503 model_overloaded; split very large batches across several requests before retrying.

Errors: every error carries a message, a code and a request_id. Validation errors also carry param, the path to the field at fault, such as questions.urgent.noul.instruction.

Authentication

api-subscription-keystring
API Key authentication via header
OR
AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Request

This endpoint expects an object.
modelstringRequired

The decision model to use. sarvam-prism (Sarvam Prism, serverless) or clef (Clef, on Provisioned Throughput; also accepts base64 images, up to 65,536 tokens per request).

statestring or map from strings to any or list of anyRequired

The input to decide on: text, or an object or array that is rendered as compact JSON. Required; an empty string is allowed. It is never truncated: if any one question (state + question + options) exceeds 32,768 tokens the request fails with 422.

questionsmap from strings to objectsRequired
Map of your question ID to a question, at least one. There is no cap on the number of questions. Every question is answered in one call, and the answer uses the same ID.

Response

Successful Response
modelstring
answersmap from strings to objects
One answer per question, keyed by your question ID.
usageobject

Errors

400
Bad Request Error
402
Payment Required Error
403
Forbidden Error
404
Not Found Error
422
Unprocessable Entity Error
429
Too Many Requests Error
500
Internal Server Error
502
Bad Gateway Error
503
Service Unavailable Error