[ Guide ]
Jev in TanStack AI: ask typed questions
Published By Jev Hub
[ Sponsors ]Launch price
These products help keep Jev Hub updated. Want yours up here?
- TanStack AI, the TypeScript AI library, ships an adapter for Jev: @tanstack/ai-typesafe.
- You call decide() with the data to judge and a set of typed questions, and Jev answers with a choice, a score or a yes or no, each with a probability.
- The adapter has no chat, runs on your server, and talks to TypeSafe's API with plain fetch.
Jev in TanStack AI, at a glance
| Feature | What to know | Where it is documented |
|---|---|---|
| Package | @tanstack/ai-typesafe, an MIT-licensed adapter inside the TanStack/ai repository. Version 1.0.0 was released on 22 October 2026 | TanStack's package page and the npm record |
| Install | pnpm add @tanstack/ai @tanstack/ai-typesafe | The package README |
| Key | TYPESAFE_API_KEY in your server's environment, or createTypesafeDecider(model, apiKey) to pass it in code | TanStack's adapter page |
| The call | decide() with adapter: typesafeDecider('jev-latest'), a state and a map of questions | TanStack's Evaluate guide |
| Question types | choice, score and boolean. On TypeSafe's wire, boolean is called noul | TanStack's Evaluate guide |
| Models named on the page | jev-latest (the current stable release) and jev-1.13.0 (a pinned release). Other TypeSafe model IDs can be passed as a string | TanStack's adapter page |
| What it sends | POST /v1/systemone with the model, the state and the questions, to https://api.typesafe.ai by default, using fetch and a bearer key. No TypeSafe SDK | TanStack's adapter page and the package source |
| Where it runs | On your server. TanStack says decide() needs your API key, so the browser calls your own route instead | TanStack's Evaluate guide |
Read on 26 October 2026 from TanStack's documentation and the TanStack/ai repository. TanStack AI is a young library, so check the linked pages for the current API.
Does TanStack AI work with Jev?
Yes. TanStack AI has an official adapter for Jev, a package called @tanstack/ai-typesafe. It lives in the TanStack/ai repository, uses the MIT licence and was first published on 18 September 2026, three days after Jev launched. Its version 1.0.0 came out on 22 October 2026, together with TanStack AI 1.0.0.
The adapter does one job. TanStack's page says it calls Jev through decide(), which returns a typed answer about your data, and that the adapter has no chat. That fits what Jev is: a decision model that returns choices, scores and probabilities, and writes no text.
How do I install Jev in TanStack AI?
Add the core package and the adapter. TanStack's README uses pnpm; its docs show the same two package names for npm, yarn and others.
pnpm add @tanstack/ai @tanstack/ai-typesafeThen put your TypeSafe API key in the environment of your server. The adapter reads it when it runs.
export TYPESAFE_API_KEY="your-typesafe-api-key"If you would rather pass the key in code, use createTypesafeDecider with the model and the key. TanStack's adapter page also lists three optional settings: a base URL (the default is https://api.typesafe.ai), extra headers, and your own fetch function. They let you send requests through a gateway or a proxy.
How do I ask Jev a question?
Call decide() with an adapter, the data to judge (called the state) and a map of questions. This is TanStack's own example, a support ticket routed three ways:
import { boolean, choice, decide, score } from '@tanstack/ai'
import { typesafeDecider } from '@tanstack/ai-typesafe'
const result = await decide({
adapter: typesafeDecider('jev-latest'),
state: ticket,
questions: {
queue: choice({
instructions: 'Which team should handle this ticket?',
options: {
billing: 'Payments, invoices, refunds',
tech: 'Bugs, outages, integrations',
sales: 'Pricing, upgrades, new accounts',
},
}),
urgency: score({
instructions: 'How urgent is this ticket?',
levels: ['low', 'medium', 'high'],
}),
refund: boolean({
instructions: 'Is the customer asking for a refund?',
}),
},
})Each key under questions becomes a field on the result, so result.queue.value is typed as 'billing', 'tech' or 'sales'. Your code can then branch on it in plain TypeScript. Jev still answers with a probability, and your code decides what to do with it.
What comes back from decide()?
TanStack's Evaluate guide lists the fields for each question type:
- choice. value is the option Jev picked, probability is the chance of that option, probabilities is the full map, and confidence is also present.
- score. value is the nearest level label, score is the raw fraction between the levels, and legend and probabilities are included. You must pass at least two levels, lowest first.
- boolean. value is true when the probability of yes is 0.5 or more. It has a probability and no confidence field. On TypeSafe's own wire this question type is called noul.
- meta. result.meta holds the model that answered and the token usage. The name meta is reserved, so you cannot use it as a question key.
- state. It can be a string, an object or an array. TanStack says an array counts as one state, not as a batch of separate items.
Where does the call run?
On your server, never in the browser. TanStack's guide says decide() needs your API key, so you put the call in a route and have the page call that route. The tutorial builds this as a TanStack Start route in about ten minutes, with a client that posts the ticket and branches on the answers.
TanStack's own React example app, examples/react/evaluate in the repository, has a dropdown that runs the same questions through five adapters, which is a quick way to compare providers on your own tickets.
How do I handle errors and cancel a request?
Since the 1.0.0 release, the error thrown for a failed TypeSafe request carries the HTTP status code in a status field. That lets you tell a rate limit (429), which deserves a retry, from a bad key (401), which does not, without reading the message. This is TanStack's own example:
try {
await decide({ /* adapter, state, questions */ })
} catch (error) {
if (error instanceof Error && 'status' in error && error.status === 429) {
// Rate limited. Wait, then call decide() again.
}
}To cancel a call, pass an abortSignal. To watch usage, pass middleware: TanStack describes it as observe-only hooks for usage, finish, error and abort, and it supports OpenTelemetry spans.
decide() also throws before sending anything if the questions map is empty or a question is named meta. And if Jev answers but an answer cannot be mapped, for example because it is missing or has no probability for its value, it throws after reporting the token usage of that call.
Can I swap Jev for another provider?
Yes. TanStack says every evaluate adapter uses the same decide() call, so changing provider means changing the adapter. Its Evaluate guide lists these:
- TypeSafe directly: typesafeDecider('jev-latest') with TYPESAFE_API_KEY.
- OpenRouter: openRouterDecider('~typesafe/jev-latest') with OPENROUTER_API_KEY.
- Vercel AI Gateway: vercelGatewayDecider('typesafe-ai/jev') with AI_GATEWAY_API_KEY.
- Cloudflare: cloudflareDecider('typesafe/jev') with a Worker binding, or an account ID and API token.
- OpenAI: openaiDecider('gpt-6-luna') with OPENAI_API_KEY. TanStack notes that OpenAI can refuse a question, which makes decide() throw a refusal error.
- Ollaya, run locally: ollayaDecider('laya:latest'), which needs no key and talks to a server on your own machine.
What should I check before relying on it?
Things the documentation leaves open or says plainly:
- Model IDs. TanStack's page names jev-latest and jev-1.13.0 and says other TypeSafe model IDs can be passed as a string. TypeSafe's models page says jev-latest now points to jev-1.14.0. If you tuned thresholds against one version, send that version's ID instead of the alias, as TypeSafe advises.
- What it covers. TanStack documents three question types here: choice, score and boolean. Its page does not mention Box questions or images.
- A young library. TanStack AI reached 1.0.0 on 22 October 2026, and its 1.0.0 notes describe many removed APIs. Pin a version and read the upgrade guide before you move to a new major release.
- Cost. TanStack's pages give no price. You pay TypeSafe, or the provider you choose, at their own rates.
Common questions
Yes. @tanstack/ai-typesafe is an official adapter in the TanStack/ai repository. It was first published on 18 September 2026 and reached version 1.0.0 on 22 October 2026.
Install @tanstack/ai and @tanstack/ai-typesafe, set TYPESAFE_API_KEY on your server, then call decide() with typesafeDecider('jev-latest'), a state and your typed questions.
No. TanStack says it talks to TypeSafe's API with plain fetch, by sending POST /v1/systemone, and adds no TypeSafe SDK.
No. TanStack says decide() needs your API key, so it runs on the server. The browser calls your own route, and the route calls decide().
choice, score and boolean. On TypeSafe's wire the boolean type is called noul. TanStack's page does not mention Box questions or images.
The error thrown for a failed TypeSafe request has the HTTP status code in a status field: 429 is a rate limit, and 401 is a bad key. TanStack added this in 1.0.0.
Yes. Only the adapter changes. TanStack lists TypeSafe, OpenRouter, Vercel AI Gateway, Cloudflare, OpenAI and Ollaya, which runs locally.
Sources
Written by Jev Hub from the sources below and checked against them on . Where a figure is a company's own claim, the article says so.
- TanStack AI docs: TypeSafe adapter (read 26 October 2026) (opens in a new tab)
- TanStack AI docs: Evaluate, the decide() guide (read 26 October 2026) (opens in a new tab)
- TanStack AI docs: Evaluate a ticket, a TanStack Start tutorial (read 26 October 2026) (opens in a new tab)
- GitHub: TanStack/ai, packages/ai-typesafe (MIT licence, README and changelog read 26 October 2026) (opens in a new tab)
- TypeSafe docs: models and limits (read 24 October 2026) (opens in a new tab)
Related content
- Read the article
Guide
Published
Confidence routing
Use Jev's confidence number to decide when to act, ask or hand off.
- Read the article
Guide
Published
Intent routing
Let Jev read each request and pick who handles it: code, a model or a person.
- Read the article
Guide
Published
Fan-out
Ask every question in one request and use only the answers that apply.