Evaluate

Evaluate questions

Send any JSON state and one to 512 typed questions. Each question gets an answer with calibrated probabilities under the same id.

  • Billing: only a 200 is billed, at the per-input-token price.
  • Unknown keys: top-level keys Drex doesn't know are ignored.

Checks run in this order and stop at the first failure:

  1. API pause (529)
  2. Key and credit (401, 402)
  3. Rate limits (429, 529)
  4. Body validation (422)
  5. Model evaluation (422 for too many tokens, 529 when the model service does not answer within 55 seconds)
post/v1/systemone

Request

Headers

X-Nace-Legend'array' | 'object'

The shape of a score answer's legend: array or object. Without it, legend is an array, except for a request with an X-TypeSafe-SDK header (any non-empty value) or a User-Agent that starts with typesafe-sdk/ or langchainjs-typesafe/, which gets an object keyed by the level index. This header wins in both directions. Any other value is ignored. Only the shape changes.

Request body

statestring required

Any JSON value: string, number, boolean, null, object, or array. Drex passes it to the model as is. The key must be present, but null is accepted.

questionsobject required

Map of question id to question.

  • Count: at least 1 and at most 512 questions; drex-max, drex-max-v1.1 and drex-max-finance allow 255 options or levels per question.
  • Ids: non-empty, and not only whitespace.
  • Size: state and questions (and images when it is nonempty), serialized together as JSON, must be at most 4194304 bytes.
  • Token limits: the state must fit the model's state limit, and the state plus the longest question must fit its row limit.
    • drex-v1.5: 131,072 state, 139,264 row.
    • drex-v2.0: 131,072 state, 262,144 row.
  • Text only: images, audio, video and PDFs anywhere in state or questions are rejected with a 422. That covers base64 data URLs, raw base64 files, and OpenAI, Anthropic and Gemini media content parts. drex-max, drex-max-v1.1 and drex-max-finance read images from the top-level images array instead.
modelstring

Optional. Which version answers the request.

  • Active pinned id (drex-v1.5, drex-v2.0): served by that version.
  • drex-latest: served by the version it points to, currently drex-v2.0. It moves to a newer version only on an announced date.
  • Retired id (drex-v1.0 → drex-max, drex-v1.1 → drex-v1.5): served at its successor's price and limits, and the response model reports the successor.
  • Legacy nacedm-latest, or no model: served like drex-latest.
  • Not available yet: a registered id unavailable to the API key in this environment returns 422 with issue path model.
  • Anything else, including an unregistered drex-* name or a TypeSafe SDK default such as jev-latest: returns 422 with issue path model.

GET /v1/models lists the models available to the requesting API key in that environment, each alias with its alias_for, and a retired id with alias_for set.

Example request

{
  "state": "I was charged twice for my March invoice. Please refund one of the charges.",
  "model": "drex-v1.0"
}

Response

Every question answered. usage.input_tokens is debited from the account's balance before the response is returned.

model'drex-v1.5' | 'drex-v2.0' | 'drex-max' | 'drex-max-v1.1' | 'drex-max-finance' required

The pinned version that served the request, never an alias or a retired id. It is the version model named, the successor of a retired id (drex-max for drex-v1.0, drex-v1.5 for drex-v1.1), or the version drex-latest points to (currently drex-v2.0) when model is drex-latest or nacedm-latest, or is omitted. The request is billed at this version's price.

answersobject required

One answer per question, under the same ids as the request's questions.

evaluation_time_msnumber required

Time the model service spent on this request, in milliseconds. May be fractional. Excludes network time and Drex's own checks.

request_idstring required

Identifier of this request, req_ plus 32 hex characters. Also sent in the x-request-id header, and on /v1/systemone and /v1/models in x-typesafe-request-id too. Quote it in support requests.

Example response

{
  "usage": {
    "input_tokens": 106,
    "output_tokens": 212
  },
  "evaluation_time_ms": 142.6,
  "request_id": "req_bd2dffad68f5f5fa4ce702e9bd516fb4"
}

Changes

No recorded changes to this operation across all 1 revision of this API.