Vercel Gateway
Access 120+ AI models through Vercel AI Gateway
The Vercel gateway connects ChatJS to Vercel AI Gateway, providing unified access to 120+ models from OpenAI, Anthropic, Google, xAI, Meta, and more through a single API key.
This is the default gateway.
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:
AI_GATEWAY_API_KEY=your_key_here
Config
Set the gateway to "vercel" (or omit it, since it defaults to "vercel"):
const config: ConfigInput = {
ai: {
gateway: "vercel",
// ...
},
};
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