AI Gateway

AI Gateway

Last updated February 9, 2026

AI Gateway is available on all plans . Your use of each AI provider is subject to their terms listed on each model's page and subject to Vercel's AI Product Terms.

The AI Gateway provides a unified API to access hundreds of models through a single endpoint. It gives you the ability to set budgets, monitor usage, load-balance requests, and manage fallbacks.

The design allows it to work seamlessly with AI SDK v5 and v6, OpenAI SDK, Anthropic SDK, or your preferred framework.

  • One key, hundreds of models: access models from multiple providers with a single API key
  • Unified API: helps you switch between providers and models with minimal code changes
  • High reliability: automatically retries requests to other providers if one fails
  • Embeddings support: generate vector embeddings for search, retrieval, and other tasks
  • Spend monitoring: monitor your spending across different providers
  • No markup on tokens: tokens cost the same as they would from the provider directly, with zero markup, including with Bring Your Own Key (BYOK).
index.ts
import { generateText } from 'ai';
 
const { text } = await generateText({
  model: 'anthropic/claude-sonnet-4.5',
  prompt: 'What is the capital of France?',
});
 
index.py
import os
from openai import OpenAI
 
client = OpenAI(
  api_key=os.getenv('AI_GATEWAY_API_KEY'),
  base_url='https://ai-gateway.vercel.sh/v1'
)
 
response = client.chat.completions.create(
  model='xai/grok-4',
  messages=[
    {
      'role': 'user',
      'content': 'Why is the sky blue?'
    }
  ]
)
index.sh
curl -X POST "https://ai-gateway.vercel.sh/v1/chat/completions" \
-H "Authorization: Bearer $AI_GATEWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
  "model": "openai/gpt-5.2",
  "messages": [
    {
      "role": "user",
      "content": "Why is the sky blue?"
    }
  ],
  "stream": false
}'

Was this helpful?

supported.