Skip to main content

AI Gateway support for Claude Code

By Steven Van ·

Claude Code requests can now route through Vercel's AI Gateway for centralized spend tracking, traces, and provider failover.

Vercel's AI Gateway now supports Claude Code through its Anthropic-compatible API endpoint. Routing Claude Code requests through the gateway centralizes usage and spend, shows request traces in observability, and adds failover between providers for the chosen model.

To set it up, log out of Claude Code, then set ANTHROPIC_BASE_URL to https://ai-gateway.vercel.sh, ANTHROPIC_AUTH_TOKEN to an AI Gateway API key, and ANTHROPIC_API_KEY to an empty string before starting claude again. The empty ANTHROPIC_API_KEY is required: Claude Code checks that variable first and will use it instead of ANTHROPIC_AUTH_TOKEN if it's non-empty.

Vercel
Vercel
The platform for frontend developers — deploy, preview, and scale web apps and AI agents with zero config.
View Vercel →

Original source

Read AI Gateway support for Claude Code on Creators Toolbox