AI Engineer Guide

How to use any AI model from Vercel AI Gateway with Claude Code

Vercel AI Gateway now has support for Claude Code. Similar to that of GLM Coding Plan you just need to update the base url and keys and we’re good to go.

Basically under the hood, they’ve built transform the payload from LLM back and forth to make it behave like Anthropic-like API endpoint so that it works as expected in Claude Code.

How to get started?

Just set these env variables.

export ANTHROPIC_BASE_URL="https://ai-gateway.vercel.sh"
export ANTHROPIC_AUTH_TOKEN="your-vercel-ai-gateway-api-key"
export ANTHROPIC_API_KEY=""

And then run claude

That’s pretty much it.

By default, it’ll use Anthropic models but you can override it by setting these env variables

export ANTHROPIC_DEFAULT_SONNET_MODEL="kwaipilot/kat-coder-pro-v1"
export ANTHROPIC_DEFAULT_OPUS_MODEL="zai/glm-4.7"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="minimax/minimax-m2.1"

Reference

#Claude-Code #Vercel

Stay Updated

Get the latest AI engineering insights delivered to your inbox.

No spam. Unsubscribe at any time.