Use Jev with Vercel AI Gateway
Use AI SDK evaluation with boolean, Choice, and Score while keeping provider metadata and confidence handling explicit.
On this page
Prerequisites and installationEvaluate one shared stateBoolean is not named Noul hereChoice, Score, and confidenceHTTP API and provider metadataZDR optionsDeploy and troubleshootProvider documentation checked: 2026-09-21. Evaluation uses
experimental_evaluateand requires AI SDK 7 or later according to Vercel’s current guide. Experimental API names can change.
Prerequisites and installation
Use a server-side Node.js project, an AI Gateway key in AI_GATEWAY_API_KEY, and AI SDK 7+. Check the installed package version and commit its lockfile. For the example, install the supported ai release and save the code as an ESM file.
npm install ai@^7
Evaluate one shared state
import { experimental_evaluate as evaluate } from 'ai';
const result = await evaluate({
model: 'typesafe-ai/jev',
state: { ticket: 'I was charged twice. Please refund the duplicate before Friday.' },
questions: {
refund: { type: 'boolean', instructions: 'Is a refund explicitly requested?' },
department: { type: 'choice', instructions: 'Which team owns this ticket?',
criteria: { billing: 'Payments and refunds', technical: 'Bugs', other: 'Neither' } },
urgency: { type: 'score', instructions: 'How urgent is this request?',
criteria: ['Routine', 'This week', 'Today'] }
}
});
console.log(result.answers);
console.log(result.providerMetadata);
Run with node evaluate.mjs after setting the gateway key. The same logic belongs inside a protected server route in a web application, not in a client bundle.
Boolean is not named Noul here
Vercel’s evaluation interface uses type: 'boolean' and returns a probability field. TypeSafe Direct calls that primitive noul and returns noul. Copying a direct answer accessor into this adapter will read the wrong field.
Choice, Score, and confidence
Vercel’s documented normalized Choice and Score answers include the selected value and probabilities. Do not assume every direct confidence or legend field survives a normalized provider interface. Inspect the actual response contract and provider metadata before using direct confidence-routing code. If you derive your own certainty statistic, label and evaluate it separately.
HTTP API and provider metadata
Without the AI SDK, send the evaluation body to https://ai-gateway.vercel.sh/v1/evaluate using Authorization: Bearer $AI_GATEWAY_API_KEY. Vercel documents token usage plus providerMetadata.gateway routing and cost information. Preserve the returned metadata when diagnosing provider selection or billing.
ZDR options
The documented HTTP interface accepts providerOptions.gateway.zeroDataRetention and provider restrictions such as only. Requesting zero data retention is a provider option, not proof that any arbitrary account or route satisfies your organization’s requirements. Verify the actual provider path and contractual terms.
Deploy and troubleshoot
Keep the key in server environment secrets. Evaluation is not supported through Vercel’s OpenAI-compatible, Anthropic-compatible, or Cohere-compatible endpoints according to the cited guide. If a request fails, check the SDK version, evaluation endpoint, typesafe-ai/jev model ID, and boolean naming first. Vercel also documents a TypeSafe-compatible interface for applications that need the direct schema.