Skip to content
Dashboard

The AI Gateway for developers

400+ models at provider speed with near-zero overhead. One endpoint, no markup. Text, image, video, audio, realtime, retrieval, decisions, and tools.
import { streamText } from 'ai'
const result = streamText({
model: 'spacexai/grok-4.7',
prompt: 'Why is the sky blue?'
})
Read docs
And More
0%
0%
No markup on tokensPay provider prices,
never a cent more.

Invoicing is available with no payment processing fees. See the AI Gateway pricing docs.

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.

Works with your existing AI stack

- X_AI_API_KEY- ANTHROPIC_API_KEY- OPEN_AI_API_KEY+ AI_GATEWAY_API_KEY

Move existing OpenAI, Anthropic, and AI SDK integrations to AI Gateway with a base URL swap.

Recent ships

“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.”
Rob CheungCo-founder
How Zo Computer improved AI reliability 20×
  • 20x
    Improvement in AI
    reliability after switching
  • 30s
    To adopt a new model,
    down from an hour of code
  • 25%
    Improvement in average
    latency on model calls

Security and compliance

Route only to ZDR providers, no training or prompt logging, configurable per request or team-wide.

Live on AWS MarketplaceBuy with private offers, using your existing cloud commits.
View the listing

Every modality you need

Text, image, video, realtime, speech, transcription, embeddings, reranking, decisions, and web search tools through one endpoint.

Text

Access the latest from every major model lab and provider. Power your AI features all through a single endpoint.

OpenAI

Vercel provides a workflow to develop, deploy, and host websites, apps, and serverless functions. Teams can manage code from preview through production, while Vercel’s edge network and automatic scaling support delivery to users worldwide.

Image

Generate and edit with the latest image models, no extra setup.

Google

Video

Ship production-ready video across a wide range of models from a single prompt.

SpaceXAI

Realtime

Build voice and live multimodal experiences with realtime models through a single endpoint.

OpenAI

Speech

Turn text into natural, expressive speech with the latest text-to-speech models, all through one endpoint.

ElevenLabs

0:00
0:00

Transcription

Transcribe audio to text with leading speech-to-text models, no extra setup.

Deepgram

You can build and host many different types of applications from static sites with your favorite framework, multi-tenant applications or micro-frontends to AI-powered agents. Deploy globally in seconds, scale automatically with traffic, and ship every change with preview deployments, observability, and built-in security on every request.

Embeddings

Vector embeddings for search, retrieval, and RAG pipelines, with every major provider available through one endpoint.

OpenAI

[0.234, -0.198, 0.567, 0.012, -0.823, 0.445, -0.671, 0.298, 0.789, -0.234, 0.617, 0.082, -0.301, 0.519, -0.448, 0.176, 0.902, -0.057, 0.388, -0.741, 0.263, 0.014, -0.598, 0.831, -0.122, 0.476, 0.249, -0.687, 0.354, 0.911, -0.205, 0.066, 0.498, -0.379, 0.732, -0.461, 0.187, 0.853, -0.092, 0.541, 0.318, -0.226, 0.679, -0.518, 0.034, 0.793, -0.347, 0.612, 0.158, -0.806, 0.273, 0.469, -0.135, 0.587, 0.821, -0.044, 0.396, -0.752, 0.218, 0.503, -0.661, 0.129, 0.874, -0.317, 0.452, 0.085, -0.539, 0.706, -0.198, 0.361, 0.927, -0.475, 0.244, -0.683, 0.518, 0.039, -0.792, 0.155, 0.642, -0.288, 0.471, 0.836, -0.107, 0.523, -0.366, 0.018, 0.748, -0.491, 0.265, 0.882, -0.146, 0.397, 0.609, -0.728, 0.184, 0.456, -0.029, 0.713, -0.554, 0.298, 0.067, -0.421, 0.836, -0.193, 0.512, 0.347, -0.768, 0.124, 0.658, -0.385, 0.901, 0.071, -0.469, 0.234, 0.587, -0.812, 0.156, 0.473, -0.628, 0.319, 0.052, -0.741, 0.486, 0.207, -0.563, 0.894, -0.135, 0.428, 0.671, -0.298, 0.519, 0.084, -0.756, 0.347, 0.918, -0.412, 0.176, -0.689, 0.245, 0.561, -0.328, 0.073, 0.842, -0.197, 0.453, -0.726, 0.288, 0.617, 0.039, -0.504, 0.871, -0.265, 0.392, 0.158, -0.673, 0.527, 0.084, -0.439, 0.916, -0.221, 0.358, 0.495, -0.782, 0.146, 0.629, -0.317, 0.058, 0.847, -0.473, 0.196, 0.534, -0.628, 0.279, 0.913, -0.045, 0.461, 0.184, -0.752, 0.398, 0.625, -0.171, 0.043, 0.789, -0.526, 0.314, 0.867, -0.082, 0.471, -0.638, 0.219, 0.582, -0.395, 0.146, 0.704, -0.273, 0.519, 0.038, -0.846, 0.187, 0.493, -0.561, 0.328, 0.075, -0.412, 0.901, -0.246]

Reranking

Improve retrieval relevance by reordering results before they hit your model.

Cohere

  • 1Cache invalidation guide
  • 2How streaming works
  • 3Routing edge cases
  • 4Provider failover patterns

Works with the tools your team already uses

Route 30+ 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.

Or skip the config files. The setup command detects the supported agents on your machine, provisions an API key, and writes their configuration for you.

Terminal
npx vercel@latest ai-gateway setup

Get started

This quickstart walks you through making your first text generation request with AI Gateway.

Set up your project

Create a new directory and initialize a Node.js project.

Terminal
mkdir ai-text-demo
cd ai-text-demo
pnpm init
Install dependencies

