← Use cases

Using Jev from TypeScript

TypeSafe AI means the type safety reaches all the way into your TypeScript. You define the options, and Jev returns one of them — never free text, never an invalid label — so the response lines up with your types instead of fighting them.

Jev is TypeSafe AI's first System One model. A call is a model plus state plus a map of questions, and each question is constrained to the options you declare. From TypeScript that is a perfect fit: the keys you send are the only keys you can get back, so you can type the response once and trust it everywhere.

request questions: { verdict: choice[...] } response verdict: { key, probs, confidence } same keys
The response mirrors the request: the question keys you send come back as typed answers with the same keys.

A typed decide call

type Verdict = "approve" | "review" | "reject";

const res = await fetch("https://jevtypesafeai.com/api/v1/decide", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Authorization: `Bearer ${process.env.JEV_KEY}`, // jv_live_...
  },
  body: JSON.stringify({
    state: { text: input },
    questions: {
      verdict: { type: "choice", instructions: "How should we handle this?",
                 criteria: { approve: "safe to approve", review: "needs a human", reject: "clearly bad" } },
    },
  }),
});

const data = (await res.json()) as {
  answers: { verdict: { choice: Verdict; probabilities: Record<Verdict, number>; confidence: number } };
};

if (data.answers.verdict.confidence > 0.8) act(data.answers.verdict.choice);

Because answers.verdict.choice is one of your literal options, TypeScript narrows it for you — the switch is exhaustive, and there is no branch for a label the model invented, because it can't invent one. Jev emits the value in a single non-autoregressive pass, so there is no JSON mode to coax, no schema-repair retry, and a 0% structured-output error rate by construction.

Why this beats parsing an LLM reply

LLM + JSON modeJev from TypeScript
Return typestring you castthe union you declared
Invalid enumhandle itcannot occur
Retries/repairoftennone
Confidenceyou estimate itcalibrated, returned
Latencyseconds~70–500ms

Get a key

Create a jv_live_ key from the dashboard and drop it in an env var. The endpoint above is the hosted TypeSafe AI gateway; the official upstream is POST https://api.typesafe.ai/v1/systemone with the same shape, so code written for one points at the other by changing the base URL.

FAQ

Is there an official TypeScript SDK?

You don't need one — a decide call is a single JSON POST, so plain fetch with a typed response works everywhere (Node, Bun, Deno, edge runtimes, the browser). Type the response once against the options you declared and it stays correct.

Can Jev return a label I didn't define?

No. The output is locked to the criteria in your question, so the returned choice is always one of your literal union members. That is the 'type-safe' guarantee, separate from calibration.

How do I use the confidence in TypeScript?

Read data.answers.<question>.confidence — a calibrated number you branch on. A common pattern is to act automatically above a threshold and route everything below it to review.

See also: How to use the API · Docs · Get an API key · Pricing

Call Jev from TypeScript

Grab a jv_live_ key and get a fully typed decision in one fetch.

▶ Try Jev freeGet an API key →
Jev + TypeScript — typed AI decisions with no parsing · Jev by TypeSafe AI