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.
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 mode | Jev from TypeScript | |
|---|---|---|
| Return type | string you cast | the union you declared |
| Invalid enum | handle it | cannot occur |
| Retries/repair | often | none |
| Confidence | you estimate it | calibrated, returned |
| Latency | seconds | ~70–500ms |
- Response keys == the options you declared — type it once
- No JSON-mode retries, no schema-repair, no invalid enums
- Calibrated confidence (RLCD) to branch on
- Same call from any runtime — it's just an HTTPS POST
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.