Z.AI’s GLM-4.5 models can be integrated with Claude Code through an Anthropic API-compatible endpoint.
This allows Claude Code to communicate with GLM-4.5 without requiring any code modifications to Claude Code itself.
1. Obtain Your Z.AI API Key
Visit Z.AI to get your API key:
- API Key Management
- Or via the official docs: Claude Code API Docs
2. Configure Environment Variables
After installing Claude Code, set up environment variables using one of the following methods:
Method 1: Using a Script (Recommended for First-Time Users)
curl -O "http://bigmodel-us3-prod-marketplace.cn-wlcb.ufileos.com/1753683755292-30b3431f487b4cc1863e57a81d78e289.sh?ufileattname=claude_code_prod_zai.sh"
Method 2: Manual Configuration
export ANTHROPIC_BASE_URL=https://api.z.ai/api/anthropic
export ANTHROPIC_AUTH_TOKEN=YOUR_API_KEY
3. Quick Start with Claude Code
If prompted with “Do you want to use this API key”, select “Yes.”
After launching, grant Claude Code permission to access files in your project folder.
You can now use Claude Code for development!

Claude Code has two internal model environment variables:
- ANTHROPIC_MODEL → GLM-4.5 (main tasks: dialogue, planning, coding, complex reasoning)
- ANTHROPIC_SMALL_FAST_MODEL → GLM-4.5-Air (auxiliary tasks: file search, syntax checking)
This setup balances performance, speed, and cost. Other models (GLM-4.5-X / AirX / Flash) are not currently supported.
4. How to Switch the Model in Use
- Edit
~/.claude/settings.json:
Switch to GLM-4.5-Air:
{
"env": {
"ANTHROPIC_MODEL": "glm-4.5-air"
}
}
- Open a new terminal and run:
claude
- In Claude Code, check model status:
/status

Switch back to GLM-4.5:
{
"env": {
"ANTHROPIC_MODEL": "glm-4.5"
}
}
You’re all set — Claude Code is now running on GLM-4.5, combining speed, power, and affordability.
💡 Tips
When asking Claude Code (powered by GLM-4.5) to execute code or complete multi-step tasks, it’s best to provide a clear SOP (Standard Operating Procedure) document.
- Define step-by-step instructions
- Provide expected input/output formats
- Specify success criteria
👉 This helps the AI follow your workflow more reliably and ensures that your development needs are executed effectively.