03 / 06

How to use Jev

Three ways to reach the same model — Vercel AI Gateway, TypeSafe's own API, and OpenRouter — with the working code for each, and the one naming difference that silently breaks a port between them.

01Pick a route

Three routes reach the same model. Which you want depends on whether you already have a Vercel account, whether you need other models beside this one, and how much you care about being able to move later.

Fig. 01
RouteModel idRequires
Vercel AI Gatewaytypesafe-ai/jevAI SDK 7 or later
TypeSafe APIjev-latest, jev-1.12Any HTTP client
OpenRoutertypesafe/jev-latestAn OpenRouter key
The three routes, as of September 2026.

02Vercel AI Gateway

The shortest path if you are already in the TypeScript ecosystem. Evaluation is part of the AI SDK itself, so there is no separate client to install.

Fig. 02
app/api/evaluate/route.ts
import { experimental_evaluate as evaluate } from 'ai';

const result = await evaluate({
  model: 'typesafe-ai/jev',
  state: 'The support agent issued a full refund to the customer.',
  questions: {
    refunded: {
      type: 'boolean',
      instructions: 'Was a refund issued?',
    },
  },
});

// { refunded: { type: 'boolean', probability: 0.99 } }
console.log(result.answers);
A single boolean question through the AI SDK.

03TypeSafe’s own API

One POST, no SDK, any language. This is the route to use if you are not on Node, or if you want to see the raw shape of what the model returns.

Fig. 03
curl https://api.typesafe.ai/v1/systemone \
  -H "Authorization: Bearer $TYPESAFE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "state": "The support agent issued a full refund to the customer.",
    "model": "jev-latest",
    "questions": {
      "refunded": {
        "type": "noul",
        "instructions": "Was a refund issued?"
      }
    }
  }'

# { "answers": { "refunded": { "type": "noul", "noul": 0.99 } } }
The same question against the direct endpoint.

04The difference that breaks ports

The two routes above ask the same model the same question and disagree on what to call it. Nothing errors when you get this wrong — you read a field that is not there and get undefined, which quietly becomes a false verdict.

Fig. 04
AI SDK / GatewayTypeSafe API
Type namebooleannoul
Answer fieldprobabilitynoul
Usage keysinputTokensinput_tokens
The same yes/no question, named two different ways.

05Asking several questions at once

This is where the economics change. Questions of different types share one state and are answered in one round trip, so a four-question judgment costs roughly what a one-question judgment costs — you are billed for the state, and the state is sent once.

Fig. 05
const result = await evaluate({
  model: 'typesafe-ai/jev',
  state: 'I cannot log in, and I also want a refund for last month.',
  questions: {
    authIssue:   { type: 'boolean', instructions: 'Is there a login problem?' },
    wantsRefund: { type: 'boolean', instructions: 'Is a refund requested?' },
    urgency:     { type: 'score', instructions: 'How urgent is this ticket?',
                   criteria: ['low', 'medium', 'high'] },
  },
});
Two booleans and a score in a single request.

06Errors worth handling

The direct API returns 401 for a bad key, 422 when a request fails validation, 429 for rate limiting and 529 when the service is overloaded. TypeSafe advises exponential backoff on the last two. Treat 422 as a bug in your question shape rather than something to retry.