Skip to navigation

Answer typed questions about supplied state

View as Markdown

Relays to https://api.typesafe.ai/v1/systemone, overwriting Authorization with the gateway’s TypeSafe key — the upstream authenticates on the same header your gateway token arrives in, so the swap is both the injection and the strip. This is the only mounted TypeSafe route and TypeSafe’s only billable endpoint; every other /typesafe/* path, and any method other than POST, answers the gateway’s own 404.

The body is forwarded as sent. It carries three required fields — state (the content to evaluate, as a string, object, or array), model, and questions (a map of ids you choose to typed question objects, answered back under the same ids). TypeSafe rejects an unrecognized top-level field with its own 400, so the gateway adds no second policy.

Each question is one of three types. A noul returns the probability the answer is yes; a choice returns the picked option plus the probability of every option and a confidence; a score returns a probability-weighted value across the ordered levels you describe, with the same distribution and confidence. The state is read once however many questions ride along, which — since billing counts input tokens only — makes batching markedly cheaper than one call per question.

jev-1.13.0 is the current model; jev-latest and jev-preview are aliases that may move without notice. The response always names the concrete version that answered, so a request for jev-latest comes back as "model": "jev-1.13.0".

TypeSafe’s answer comes back exactly as it arrived — status, headers, and body bytes — and the charge is settled from the usage.input_tokens it reports, at $0.04431 per million input tokens (TypeSafe’s rate plus the gateway’s 5.5% fee). Output tokens are free upstream and are not billed here.

Authentication

AuthorizationBearer

Your per-client bearer token — the API key the gateway issued to you. Present it in Authorization: Bearer <token> form. A token that is missing, unknown, or revoked draws a 401. Before the call is sent upstream the token is removed (stripped, or swapped for the upstream’s own credential); it never makes it past the gateway.

Request

This endpoint expects an object.
statestring or map from strings to any or list of anyRequired

The content to evaluate — text, or structured data for records, chat logs, or application state.

modelstringRequired
The model that handles the request. A version, or one of the two aliases.
questionsmap from strings to objectsRequired
A map of ids you choose to typed question objects. Answers return under the same ids.

Response

Whatever the upstream answered, relayed as-is (status, headers, body). Rendered here as JSON; the true shape is the upstream provider’s to define.

Errors

401
Unauthorized Error
404
Not Found Error