AI EngineerGuide

How to use GLM-5.2 in Claude Code via Vercel AI Gateway

by Ashik Nesin Ashik Nesin

If you wanted to try out GLM 5.2 model but which is hosted on US region, then Vercel AI Gateway might be a good choice.

You can pretty easily use any model from Vercel AI gateway via Claude Code as well.

In our case, we’ll be using GLM 5.2

export ANTHROPIC_BASE_URL="https://ai-gateway.vercel.sh"
export ANTHROPIC_AUTH_TOKEN="your-ai-gateway-api-key"
# You need to set ANTHROPIC_API_KEY as empty
export ANTHROPIC_API_KEY=""

export ANTHROPIC_DEFAULT_SONNET_MODEL="zai/glm-5.2"
export ANTHROPIC_DEFAULT_OPUS_MODEL="zai/glm-5.2"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="zai/glm-5-turbo"

Reference

Stay Updated

Get the latest AI engineering insights delivered to your inbox.

No spam. Unsubscribe at any time.