Vercel AI Gateway gives you one API key and one endpoint for models from OpenAI, Anthropic, Google, xAI, Bedrock, Vertex, and others, with automatic failover to a second provider when one errors. Tokens are billed at the provider list price with zero markup, including when you bring your own key. It speaks the AI SDK, OpenAI Chat Completions, OpenAI Responses, and Anthropic Messages, so most clients work with a base-URL change. The catches are all on the billing side: the free tier is $5 a month against a subset of models, BYOK requires purchased credits, and BYOK spend cannot be capped by a budget.
- Zero markup on tokens, at the provider list price, including with BYOK. Checked August 2026.
- Not a Vercel-hosting feature: the endpoint works from any machine, including a laptop.
- Free tier is $5 of credits a month on a subset of models, and it ends permanently the first time you buy credits.
- BYOK needs purchased credits, and a failed BYOK request silently retries on Vercel's own keys, billed to your balance.
- Budgets do not cover BYOK spend. It is metered separately and cannot be capped.
- Dedicated coding-agent endpoints exist for Claude Code, Codex, and Cursor;
vercel ai-gateway coding-agents setupwires them up.
What Vercel AI Gateway actually is
It is a proxy with a model catalogue and a wallet. You send a request naming a model as provider/model, the gateway forwards it to whichever upstream can serve it, and the tokens are billed against a credit balance you top up in the Vercel dashboard. If the first upstream errors, it retries against another provider that serves the same model.
The part people get wrong is the hosting assumption. AI Gateway is a Vercel product, not a Vercel deployment feature. A Python script on your laptop, a Fly.io container, or a Kubernetes pod can all point at it. The only thing you need is a Vercel team account and an API key.
| Surface | Use it when |
|---|---|
| AI SDK v5 / v6 | You are already in the TypeScript AI SDK; gateway is the default provider |
| OpenAI Chat Completions | Any client that takes an OpenAI base URL |
| OpenAI Responses | Codex and other clients that no longer speak Chat Completions |
| Anthropic Messages | Claude Code and anything pointed by ANTHROPIC_BASE_URL |
How it relates to the AI SDK
The AI SDK is Vercel's TypeScript library for calling models. AI Gateway is the default provider inside it, which is why AI SDK code written in 2026 passes a bare model string rather than importing a provider package.
import { generateText } from 'ai';
const { text } = await generateText({
model: 'anthropic/claude-opus-5',
prompt: 'Summarise this changelog.',
});
// swapping providers is a string edit
// model: 'openai/gpt-5.6-sol'
// model: 'google/gemini-3.1-pro'
You can use one without the other in both directions. The AI SDK can be pointed at a provider directly with that provider's own key, and the gateway can be called from Python, Go, or curl with no AI SDK anywhere. Treating them as one thing is the most common source of confusion in the docs.
curl https://ai-gateway.vercel.sh/v1/chat/completions \
-H "Authorization: Bearer $AI_GATEWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-opus-5",
"messages": [{"role": "user", "content": "hello"}]
}'
BYOK versus Vercel-billed credits
Two billing rails run through the same endpoint. On the default rail, Vercel authenticates with its own provider credentials and deducts the token cost from your AI Gateway Credits balance. On BYOK, you store your own provider key and Vercel authenticates with that instead, so the tokens land on your own provider invoice.
Both are advertised as zero markup, and as of August 2026 both are. The difference is entirely in the failure modes and the spend controls, and those are where BYOK gets uncomfortable.
| Vercel credits | BYOK | |
|---|---|---|
| Markup on tokens | None | None |
| Where the bill lands | Vercel credit balance | Your provider invoice |
| Available on the free tier | Yes, $5 per month | No. Requires purchased credits |
| Covered by gateway budgets | Yes | No. Metered separately, uncappable |
| On credential failure | Request fails | Silently retries on Vercel's keys, billed to credits |
| Zero Data Retention routing | Included in the ZDR set | Skipped unless you flag the key ZDR-compliant |
providerOptions: {
gateway: {
byok: {
anthropic: [{ apiKey: process.env.ANTHROPIC_API_KEY }],
},
},
}
Request-scoped keys bypass the dashboard-stored credentials entirely for that call, which is the right shape if you are a platform billing your own customers for their own model usage. The system-credential fallback still applies.
Coding agents through the gateway
This is the part of AI Gateway most relevant if you are here from a coding-agent search. Vercel ships per-agent compatibility endpoints and a CLI command that writes the config for every agent it finds installed.
vercel ai-gateway coding-agents setup
# or one at a time
vercel ai-gateway coding-agents setup --agent claude-code
| Agent | Endpoint |
|---|---|
| Generic surface | https://ai-gateway.vercel.sh/coding-agent/v1 |
| Claude Code | https://ai-gateway.vercel.sh/claude-code |
| OpenAI Codex | https://ai-gateway.vercel.sh/codex/v1 |
| Cursor | https://ai-gateway.vercel.sh/cursor/v1 |
| Cline, OpenCode, Pi | Built-in provider; key only |
export ANTHROPIC_BASE_URL="https://ai-gateway.vercel.sh/claude-code"
export ANTHROPIC_API_KEY=""
export ANTHROPIC_AUTH_TOKEN="your-ai-gateway-api-key"
export CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1
Observability, and the features that cost extra
Spend by model, by project, and by API key comes with the product. Request traces and latency metrics live in the Vercel Observability tab. Budgets can cap a team, a project, or a single API key, with the BYOK exception noted above.
Three capabilities are off by default and bill on their own meters when you turn them on. They are cheap per unit and easy to leave running.
| Capability | Charge |
|---|---|
| Custom Reporting writes | $0.075 per 1,000 tag / user ID / quota entity ID writes |
| Custom Reporting queries | $5 per 1,000 queries to the reporting endpoint |
| Team-wide provider allowlist | $0.10 per 1,000 successful requests (Pro and Enterprise) |
| Team-wide Zero Data Retention | $0.10 per 1,000 requests (Pro and Enterprise) |
| Trace Drains | Billed under Drains, no Pro allowance |
The per-request versions of the allowlist and ZDR are free. If you only need to restrict providers on some calls, use the only parameter in providerOptions rather than the team-wide setting, and the $0.10 per 1,000 disappears.
When it is the right call, and when it is not
Reach for it when
- You are already a Vercel team and want one invoice instead of five provider accounts.
- You are writing a Next.js or AI SDK app and want to A/B two models by editing a string.
- You need one endpoint that speaks Anthropic Messages and OpenAI Responses, because your agents are split across both.
- You want provider failover without writing the retry loop yourself.
Look elsewhere when
- Your agents run on your own machines and you already pay a subscription. Claude Pro, Claude Max, and ChatGPT plans are flat-rate; the gateway converts that into metered tokens.
- You need a hard cap on your own provider keys. BYOK spend cannot be budgeted, which rules the gateway out as a spend-control layer for BYOK teams.
- You need self-hosting. There is no on-prem build. LiteLLM or Bifrost is the answer to that question.
- You want an audit trail your compliance team owns. Trace Drains export OpenTelemetry, but the primary store is Vercel's.
Questions people ask
What is Vercel AI Gateway?
It is a single OpenAI-compatible endpoint that fronts hundreds of models from providers including OpenAI, Anthropic, Google, xAI, Bedrock, and Vertex. You hold one API key, requests are billed at the provider list price with no markup, and the gateway retries against another provider when one errors. It speaks the AI SDK, OpenAI Chat Completions, OpenAI Responses, and Anthropic Messages.
Do I need to host on Vercel to use AI Gateway?
No. You need a Vercel team account and an API key, but the endpoint at ai-gateway.vercel.sh is reachable from any machine. A Python script on a laptop or a container on another cloud works exactly the same as a Next.js function on Vercel.
Does Vercel AI Gateway add a markup on tokens?
No. Vercel states zero markup and no platform fee on tokens, at the provider list price, on both the credits rail and BYOK. Checked August 2026. The charges that do exist are separate add-on meters for Custom Reporting, the team-wide provider allowlist, team-wide Zero Data Retention, and Trace Drains.
Is Vercel AI Gateway free?
There is a free tier of $5 in AI Gateway credits per month, restricted to a subset of the model catalogue and rate limited per model more tightly than the paid tier. Exceeding a limit returns a 429. The free monthly credit stops permanently the first time you purchase credits, so it is a trial rail rather than a standing allowance.
Can I use my own API keys with Vercel AI Gateway?
Yes, via BYOK, with no markup. Two conditions matter: BYOK is only available once you have purchased AI Gateway credits, and BYOK spend is metered separately from budgets so it cannot be capped by a team, project, or key limit. A BYOK request that fails also retries on Vercel system credentials and bills your credit balance.
Can I use Vercel AI Gateway with Claude Code?
Yes. Set ANTHROPIC_BASE_URL to https://ai-gateway.vercel.sh/claude-code, leave ANTHROPIC_API_KEY empty, put your gateway key in ANTHROPIC_AUTH_TOKEN, and set CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1 to get every gateway model in the /model picker. Or run vercel ai-gateway coding-agents setup --agent claude-code. Remember this bills metered tokens instead of your Claude subscription.
Sources
Every figure above was read from these pages on August 2026. Vendors reprice without notice; if you find a stale number, tell us.
- Vercel AI Gateway documentation zero markup, unified API, provider list
- Vercel AI Gateway pricing free and paid tiers, add-on surcharges
- Vercel AI Gateway BYOK system-credential fallback, budget exclusion
- Vercel AI Gateway coding agents per-agent endpoints and env vars