Setup
On Vercel (zero-config)
Vercel deployments get AI Gateway access automatically via OIDC. No API key needed.Self-hosted or local dev
- Go to Vercel AI Gateway
- Create an API key
- Add to
.env.local:
Config
Set the gateway to"vercel" (or omit it, since it defaults to "vercel"):
chat.config.ts
Authentication
The gateway authenticates using one of these (checked in order):| Variable | When |
|---|---|
AI_GATEWAY_API_KEY | Self-hosted or local development |
VERCEL_OIDC_TOKEN | Automatic on Vercel deployments |
Available Models
120+ models from OpenAI, Anthropic, Google, xAI, Meta, Mistral, Cohere, DeepSeek, and more. The full list is fetched at runtime and cached for 1 hour.Image Generation
The Vercel gateway supports dedicated image models (e.g.,bfl/flux-pro-1.1) through createImageModel(). This enables the built-in Image Generation feature.
Related
- Gateways Overview for the full gateway comparison
- OpenRouter for an alternative multi-provider backend