Skip to main content
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

  1. Go to Vercel AI Gateway
  2. Create an API key
  3. 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"):
chat.config.ts
const config: ConfigInput = {
  ai: {
    gateway: "vercel",
    // ...
  },
};

Authentication

The gateway authenticates using one of these (checked in order):
VariableWhen
AI_GATEWAY_API_KEYSelf-hosted or local development
VERCEL_OIDC_TOKENAutomatic 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.