How do I use Vercel AI Gateway with Claude Code?
Run npx vercel ai-gateway setup --agent claude-code, or point ANTHROPIC_BASE_URL at https://ai-gateway.vercel.sh/claude-code with your AI Gateway key; requests cost provider list price with no markup.
# Writes ~/.claude/settings.json for you
npx vercel ai-gateway setup --agent claude-code
claude
Shell exports last for one terminal; put the same values in the env block of ~/.claude/settings.json to keep them. Run /status in Claude Code to check the base URL.
Gotchas in Vercel's own docs
| Issue | What happens | What to do |
|---|---|---|
| /v1 in the base URL | Adding it produces a 404 | Use https://ai-gateway.vercel.sh/claude-code exactly |
| ANTHROPIC_API_KEY set | Claude Code uses it instead of ANTHROPIC_AUTH_TOKEN | Set it to an empty string |
| Other models in /model | They appear with a claude-code/ prefix, which the gateway strips before routing | Turn on gateway model discovery, as the Command and Manual tabs above do |
| Claude on Bedrock or Vertex | Beta headers can cause errors | Turn off experimental betas, as in the Manual tab above |
| Claude subscription | The setup command configures API-key sign-in only | Use the Max plan tab above: your gateway key goes in a custom header, then log in with your Claude account |
| Budgets | A soft cap: the request that crosses it still completes; your own provider keys aren't counted by default | Add --include-byok to cap all agent spend |
From vercel.com/docs/ai-gateway coding-agents and budgets pages, checked October 13, 2026.
Using your Claude Pro or Max plan through Vercel
Vercel can pass a Claude subscription through: your AI Gateway key goes in ANTHROPIC_CUSTOM_HEADERS as x-ai-gateway-api-key, and you log in to Claude Code with the subscription account. Anthropic models then run on the subscription "with no additional cost", within the plan's own usage limits, and Vercel adds logs and spend tracking.
What a request costs through Vercel
A month of typical working days is about $71 on Sonnet 5.5 and $141 on Opus 5.5. Choosing an efficient model for routine steps is up to you: Vercel's routing rules and virtual models follow the rules you write.
The catch
Anthropic does not support Claude Code through third-party gateways, and its docs warn that a gateway that does not forward new features can break them after an update. Vercel's Claude Code page still describes fast mode for Opus 4.6 and 4.7 only, so check newer features yourself.
Where Standard Compute fits
Point the same variables at api.stdcmpt.com and keep Claude Code's own model names: smart routing picks a model per request from the ones you allow, sending routine steps to efficient models and hard ones to Claude. One key covers Claude, GPT, Gemini, DeepSeek and GLM, and a flat plan from $19 includes the compute and stops at its budget, with no overage. Teams and agencies get a plan per key and Europe or US rules.
FAQ
What is the Vercel AI Gateway base URL for Claude Code?
https://ai-gateway.vercel.sh/claude-code, with no /v1 suffix. Codex uses https://ai-gateway.vercel.sh/codex/v1 on the Responses API.
Can I use GPT or Gemini in Claude Code through Vercel AI Gateway?
Yes. With model discovery on, gateway models appear in /model with a claude-code/ prefix, and the gateway strips the prefix before routing. How well a model handles Claude Code's tools varies.
Does Vercel AI Gateway work with Claude Max?
Yes. Put your gateway key in ANTHROPIC_CUSTOM_HEADERS and log in with your Claude account; Anthropic models run on the subscription at no extra cost and Vercel adds observability.
Is Vercel AI Gateway cheaper than the Anthropic API for Claude Code?
No, the token price is the same: Vercel charges Anthropic's list price with no markup. You pay card processing fees on credits, and gain budgets, logs and other providers on one key.