Claude Code · Facts verified 2026-10-13

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.

terminalai-gateway.vercel.sh
# 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

IssueWhat happensWhat to do
/v1 in the base URLAdding it produces a 404Use https://ai-gateway.vercel.sh/claude-code exactly
ANTHROPIC_API_KEY setClaude Code uses it instead of ANTHROPIC_AUTH_TOKENSet it to an empty string
Other models in /modelThey appear with a claude-code/ prefix, which the gateway strips before routingTurn on gateway model discovery, as the Command and Manual tabs above do
Claude on Bedrock or VertexBeta headers can cause errorsTurn off experimental betas, as in the Manual tab above
Claude subscriptionThe setup command configures API-key sign-in onlyUse the Max plan tab above: your gateway key goes in a custom header, then log in with your Claude account
BudgetsA soft cap: the request that crosses it still completes; your own provider keys aren't counted by defaultAdd --include-byok to cap all agent spend

From vercel.com/docs/ai-gateway coding-agents and budgets pages, checked October 13, 2026.

Every way to run other models in Claude Code

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.

Cost per 100 requests, US dollars
Claude
Claude Opus 5.5$10.66
Claude Sonnet 5.5$5.33
Efficient model, for comparison
GPT-6 Luna$0.41
79,301 coding-agent requests on our gateway, September 13 to October 12, 2026, averaging 133K input and 698 output tokens, 87% of input from cache. Vercel list prices on October 13, before card fees. Claude Code was not in the sample; its requests follow the same pattern of large cached context, so read these as relative costs.

Vercel AI Gateway pricing in full

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.

Related guides