Skip to content
Dashboard

6 ways to integrate Jev into your application

Content Engineer

You can integrate Jev through AI SDK or TanStack AI, call it from Cloudflare, add it to LangChain or eve, or use TypeSafe's SDKs and HTTP API. Start with the tools your application already uses, then choose how requests reach Jev.

You can combine some of these options. Using AI SDK or TanStack AI, for example, still leaves you a choice of calling TypeSafe directly or sending requests through Vercel AI Gateway.

Copy link to headingWhat is the difference between a library, an adapter, and a gateway?

Your application library defines the function you call and the answer shape you read. Its provider adapter translates that call into a request to a service. If you use a gateway, that service routes the request to the model provider.

With AI SDK, you call experimental_evaluate and select an evaluation model. With TanStack AI, you call decide() and supply an evaluation adapter. Both can reach Jev through Vercel AI Gateway.

Start with the integration that fits your existing code:

Your application

Starting point

Service receiving the request

Uses AI SDK

experimental_evaluate with a Jev evaluation model

Vercel AI Gateway or TypeSafe directly

Uses TanStack AI

decide() with a Jev-compatible evaluation adapter

TypeSafe, Vercel AI Gateway, Cloudflare, or OpenRouter

Runs in a Cloudflare Worker

env.AI.run('typesafe/jev', ...)

Cloudflare AI

Uses LangChain in Python

TypeSafeClassifier.invoke()

TypeSafe by default

Uses eve

Evaluation, model-selection, or tool-approval helpers

Vercel AI Gateway by default, or a configured evaluation provider

Needs a direct client or HTTP call

TypeSafe SDK or POST /v1/systemone

TypeSafe, or a compatible gateway you configure

The AI SDK, TanStack AI, and Cloudflare examples each ask Jev to choose the right support team for a customer reporting an unexpected invoice charge. Using the same request makes it easier to compare how each integration defines the question, calls Jev, and reads the answer. Your application can then use the selected team to route the ticket to the appropriate queue.

Copy link to heading1. Use Jev with AI SDK

Use AI SDK when evaluation needs to sit alongside the model calls already in your TypeScript application. Its evaluation API accepts shared state and named questions, then returns answers under those question names. The API is experimental, so check its contract when upgrading the SDK.

With AI SDK's default Gateway provider, a Gateway model ID sends the call through Vercel AI Gateway. Configure AI_GATEWAY_API_KEY or Vercel OIDC authentication on the server before calling it:

import { experimental_evaluate as evaluate } from 'ai';
const result = await evaluate({
model: 'typesafe-ai/jev',
state: 'Our latest invoice includes an extra seat we never added.',
questions: {
team: {
type: 'choice',
instructions: 'Select the team responsible for resolving this request.',
criteria: {
billing: 'Questions about invoice amounts or charges',
account: 'Problems signing in or accessing an account',
other: 'Requests outside billing and account access',
},
},
},
});
console.log(result.answers.team.choice);

The typesafe-ai/jev evaluation model returns a selection your application can map to a support queue. The example supplies the categories; it doesn't send the ticket or modify a customer record.

For direct TypeSafe access, import typeSafeAi from @ai-sdk/typesafe-ai and supply typeSafeAi.evaluationModel('jev-latest') as the model, with TypeSafe credentials configured. The question definitions stay in AI SDK's format.

The Jev and AI SDK guide extends this pattern with multiple questions and application logic for handling uncertain answers.

Copy link to heading2. Use Jev with TanStack AI

If your application already uses TanStack AI, its TypeSafe adapter lets you add Jev through decide(). Question helpers express the same decisions with different configuration names. For a choice question, TanStack AI uses options where AI SDK uses criteria.

To call Jev directly through TypeSafe, install TanStack AI (@tanstack/ai) and its TypeSafe adapter (@tanstack/ai-typesafe). Then set TYPESAFE_API_KEY to your TypeSafe API key in your server environment.

The following example uses decide() to select a team for a support ticket:

import { decide, choice } from '@tanstack/ai';
import { typesafeDecider } from '@tanstack/ai-typesafe';
const result = await decide({
adapter: typesafeDecider('jev-latest'),
state: 'Our latest invoice includes an extra seat we never added.',
questions: {
team: choice({
instructions: 'Select the team responsible for resolving this request.',
options: {
billing: 'Questions about invoice amounts or charges',
account: 'Problems signing in or accessing an account',
other: 'Requests outside billing and account access',
},
}),
},
});
console.log(result.team.value);

