On this page

Use the official TypeSafe SDK or OpenRouter Decisions API from your candidate application.

Jev with the TypeSafe SDK or OpenRouter API

Use the AI API token from your assessment's Tools & APIs tab. This is the key for your application; your coding assistant's preconfigured key is separate. The assessment must enable OpenRouter and allow the Jev model. The same assessment API budget applies to every endpoint below.

Jev returns typed answers and probabilities from state and questions. typesafe/jev-router is a different product: it chooses a generative chat model. Use the decision model for classification and verification.

Official TypeSafe SDK

Take the AI API base URL from Tools & APIs and remove its trailing /v1. Set TYPESAFE_BASE_URL to that value (ending in /proxy/openai) and TYPESAFE_API_KEY to your AI API token. Keep the token in your environment, not in source control.

The SDK adds /v1/systemone. No custom client or request wrapper is needed.

python
import os
from typesafe_sdk import TypeSafeClient

with TypeSafeClient(
    api_key=os.environ["TYPESAFE_API_KEY"],
    base_url=os.environ["TYPESAFE_BASE_URL"],
) as client:
    result = client.system_one(
        model="jev-1.13",
        state="The customer was charged twice and asks for a refund.",
        questions={
            "refund": {
                "type": "noul",
                "instructions": "Is the customer requesting a refund?",
            }
        },
    )
    print(result.answers["refund"])
javascript
import { TypeSafeClient } from "@typesafe-ai/sdk";

const client = new TypeSafeClient({
  apiKey: process.env.TYPESAFE_API_KEY,
  baseURL: process.env.TYPESAFE_BASE_URL,
});
const result = await client.systemOne({
  model: "jev-1.13",
  state: "The customer was charged twice and asks for a refund.",
  questions: {
    refund: { type: "noul", instructions: "Is the customer requesting a refund?" },
  },
});
console.log(result.answers.refund);

Bare model names follow OpenRouter's documented mapping: jev-1.13 becomes typesafe/jev-1.13, and jev-latest becomes ~typesafe/jev-latest. A pinned assessment allowlist still applies; the latest alias does not bypass it.

OpenRouter Decisions

Append /api/alpha/decisions to TYPESAFE_BASE_URL. The result ends in /proxy/openai/api/alpha/decisions, matching OpenRouter's /api/alpha/decisions path under the gateway base. Use the AI API token as the bearer key:

sh
curl "${TYPESAFE_BASE_URL%/}/api/alpha/decisions" \
  -H "Authorization: Bearer $TYPESAFE_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"model":"typesafe/jev-1.13","state":"Please refund the duplicate charge.","questions":{"refund":{"type":"noul","instructions":"Is a refund requested?"}}}'

If you already use the OpenAI-compatible Candidate API base URL ending in /proxy/openai/v1, append /systemone or /alpha/decisions. Existing /decisions callers remain supported. With an OpenRouter SDK that appends /api/alpha/decisions, use the gateway base ending in /proxy/openai.

Do not send a decision model to chat completions or Responses. An error there names the supported gateway endpoints. A model_not_allowed error means the assessment's API model permissions exclude that model; an unsupported_capability error means the credential belongs to a coding tool rather than the Candidate API.

Discover models through the SDK

The official Python and JavaScript SDKs support model discovery through the same base URL and AI API token:

python
with TypeSafeClient(api_key=os.environ["TYPESAFE_API_KEY"], base_url=os.environ["TYPESAFE_BASE_URL"]) as client:
    for model in client.models.list().models:
        print(model.name, model.release_date, model.description)
javascript
const models = await client.models.list();
for (const model of models) {
  console.log(model.name, model.release_date, model.description);
}

Discovery returns live OpenRouter decision models filtered by your assessment's API model permissions. Use the returned name unchanged in system_one or systemOne; names include the provider prefix, such as typesafe/jev-1.13. Release dates come from OpenRouter's catalog creation dates. An empty list means no listed decision models match your assessment's permissions. Listing does not consume inference budget; actual calls still require remaining budget.

The SDK identifies itself automatically; no extra header is needed. OpenAI clients continue to receive their usual model-list format. Coding-tool credentials cannot be used for TypeSafe discovery or decisions.

Reference: OpenRouter's TypeSafe SDK guide, TypeSafe model discovery, and TypeSafe API.

    Jev decisions · Litmus docs