Install the AI SDK and development dependencies.

Terminal
npm install ai@latest dotenv @types/node tsx typescript
Authenticate

On Vercel, deployed code authenticates with your project’s OIDC token, so you don’t need an API key. To run this example locally, go to the AI Gateway API Keys page in your Vercel dashboard, click Create API Key, and save the key in a .env.local file.

.env.local
AI_GATEWAY_API_KEY=your_ai_gateway_api_key
Create your script

Create the index.ts file.

index.ts
import { streamText } from 'ai';
import 'dotenv/config';
async function main() {
const result = streamText({
model: 'openai/gpt-6.1-terra',
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);
Run your script

You should see the AI model’s response stream to your terminal.

Terminal
pnpm tsx index.ts

Frequently asked questions

How is AI Gateway priced?

We offer tokens at list price from the upstream providers with no markup, including when you bring your own keys. Certain capabilities are available at higher plan tiers and metered separately. Invoicing is available with no payment processing fees, and volume discounts are available for larger commitments. See the pricing page for details.

Is there a free tier?

Yes. Every Vercel team gets monthly free credits for a subset of models, with lower per-model rate limits. Purchase AI Gateway Credits at any time to move to the paid tier and use the full catalog.

Are there rate limits?

The free tier applies lower per-model rate limits, and the paid tier removes them. Upstream providers can still rate limit a request. For higher limits, contact sales or email ai-gateway@vercel.com.

What's the difference between using AI Gateway and going direct to each provider?

AI Gateway gives you one integration, automatic failover, unified spend tracking, and one invoice across every major provider. Going direct means signing N contracts and stitching together N billing dashboards.

Will AI Gateway work with our existing AI stack?

Almost certainly. AI Gateway supports the AI SDK, OpenAI Chat Completions, OpenAI Responses, Anthropic Messages, and an OpenResponses-compatible endpoint. Migrating is typically a base URL swap with no code changes. It also works with frameworks such as LangChain, LlamaIndex, Mastra, Pydantic AI, LiteLLM, Langfuse, and TanStack AI.

Do I need an API key?

Not on Vercel. Deployed code authenticates with your project’s OIDC token in place of an API key. That works with every API, including the AI SDK, OpenAI Chat Completions, OpenAI Responses, and Anthropic Messages. Anywhere else, create an AI Gateway API key in the dashboard, or use the setup command to connect a coding agent.

Which modalities does AI Gateway support?

Text, image, video, audio, realtime, embeddings, reranking, decisions, and web search tools, all through one endpoint. Browse the full model catalog for specific models and providers.

Which coding agents work with AI Gateway?

Claude Code, OpenAI Codex, Cursor, Cline, OpenCode, and more than 30 other coding agents. Most connect with a base URL change, and the setup command configures the supported agents it finds on your machine.

What are virtual models?

A virtual model is a saved model configuration with its own model ID. It pairs a model with provider routing, fallbacks, regional inference, and compliance settings, so any client that takes a model name gets that configuration. You can change the settings later without redeploying your app.

Does AI Gateway support batch processing?

Yes. Batch processing lets you submit many text generation requests as one asynchronous job, then poll its status or receive a webhook when it finishes. Batches are billed at a discount on standard token prices, 50% for most models.

Does AI Gateway support prompt caching?

Yes. Providers such as OpenAI, Google, and DeepSeek cache repeated prompt prefixes automatically. For providers that need explicit cache markers, such as Anthropic, set caching to auto and AI Gateway adds them for you. Session affinity keeps each conversation on the provider that already holds its cache.

Can I choose faster or cheaper processing?

Yes. Fast mode serves supported models on a faster path at a higher per-token price. Service tiers let you request priority processing for more speed or flex for lower cost, on providers that offer them.

How does AI Gateway handle our enterprise security and compliance requirements?

AI Gateway supports Zero Data Retention routing, a no-training guarantee, team-wide provider and model allowlists, regional inference, and private inference on your own endpoints. See the security overview for full details.

Where does inference run?

By default, AI Gateway picks whichever region can serve the model. With regional inference, you can pin inference to the United States, the European Union, Australia, or Japan, where the provider supports it. Regional hosting also controls where AI Gateway receives your request.

Can I route to my own models?

Yes, with Private Inference. Connect your own model endpoints, such as a self-hosted model or a fine-tune, and call them with the same SDKs, authentication, and observability you use for the catalog. Private models are scoped to your team and never appear in the public model catalog.

What observability does AI Gateway provide out of the box?

A dashboard with usage, spend, request volume, TTFT, and token counts, broken down by model, provider, and project. For deeper analysis, the Custom Reporting API lets you pull the same data into your own tools.

Can we use our existing provider contracts and committed spend?

Yes, through BYOK. Bring your own keys for almost every supported provider and your existing commitments flow through. We try BYOK first and, by default, only fall back to Vercel’s provider keys on failure.

Can I turn off fallback to Vercel’s provider keys?

Yes. Fallback to Vercel Keys is on by default, so a request that fails on your credentials retries on Vercel’s provider keys and bills that usage to your AI Gateway Credits. Turn it off in your team’s AI Gateway settings to keep all provider usage on your own account, for example to stay within a provider agreement.

Do I pay per request or get invoiced?

AI Gateway uses pre-purchased credits by default. Top up in the dashboard and usage is drawn down per request. Enterprise customers can switch to a single consolidated invoice from Vercel covering every provider in their routing pool. For invoicing, reach out to sales for more details.

Can we purchase AI Gateway through AWS Marketplace?

Yes. AI Gateway is live on AWS Marketplace and available to purchase via AWS private offers. Procure it directly through AWS Marketplace and apply the spend toward your existing AWS cloud commits, within your existing budgets and procurement processes.