You can also combine question types in one call. The product-review moderation guide uses TanStack AI with Vercel AI Gateway to evaluate a review's topic and sentiment, then check for promotional content and personal information. It supplies the product name, review text, and customer's star rating as shared state.

In that workflow, choice() selects the topic, score() assesses sentiment against ordered descriptions, and two boolean() questions check the content flags. Answers appear directly under their question names, such as result.topic.value and result.isPromotional.probability. The sentiment score describes the text, so it can differ from the customer's star rating.

Application code then maps the answers to a publishing decision. The guide holds flagged reviews and unclear or off-topic submissions for a moderator. Reviews that pass its thresholds receive a publish decision, with requirements such as verified purchase checked separately. Keeping that policy in a function lets you test its branches with fixed answers before evaluating Jev on labeled reviews.

TanStack AI also supports other services through evaluation adapters. You can keep the state and questions while changing the adapter and its credentials:

Request path

Adapter factory

Authentication

Direct TypeSafe

typesafeDecider('jev-latest') from @tanstack/ai-typesafe

TYPESAFE_API_KEY

Vercel AI Gateway

vercelGatewayDecider('typesafe-ai/jev') from @tanstack/ai-vercel-gateway

AI_GATEWAY_API_KEY, or VERCEL_OIDC_TOKEN

Cloudflare

cloudflareDecider('typesafe/jev') from @tanstack/ai-cloudflare

CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN for HTTP access

OpenRouter

openRouterDecider('~typesafe/jev-latest') from @tanstack/ai-openrouter

OPENROUTER_API_KEY

Inside a Worker, the Cloudflare adapter accepts an AI binding through createCloudflareDecider. The OpenRouter adapter uses OpenRouter's decisions endpoint. These are evaluation-specific integrations, so choose the decider factory when configuring Jev.

Copy link to heading3. Call Jev through Cloudflare

For a Worker that already has an AI binding, you can call Jev with env.AI.run without adding an application framework.

Within your Worker handler, the same classification looks like this:

const result = await env.AI.run('typesafe/jev', {
state: 'Our latest invoice includes an extra seat we never added.',
questions: {
team: {
type: 'choice',
instructions: 'Select the team responsible for resolving this request.',
criteria: {
billing: 'Questions about invoice amounts or charges',
account: 'Problems signing in or accessing an account',
other: 'Requests outside billing and account access',
},
},
},
});
console.log(result.answers.team.choice);

You can also call Jev over HTTP with a Cloudflare account ID and API token, as shown in Cloudflare’s model documentation. For choice questions, the binding returns the selected answer in choice, the answer distribution in probabilities, and a separate confidence value. Yes-or-no questions use TypeSafe’s noul format.

If the Worker already uses TanStack AI, its Cloudflare adapter gives you the decide() interface over the binding. Choose the interface that keeps the surrounding application consistent.

Copy link to heading4. Add Jev to a LangChain workflow

For Python applications built with LangChain, TypeSafeClassifier exposes Jev as a Runnable. Install langchain-typesafe, configure TYPESAFE_API_KEY, and pass both state and questions to .invoke().

The package supplies Choice, Score, and Noul question classes. For the support-routing example, define a Choice question named team and read the selected destination at response.choices['team'].choice. Answers are grouped by question type, so a Noul answer lives under response.nouls.

This integration is useful when the decision belongs inside an existing LangChain workflow. The classifier accepts LangChain messages, and its calls can appear in LangSmith traces. The package also provides experimental middleware for choosing an agent's response model or checking proposed tool calls. Those middleware integrations require the package's experimental extra.

Copy link to heading5. Use Jev with eve

In an eve agent, Jev can evaluate a request inside a tool or help decide what happens before the agent takes its next action. The evaluate function from eve/ai accepts AI SDK evaluation questions and defaults to typesafe-ai/jev. During local development, it can use the Gateway connection selected through /login, alongside the agent's language model.

For tool calls, eve's automatic approval workflow adds approval: auto() from eve/tools/approval. Jev reviews the proposed tool name and arguments against clear and caution criteria. Clear calls run automatically; caution calls pause for a person. Failed reviews also require human approval.

The guide applies this to shell commands so the policy can distinguish inspecting a file from changing or deleting it. The helper acts on the selected option. If you want a probability threshold as well, write a custom approval policy. Keep the tool's permissions enforced when it executes.

Jev can also select the agent's response model through auto from eve/models. You define the allowed models and describe the work each should handle. eve evaluates recent conversation text before inference, keeps the selection through that turn's tool loop, and selects again on the next turn. This helper has a different import and purpose from the tool-approval helper.

