Vercel AI Gateway

Gateway shortest path for TypeSafe Jev

Use AI Gateway as the only network hop. Do not stand up your own proxy or “relay” API for Jev. Evaluation requires the AI SDK evaluate API (AI SDK 7+).

  1. Create a Gateway key in the Vercel dashboard (AI Gateway). Store it as AI_GATEWAY_API_KEY (or the env name your SDK expects).
  2. Install AI SDK 7+ in your app (server-side only for production keys):
    npm install ai @ai-sdk/gateway
  3. Call typesafe-ai/jev with shared state and typed questions.
  4. Apply thresholds in your code — high confidence → auto-suggest; low → human queue. Calibrate on labeled examples. No accuracy promises.

Minimal Choice example (livestream)

import { experimental_evaluate as evaluate } from 'ai';

const result = await evaluate({
  model: 'typesafe-ai/jev',
  state: 'In stock? Can you ship to the US?',
  questions: {
    label: {
      type: 'choice',
      instructions: 'Label this livestream comment for the host team.',
      criteria: {
        buy_intent: 'Purchase intent, stock availability, or shipping destination questions tied to buying',
        price_question: 'Asking about price, discounts, bundles, or deal terms',
        after_sales: 'Post-purchase support, returns, defects, delivery problems after buying',
        spam: 'Bots, ads, scams, harassment, or irrelevant promotional noise',
        other: 'Does not fit the above',
      },
    },
  },
});

// result.answers.label.choice → e.g. "buy_intent"
// high confidence → auto-suggest; low → human queue

Ticket routing example

const result = await evaluate({
  model: 'typesafe-ai/jev',
  state: 'API returns 500 on checkout',
  questions: {
    route: {
      type: 'choice',
      instructions: 'Route this support ticket to the right queue.',
      criteria: {
        tech: 'Bugs, outages, errors, API failures, integrations, or product not working as designed',
        sales: 'Pricing, plans, upgrades, demos, or new-purchase intent before becoming a customer',
        billing: 'Charges, invoices, receipts, subscriptions, payment method, or invoice questions',
        human: 'Ambiguous, multi-issue, sensitive, legal, account takeover, or otherwise needs a person',
      },
    },
  },
});

// → tech
Prefer the Gateway provider helper when you already use @ai-sdk/gateway: gateway.evaluationModel("typesafe-ai/jev").

What not to build

No self-built relay

Skip custom “Jev proxy” services. Point your app or serverless function at Gateway directly.

No money automation

Suggestions only. Refunds and payment capture stay human-owned — out of scope for this pack.