Jev TypeScript quickstart
Jev is a natural fit for TypeScript: you declare the shape you want and get it back, typed. Here's the whole path — install, key, a working example, and the three primitives — with nothing to read past the code.
Every example needs a jv_live_ key. Grab one on the pricing page, export it as JEV_API_KEY, and you're ready. Get a key →
If you're already reaching for Jev from TypeScript, you probably want the same thing TypeScript gives you everywhere else: a contract. You declare the decision you need — a choice between these keys, a score on this scale, a calibrated yes/no — and you get exactly that shape back, never a stray paragraph you have to parse or a JSON blob that occasionally comes out malformed. That's the whole pitch of a "type-safe" AI call, and it's why Jev slots into a typed codebase without the defensive parsing you'd write around a raw LLM.
1. Install
npm i @typesafe-ai/sdk2. Set your key
Grab a jv_live_ key on the pricing page and put it in your environment. The SDK reads it automatically, so nothing sensitive lands in your source.
export TYPESAFE_API_KEY=jv_live_...3. A 30-line working example
One call, two typed answers — a choice you can route on and a calibrated yes/no you can threshold:
import { TypeSafe } from "@typesafe-ai/sdk";
const client = new TypeSafe(); // reads TYPESAFE_API_KEY
const resp = await client.systemOne({
model: "jev-latest",
state: "Customer: I was charged twice and I am furious.",
questions: {
topic: {
type: "choice",
instructions: "What is the issue about?",
criteria: { billing: "money problems", bug: "broken product" },
},
urgent: {
type: "noul",
instructions: "Escalate to a human now?",
},
},
});
// typed, calibrated — branch on it directly
if (resp.answers.urgent.noul > 0.7) escalate(ticket);
routeTo(resp.answers.topic.choice); // "billing" | "bug"Notice there is no output parsing, no schema validation, no retry-on-bad-JSON. resp.answers.topic.choice is one of your criteria keys because the model cannot return anything else, and resp.answers.urgent.noul is a number between 0 and 1. That's the type contract doing its job.
The three primitives
- choice — returns one of your keys, with per-option probabilities. For routing and classification.
- score — returns a number on an ordered scale you define, plus a distribution. For rating quality, risk, priority.
- noul — a calibrated yes/no with a probability. For gates and checks.
You can ask several at once in a single call — the example above asks two — and each comes back independently typed. That keeps round-trips down: one request can classify, score and gate the same input together.
A note on calibration
The probabilities Jev returns are calibrated, meaning a 0.8 should be right about 80% of the time across many calls — but calibration is a property of the aggregate, not a guarantee about any single answer. So set thresholds against your own labelled data rather than assuming a raw number is "confident enough". The upside of a hosted, pinned model is that once you've tuned a threshold, it stays meaningful between deploys instead of drifting under you.
Prefer no SDK?
It's a single POST — hit the gateway directly with fetch and a Bearer key:
const r = await fetch("https://jevtypesafeai.com/api/v1/decide", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.JEV_API_KEY}`,
},
body: JSON.stringify({ state, questions }),
});
const { answers } = await r.json();Need batch, ready-made endpoints, or the full field reference? The docs cover the whole surface.
FAQ
Do I need the TypeSafe SDK to use Jev from TypeScript?
No. The SDK is a thin convenience wrapper; Jev is a single POST, so you can call it with plain fetch and a Bearer key. The SDK just gives you typed helpers and reads your key from the environment.
Is Jev's output actually type-safe?
Yes — a choice question returns one of the criteria keys you defined and nothing else, and a score returns a number on your scale. The model cannot emit an invalid type, so you skip the defensive parsing you'd write around a raw LLM.
How is calling Jev different from calling an LLM from TypeScript?
An LLM returns free text (or JSON you must validate and sometimes retry). Jev returns a typed, calibrated value — a key, a number, or a probability — in 70–500ms, so you branch on it directly. Use an LLM to write; use Jev to decide.
What does a Jev call cost?
About $0.001 per decision. Billing is on input tokens only at roughly $0.42 per million, with output free — so asking several questions in one call is cheap.
Can I ask multiple questions in one request?
Yes. Pass several entries in the questions map and each comes back independently typed in resp.answers, which keeps you to a single round-trip.
See also: API docs & reference · How to use the API · Jev vs an LLM
Try Jev before you wire it in
Run a real, typed decision in the browser — free, no signup — then drop your key into the example above.