For evaluation suites, t.judge(...) uses the same evaluation implementation to turn written criteria or typed questions into scored assertions. That lets you assess an agent's answers as well as use Jev for decisions during a run. The agent's generative model still writes its replies.

Copy link to heading6. Use TypeSafe's SDK or HTTP API

Use TypeSafe's client SDKs when you want typed access without adding an AI application framework. TypeSafe provides Python and JavaScript/TypeScript clients. For another language, its HTTP evaluation endpoint accepts a model, shared state, and named questions at POST https://api.typesafe.ai/v1/systemone.

Existing TypeSafe clients can also use Vercel AI Gateway's TypeSafe-compatible API. Configure the base URL as https://ai-gateway.vercel.sh/typesafe and authenticate with an AI Gateway key or Vercel OIDC token. This path preserves TypeSafe's question and answer naming, including noul.

For a new HTTP integration using Gateway's evaluation format, use POST /v1/evaluate. That endpoint uses boolean and probability. Choose the format that matches the code consuming the answers.

Copy link to headingWhat changes when you switch integrations?

Keep the decision criteria explicit when moving between libraries. In the examples above, the invoice text and team descriptions are identical, but the function calls and answer fields differ.

For a question named team, the documented choice-result paths are:

Interface

Selected category

Choice confidence

AI SDK with TypeSafe

result.answers.team.choice

result.providerMetadata?.typesafe?.confidence?.team

TanStack AI

result.team.value

result.team.confidence

Cloudflare AI binding

result.answers.team.choice

result.answers.team.confidence

LangChain

response.choices['team'].choice

response.choices['team'].confidence

AI SDK keeps TypeSafe's separate confidence statistic in provider metadata. Don't substitute a selected category's probability for that statistic when porting a routing rule.

Boolean handling needs attention too. TanStack AI returns a boolean value using a probability cutoff of 0.5, alongside the underlying probability. AI SDK exposes the probability for your code to interpret. Native TypeSafe names that probability noul. If your application requires a stricter acceptance rule, preserve it explicitly when changing interfaces.

Model identifiers also belong to the chosen service. The examples use jev-latest for direct TypeSafe access, typesafe-ai/jev for Vercel AI Gateway, and typesafe/jev for Cloudflare. Copy the identifier documented for the path you're using, and rerun your evaluation examples after a change.

Copy link to headingWhat does an adapter leave to your application?

An adapter connects your code to Jev and maps the response into its library's format. Your application still decides how a result affects the workflow, including what happens when evaluation fails or the answer needs review.

Jev accepts text-based state and returns typed decisions. Connecting it through a library that also supports image or text generation doesn't add those capabilities to Jev. Keep a generative model for writing customer replies.

For the invoice example, selecting billing can assign a queue. Refunding a charge requires a separate action with its own permission and account checks. Test the classification on past tickets before using it to control that action.

Copy link to headingFrequently asked questions

Copy link to headingDo I need AI SDK to use Jev through Vercel AI Gateway?

No. Vercel AI Gateway supports an HTTP evaluation endpoint and a TypeSafe-compatible API. TanStack AI also provides a Gateway evaluation adapter, so you can use the interface that fits your application.

Copy link to headingCan TanStack AI use Jev through Cloudflare?

Yes. TanStack AI's Cloudflare evaluation adapter supports Jev through a Worker AI binding or HTTP credentials. You can keep the same question helpers while configuring the appropriate connection.

Copy link to headingCan I keep the TypeSafe SDK when moving requests to Vercel AI Gateway?

Yes. Vercel AI Gateway offers a TypeSafe-compatible base URL and accepts Gateway authentication. Your client can retain TypeSafe's request and response format, including Noul questions.

Copy link to headingAre Jev's answer fields identical across integrations?

No. Libraries map Jev's answers into their own types and property paths. For example, TanStack AI exposes a selected category as value, while AI SDK uses choice; check probability and confidence fields before reusing application logic.

Copy link to headingShould I change frameworks to add Jev?

Start with an integration for your existing application. AI SDK, TanStack AI, and LangChain have documented evaluation paths, while TypeSafe's SDKs and HTTP API provide options for applications that don't use those libraries.

Copy link to headingDoes eve use Jev to write the agent's replies?

No. eve uses Jev for typed evaluations, including decisions about response-model selection and tool approvals. The selected language model generates the reply, while Jev can also judge outputs in evaluation suites.

Copy link to headingNext steps

Ready to deploy?