API · Last updated

TypeSafe JavaScript SDK

The TypeSafe JavaScript SDK (@typesafe-ai/sdk) is the official Node client for POST /v1/systemone. It requires Node.js 20 or newer. ESM, CommonJS, and TypeScript declarations ship in the package. TypeSafeClient.systemOne is the evaluation method; helpers such as choice(), noul(), and score() infer answer types from the questions you pass.

This page is for builders wiring TypeSafe Jev (System One) into agents, routing, or evals. jev.pro is an independent unofficial field guide — not affiliated with TypeSafe AI. We do not sell or issue keys. Confirm package name, Node floor, and retry policy on docs.typesafe.ai and the API reference.

Install and first call

npm install @typesafe-ai/sdk
import { choice, TypeSafeClient } from "@typesafe-ai/sdk";

const client = new TypeSafeClient();
const response = await client.systemOne({
  state: { document: "I was charged twice. Please fix this ASAP." },
  questions: {
    category: choice("What is this ticket about?", {
      billing: null,
      technical: null,
      other: null,
    }),
  },
});

console.log(response.answers.category.choice);

The client reads TYPESAFE_API_KEY. Prefer the helpers over hand-rolled JSON if you want inferred answer types. The HTTP body is still model, state, and questions. Choice criteria are an unordered map (max 255). Score criteria are a 2–10 level array. Noul returns noul only — no confidence. Choice and Score return probabilities plus confidence.

The SDK still sends Content-Type: application/json. If you expected multipart or audio parts, see Jev API content types. System One is text only; English is primary.

Gateway

To send traffic through Vercel AI Gateway, Vercel documents apiKey: process.env.AI_GATEWAY_API_KEY and baseURL: 'https://ai-gateway.vercel.sh/typesafe'. Confirm current Gateway docs — that is a Vercel surface. The Gateway model id typesafe-ai/jev is not the first-party model field. First-party aliases jev-latest and jev-preview currently resolve to jev-1.13.0 (confirm on the models page).

Production notes

Official SDKs retry 429 and 529 by default. Honor retry-after. A 401 is a key problem; a 422 is a body problem. Application “errors” (low confidence) often arrive as 200.

Do not expose a production key to end-user browsers. Pin jev-1.13.0 once you tune floors; log response.model. Question ids are not sent to the model — they only key answers.

TypeSafe’s public list price is a vendor claim: $0.042 per million input tokens, output free. 250k tok/s, 1200 RPM, 64k/32k context, and 70ms–500ms / 40x–200x launch-post figures are also vendor claims.

When not to use this package

Use Python if that is the service language. Use raw HTTP if you cannot take an npm dependency. JS helper names (choice) do not match Python class names (Choice).

See also

FAQ

Does the JS SDK issue a key?

No. It reads an env var you already set. This site will never give you one.

Retries?

Official SDKs retry rate limits and overload by default. See TypeSafe’s JS timeout/retry pages if you need to change policy. Do not retry 401 or 422 without changing the secret or the body.

Can I use this in the browser with a secret?

Do not expose a production key to end-user browsers. Browser demos leak.

systemOne vs system_one?

JavaScript uses systemOne. Python uses system_one. Both map to POST /v1/systemone.

What this page does not claim

Disclaimer

This is an independent unofficial site and is not affiliated with TypeSafe AI; official documentation is available at https://docs.typesafe.ai. Never treat jev.pro as TypeSafe official documentation. We do not sell, issue, or proxy API keys.

Sources