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.
| Route | Model id | Requires |
|---|---|---|
| Vercel AI Gateway | typesafe-ai/jev | AI SDK 7 or later |
| TypeSafe API | jev-latest, jev-1.12 | Any HTTP client |
| OpenRouter | typesafe/jev-latest | An OpenRouter key |
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.
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);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.
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 } } }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.
| AI SDK / Gateway | TypeSafe API | |
|---|---|---|
| Type name | boolean | noul |
| Answer field | probability | noul |
| Usage keys | inputTokens | input_tokens |
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.
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'] },
},
});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.