The AI Gateway For Developers
Use it with
never a cent more.
Optimize routing for availability, cost, or latency
If a provider degrades, the Gateway fails over to the same model on another provider. Identical output, no downtime.
Everyday requests route to a cost-efficient open model. Complex jobs escalate to a frontier model only when needed.
Latency-sensitive requests route to the fastest-responding model for the lowest time to first token. Heavier requests fall through to a larger model.
Latency figures are illustrative and vary by region, traffic, and prompt length.
Routing, billing, and observability in one place
Providing the developer experience and infrastructure to build, scale, and secure a faster, more personalized web.
- One API key, hundreds of models. Unified billing and observability across your entire AI stack, with text, image, video, and audio models.
- Route on behavior, fallback anytime Automatic fallbacks during provider outages so your app stays up even when a model goes down.
- OpenAI$12.47Anthropic$8.22xAI$4.31Platform fee$0.00Total$25.00No markup, just fair prices Pay exactly what providers charge with no platform fees.
Works with your existing AI stack
- X_AI_API_KEY- ANTHROPIC_API_KEY- OPEN_AI_API_KEY+ AI_GATEWAY_API_KEYMove existing OpenAI, Anthropic, and AI SDK integrations to AI Gateway with a base URL swap.
- Seamless migrationPoint your existing OpenAI or Anthropic SDK at AI Gateway. Same calls, no rewrites.
- Bring your own keysBring your own provider keys with no platform fee. Existing commitments flow through.
- Models on day zeroImmediate launch partner with major labs. New models work the minute they ship.
“Moving to the gateway is just so ergonomic. We get references to model names, and rely on Vercel to do the correct implementations and handle the edge cases.”
- 20xImprovement in AI
reliability after switching - 30sTo adopt a new model,
down from an hour of code - 25%Improvement in average
latency on model calls
Production-ready,
from request one
Security, spend controls, and compatibility built for teams running real traffic.
- Security and complianceRoute only to ZDR providers. No training on data, no prompt logging. Configure custom rules per request or team-wide.
- Track everythingTrack tokens, requests, spend, and performance across your AI stack. Cap spend with per-key budgets and per-user quotas.
- Drop-in compatibleUse the API formats you already have. Migrate existing apps to AI Gateway in minutes, no SDK rewrites required.
Take control
Manage usage across teams with budgets, quotas, and full request visibility.
Works with the tools your team already uses
Route the most popular AI coding agents through AI Gateway with a base URL change. Get unified observability and spend tracking across every tool, no matter who built it.
- Claude CodeAnthropic’s coding agent. Route it through AI Gateway’s Anthropic-compatible endpoint. Works with Claude Code Max too.
- OpenAI CodexOpenAI’s coding agent. Route it through AI Gateway’s Responses API so usage joins the rest of your AI spend.
- OpenCodeOpen-source terminal coding agent with native AI Gateway support. Connect once, then switch between any model on the fly.
- Blackbox AITerminal CLI for AI code generation and debugging, with access to every model in the catalog.
- ClineAutonomous coding agent for VS Code. Select Vercel AI Gateway as the provider for detailed token and cache metrics.
- Grok BuildxAI’s terminal coding agent. Point it at AI Gateway with two environment variables, and the model picker pulls the full catalog.
Get Started
This quickstart walks you through making your first text generation request with AI Gateway.
Create a new directory and initialize a Node.js project.
mkdir ai-text-democd ai-text-demopnpm initInstall the AI SDK and development dependencies.
npm install ai dotenv @types/node tsx typescriptGo to the AI Gateway API Keys page in your Vercel dashboard and click Create Key to generate a new API Key. Create a .env.local file and save your API Key.
AI_GATEWAY_API_KEY=your_ai_gateway_api_keyCreate the index.ts file.
import { streamText } from 'ai';import 'dotenv/config';
async function main() { const result = streamText({ model: 'openai/gpt-5.5', prompt: 'Invent a new holiday and describe its traditions.', });
for await (const textPart of result.textStream) { process.stdout.write(textPart); }
console.log(); console.log('Token usage:', await result.usage); console.log('Finish reason:', await result.finishReason);}
main().catch(console.error);You should see the AI model’s response stream to your terminal.
pnpm tsx index.tsCreate a new directory and initialize a Node.js project.
mkdir ai-text-democd ai-text-demopnpm initInstall the AI SDK and development dependencies.
npm install ai dotenv @types/node tsx typescriptGo to the AI Gateway API Keys page in your Vercel dashboard and click Create Key to generate a new API Key. Create a .env.local file and save your API Key.
AI_GATEWAY_API_KEY=your_ai_gateway_api_keyCreate the index.ts file.
import { streamText } from 'ai';import 'dotenv/config';
async function main() { const result = streamText({ model: 'openai/gpt-5.5', prompt: 'Invent a new holiday and describe its traditions.', });
for await (const textPart of result.textStream) { process.stdout.write(textPart); }
console.log(); console.log('Token usage:', await result.usage); console.log('Finish reason:', await result.finishReason);}
main().catch(console.error);You should see the AI model’s response stream to your terminal.
pnpm tsx index.ts