{"slug": "jev-and-ai-sdk-template-by-vercel-labs", "title": "Jev and AI SDK Template by Vercel Labs", "summary": "Vercel Labs released the Jev and AI SDK Template, an open-source Next.js 16 and React 19 form-routing starter that uses the typesafe-ai/jev model to route submissions and falls back to openai/gpt-5.6-luna-fast when Jev's confidence is below 95% or its evaluation fails. The template ships three example forms — /leads, /contact, and /issues — built on AI SDK 7, the Vercel AI Gateway, shadcn/ui, Base UI, Tailwind CSS 4, React Email, and Resend, and requires Node.js 22+ and pnpm. Routing a submission makes live model calls requiring AI Gateway access to both models, via an AI_GATEWAY_API_KEY or Vercel OIDC authentication.", "body_md": "Three forms use [Jev](https://vercel.com/i/what-is-jev) to route submissions by context, with `openai/gpt-5.6-luna-fast` handling uncertain or failed evaluations. Includes editable samples, routing details, and optional email delivery.\n\n| Technology | Purpose | \n|---|---|\n| Next.js 16 and React 19 | App Router, shared form UI, and Server Actions | \n| AI SDK 7 and Vercel AI Gateway | Typed model calls and provider access | \n| shadcn/ui, Base UI, and Tailwind CSS 4 | Components and styling | \n| React Email and Resend | Email previews and optional delivery | \n\n- Node.js 22+\n- pnpm package manager\n\n```\ngit clone https://github.com/vercel-labs/jev-ai-sdk-form-router.git\ncd jev-ai-sdk-form-router\npnpm install\n```\n\nRouting a submission, including a sample, makes live model calls and requires AI Gateway access to both `typesafe-ai/jev` and `openai/gpt-5.6-luna-fast`. Choose one of the authentication options below, or skip this step to explore the forms and load sample inputs without generating routing results.\n\n**API Key**\n\nCopy the environment example:\n\n```\ncp .env.example .env.local\n```\n\nCreate a [Vercel AI Gateway key](https://vercel.com/d?to=%2F%5Bteam%5D%2F~%2Fai-gateway%2Fapi-keys) and set `AI_GATEWAY_API_KEY` in `.env.local`.\n\n**Vercel OIDC**\n\nVercel deployments use automatic OIDC authentication through the SDK, without an API key. To use OIDC locally, install the Vercel CLI if needed, then link the project and pull its environment variables:\n\n```\nnpm install --global vercel\nvercel link\nvercel env pull .env.local\npnpm dev\n```\n\nOpen [localhost:3000](http://localhost:3000). The home page redirects to `/leads`.\n\n| Example | Route | Routes to | \n|---|---|---|\n| Lead | `/leads` | Startup, growth, enterprise, or sales teams | \n| Contact | `/contact` | Billing, support, or general inquiries | \n| Issue Report | `/issues` | Frontend, platform, infrastructure, identity, or engineering teams | \n\n1. Zod validates the submission against the fields in [lib/examples.ts](https://github.com/vercel-labs/jev-ai-sdk-form-router/blob/main/lib/examples.ts) .\n2. Jev evaluates the complete submission using AI SDK’s `experimental_evaluate` and selects an allowed team/specialty combination.\n3. The app accepts Jev’s choice when its confidence is **at least 95%** .\n4. If confidence is lower, missing, or invalid, or Jev fails, `openai/gpt-5.6-luna-fast` independently evaluates the same submission and criteria using`generateText` and`Output.object` . Its choice becomes final.\n5. The result includes the destination, deciding model, Jev statistics, model timings, and an email preview.\n\n**Confidence and selected-option probability are separate metrics.** The threshold uses the unrounded value of `providerMetadata.typesafe.confidence.destination`. Jev’s displayed statistics remain attached to its original evaluation when the fallback model makes the final decision.\n\nProvider calls have bounded timeouts and one transient retry. If both models fail, the app returns a retryable error and sends no email.\n\n## Optional email delivery\n\n**Set up Resend through Vercel Marketplace**\n\nThe [Resend Marketplace integration](https://resend.com/docs/guides/vercel-marketplace-integration) creates a Resend account and connects it to your Vercel project. During setup, you can select an existing Vercel domain or purchase one.\n\n1. \nIf you haven't already, install the Vercel CLI and link the project: \n\n```\nnpm install --global vercel\nvercel link\n```\n\n2. \nStart the integration setup: \n\n```\nvercel i resend\n```\n\n3. \nSelect an existing domain or purchase one through Vercel, then choose a plan and connect your project. Complete onboarding in Resend, choose **Auto configure** to add the DNS records, and wait for domain verification.\n4. \nPull the integration's environment variables for local development: \n\n```\nvercel env pull .env.local\n```\n\n5. \nConfirm `RESEND_API_KEY` is present and set`RESEND_FROM` in`.env.local` to a sender address on your verified domain.\n\nIf you already have a Resend account, you can instead set `RESEND_API_KEY` and `RESEND_FROM` directly using your existing API key and a [verified domain](https://resend.com/docs/dashboard/domains/introduction).\n\n**Configure receiving inboxes**\n\nIn [lib/recipients.ts](https://github.com/vercel-labs/jev-ai-sdk-form-router/blob/main/lib/recipients.ts), replace `null` with a valid inbox for every destination on the form you want to enable. Multiple destinations can share an inbox.\n\nAn unchecked **Email the receiving team** checkbox appears on configured forms.\n\nRecipient keys are derived from the destination registry and checked by TypeScript. Addresses stay server-side. The validated submitter email becomes `replyTo`. Forms with unconfigured inboxes continue to provide previews.\n\nEmail failures preserve the routing result. Resend acceptance does not confirm inbox delivery. If a connection drops after an opted-in submission, check Resend before resubmitting.\n\n| File | What to change | \n|---|---|\n| [lib/examples.ts](https://github.com/vercel-labs/jev-ai-sdk-form-router/blob/main/lib/examples.ts) | Form fields, samples, destinations, and routing criteria | \n| [lib/router.ts](https://github.com/vercel-labs/jev-ai-sdk-form-router/blob/main/lib/router.ts) | Models, confidence threshold, timeouts, and fallback policy | \n| [lib/recipients.ts](https://github.com/vercel-labs/jev-ai-sdk-form-router/blob/main/lib/recipients.ts) | Receiving inboxes | \n| [lib/submission.ts](https://github.com/vercel-labs/jev-ai-sdk-form-router/blob/main/lib/submission.ts) | Validation, email rendering, and delivery workflow | \n| [components/router-form.tsx](https://github.com/vercel-labs/jev-ai-sdk-form-router/blob/main/components/router-form.tsx) and[components/routing-result.tsx](https://github.com/vercel-labs/jev-ai-sdk-form-router/blob/main/components/routing-result.tsx) | Shared form and result UI | \n| [emails/routed-submission.tsx](https://github.com/vercel-labs/jev-ai-sdk-form-router/blob/main/emails/routed-submission.tsx) | Email design | \n\nKeep the experimental AI SDK version pinned and rerun the checks when upgrading it.\n\n```\npnpm fix       # Format and apply lint fixes\npnpm validate  # Lint, type check, Knip, and tests\npnpm build     # Production build\n```\n\nTests mock the model providers and Resend. They make no external calls. Coverage includes confidence thresholds, fallback decisions, validation, recipient configuration, and delivery retries.", "url": "https://wpnews.pro/news/jev-and-ai-sdk-template-by-vercel-labs", "canonical_source": "https://github.com/vercel-labs/jev-ai-sdk-form-router", "published_at": "2026-09-21 08:37:16+00:00", "updated_at": "2026-09-21 08:53:45.044133+00:00", "lang": "en", "topics": ["ai-products", "ai-tools", "developer-tools", "ai-agents", "ai-infrastructure"], "entities": ["Vercel Labs", "Jev", "AI SDK 7", "Vercel AI Gateway", "openai/gpt-5.6-luna-fast", "Next.js 16", "React 19", "Resend"], "alternates": {"html": "https://wpnews.pro/news/jev-and-ai-sdk-template-by-vercel-labs", "markdown": "https://wpnews.pro/news/jev-and-ai-sdk-template-by-vercel-labs.md", "text": "https://wpnews.pro/news/jev-and-ai-sdk-template-by-vercel-labs.txt", "jsonld": "https://wpnews.pro/news/jev-and-ai-sdk-template-by-vercel-labs.jsonld"}}