Skip to main content

TypeSafe SDK

You can point an existing TypeSafe client at OpenRouter by changing its base URL. Requests to System One models such as Jev are then billed to your OpenRouter account and routed through OpenRouter’s System One API.

Base URL

OpenRouter’s System One API is available at the following base URL:
The SDK appends /v1/systemone to the base URL, so requests are sent to https://openrouter.ai/api/v1/systemone.

Authentication

Use your OpenRouter API key as the Authorization: Bearer <token> header. The SDK sets this header from the apiKey option (api_key in Python) or the TYPESAFE_API_KEY environment variable.

Migrating an existing client

Change the base URL and the API key. Everything else stays the same.
Both SDKs also read the base URL from the TYPESAFE_BASE_URL environment variable, so you can leave the constructor unchanged and set TYPESAFE_BASE_URL=https://openrouter.ai/api and TYPESAFE_API_KEY=<your OpenRouter API key> instead.

Evaluating state against questions

Model IDs

The System One API accepts TypeSafe’s bare System One model IDs and maps them onto OpenRouter’s typesafe/ namespace before routing:
  • jev-1.13 is routed as typesafe/jev-1.13.
  • jev-latest is routed as ~typesafe/jev-latest, OpenRouter’s alias for the newest Jev release.
  • IDs that already carry an author prefix, such as typesafe/jev-1.13, are used as-is.
The model field in the response contains the OpenRouter model ID of the System One model that served the request.

Supported endpoints

  • POST /api/v1/systemone sends state and typed questions to a System One model and returns its answers.
The TypeSafe SDK’s model listing (client.models.list() in JavaScript) calls GET /api/v1/models, which is OpenRouter’s Models API and returns OpenRouter’s response shape rather than TypeSafe’s, so the SDK rejects it. Browse OpenRouter’s System One models or call the Models API directly instead.

Request and response format

The System One API implements TypeSafe’s request and response shapes. Requests require model, state, and questions, and responses contain model, answers, and usage. OpenRouter additionally returns id, provider, and usage.cost, which both SDKs pass through without error.
systemone.sh
Response