Lesson 1 Β· ~10 minutes

Jev: the smart if statement

What Jev is, its three question types, and how to wire one decision into a TypeScript product.

Your win for today: look at any product feature and say whether a decision belongs to Jev or to an LLM, then write the Jev call and the threshold code for it.

0 Β· Four words first

πŸ“¦stateThe data you hand Jev, such as a ticket or a message.
❓questionA named, typed ask with a fixed set of possible answers.
πŸ“ŠprobabilitiesHow likely each allowed answer is.
🎯confidenceWhether there's one clear winner or the weight is spread out.

1 Β· What it is

Jev is a model from TypeSafe AI. It returns typed decisions, not generated text.1 TypeSafe calls it a System One model: it's built for fast, automatic judgments that your software makes thousands of times, not for long chains of reasoning.1 You decide the possible answers before you call it. The policy that acts on the answer stays in your code.2

Watch one call run, or scrub through it. Press β–Ά, use the chapter buttons, or turn on πŸ”‡ β†’ πŸ”Š for narration:

The numbers come from the request/response example in Firecrawl's guide.1 Paused, the final frame works as a static diagram.

JevTypical LLM
OutputTyped answer + probabilitiesFree text (you parse it)
Latency70–500 ms, most ~100 ms2Seconds
Price$0.042 / M input tokens, output free2$0.20–$10 / M1

2 Β· Three question types

choice billing technical sales
Which option from my list? Returns the winning option, a probability for each option, and confidence.
score 12345 4 cosmeticoutage
Where on my rubric? Returns a position on the scale, plus probabilities and confidence.
noul "This is spam." 0 falsetrue 1 0.87
Is this statement true? Returns a single probability from 0 to 1.

3 Β· The call, annotated

import { choice, TypeSafeClient } from '@typesafe-ai/sdk'
const client = new TypeSafeClient()

const { answers } = await client.systemOne({ 1
  state: { ticket: 'Export button crashes in Safari' }, 2
  questions: {
    category: choice('What kind of ticket?', { 3
      bug_report: 'Something is broken',
      feature_request: 'New feature request',
    }),
  },
})
// answers.category.choice      β†’ 'bug_report' 4
// answers.category.confidence  β†’ 0.95
  1. systemOne makes one call. The raw endpoint is POST https://api.typesafe.ai/v1/systemone.2
  2. The state: only what the decision needs.
  3. The key (category) names the answer. The object lists the only answers Jev is allowed to return, and each description is read literally.2
  4. A typed result. There's no parsing, and an answer outside your list is impossible.2

4 Β· Confidence β†’ bands

A probability belongs to one option. Confidence describes the whole distribution.3 Both answers below have a winner, but only one can be trusted to act on alone. Use the toggle:

The 0.61 / 0.35 split is Copes' example: "returns" wins, but the ticket really touches two teams.3 Toggle to an illustrative clear-cut ticket and watch the weight move to one option as confidence rises.

Your code turns confidence into an action using two lines:3

Where 0.42 lands: below the confirm line, so a human triages it.
const ASSIGN = { act: 0.8, confirm: 0.5 }

const c = department.confidence
if (c < ASSIGN.confirm) return { action: 'triage' }                 // human handles
if (c < ASSIGN.act)     return { action: 'suggest', team: department.choice }
return { action: 'assign', team: department.choice }               // automatic

Don't copy the 0.8 / 0.5 numbers. Run Jev over labeled examples, measure accuracy in each confidence bucket, and set the lines where accuracy meets the error cost you can live with (for example, 90%+ for refunds).3

Zoom out: where the decision lives

TypeSafe's own design guide sums this up as "keeping code in control and giving System One narrow, structured decisions."5

5 Β· Jev or LLM?

Is the answer from a fixed set you can list? no LLM text Β· code Β· summaries yes Needs math, dates or multi-step reasoning? yes Code first, or LLM compute it, then ask Jev no Jev βœ“
Also prefer an LLM or a human for rare, high-stakes calls. Keep the state under 64k tokens and trim it.1 Jev can't generate text and struggles with arithmetic and dates.12

In AI dev workflows, Jev works well as the fast gate around an LLM agent. It can decide which tool or path to take, whether an output passes a check, or whether to escalate. The LLM does the generating.


Practice: from memory

A Β· Place the marker

The zones are hidden. Remember where the lines are, pick the band, and repeat a few times.

B Β· Fill the faded example

This is the same call as in section 3, with parts blanked out. Fill it in without scrolling up.

const { answers } = await client.({
  : { ticket },
  : {
    team: ('Which team?', { billing: '…', technical: '…' }),
  },
})
if (answers.team. < 0.5) return { action: '' }

C Β· Quick quiz

1. Route each support ticket to billing, technical, or sales.

2. "This comment is spam." True or false?

3. Rate how severe a bug report is, from cosmetic to outage.

4. confidence measures the…

5. You need to know whether a cart total is over $500. How do you get that answer?

6. Your agent needs to draft a reply to the customer. Which model should do that?

πŸ† Milestone challenge: Pick Jev vs LLM + Write solid calls

Pick one real feature from your product or agent workflow. Write the following and paste it back to me in chat:

  1. The questions object: at least one choice and one noul.
  2. The state you'll send, trimmed to only what the decision needs.
  3. Your band lines, and what happens in each band. A rough sketch of your own band diagram is welcome too.

I'll review it like a code review. If it passes, I'll mark the milestones mastered on your dashboard.

Primary source: read the official TypeSafe docs next, starting with the Quick Start. Then read Flavio Copes on confidence, which covers setting thresholds in production.

Access note: direct sign-ups have been paused at times (one source reports a pause on 22 Sep 2026).1 Jev is also available through the Vercel AI Gateway as typesafe-ai/jev, and through OpenRouter.

Stuck or curious? Ask me follow-up questions in the terminal. I'm your teacher for this, and nothing is too basic to ask.