Integrating advanced models like GLM 4.5 into tools such as Claude Code opens up new avenues for efficient coding and problem-solving. As developers seek ways to leverage cutting-edge language models for tasks ranging from code generation to debugging, understanding how to configure GLM 4.5 with Claude Code becomes essential. This setup allows you to harness the strengths of Zhipu AI's GLM series—known for its robust reasoning and multilingual capabilities—directly within Anthropic's intuitive terminal-based environment. By following a structured approach, you can switch from default models like Sonnet or Opus to GLM 4.5, enhancing your workflow with tailored performance. In this guide, we'll explore the process step by step, ensuring you can seamlessly incorporate GLM 4.5 with Claude Code for your projects. Whether you're building applications or refining algorithms, this integration promises a more responsive and context-aware coding experience.
Want an integrated, All-in-One platform for your Developer Team to work together with maximum productivity?
Apidog delivers all your demands, and replaces Postman at a much more affordable price!
Why Integrate GLM 4.5 with Claude Code?
Before diving into the setup, it's worth considering the value of combining GLM 4.5 with Claude Code. GLM 4.5, part of Zhipu AI's GLM Coding Plan, stands out for its optimized performance in code-related tasks, including natural language understanding and generation across diverse programming languages. When paired with Claude Code—an agentic tool that operates in your terminal for interactive development—this model elevates routine operations like refactoring or query optimization.
For developers in 2025, where hybrid AI workflows are standard, GLM 4.5 with Claude Code offers advantages such as faster token processing and specialized handling of technical prompts. It supports vision and search extensions for PRO users, adding layers of functionality like image analysis or web lookups during sessions. This isn't merely a model swap; it's a strategic enhancement that aligns with evolving needs in software engineering, from solo prototyping to collaborative sprints. As we'll see, the configuration is straightforward, making it accessible even for those new to multi-model environments.

Checking Available Models in Claude Code
To begin using GLM 4.5 with Claude Code, first familiarize yourself with the current model lineup. Launch Claude Code in your project directory by navigating to the folder via terminal and entering claude
. Once the session starts, type the command /models
to display the list of accessible models.
You'll notice familiar options like Claude Sonnet 4.5 or Opus, but GLM 4.5 won't appear by default—this is expected, as it requires external configuration through Zhipu AI's API compatibility. This step serves as a baseline, confirming your Claude Code installation is up to date (check with claude --version
; aim for 2.0.14 or later). If updates are needed, run claude update
to ensure compatibility. Understanding this initial view highlights the flexibility of Claude Code, which supports model switching via environment variables, paving the way for integrations like GLM 4.5 with Claude Code.

Creating an Account on the GLM 4.5 Platform
With your baseline established, the next phase involves securing access to GLM 4.5. Head to the official GLM 4.5 website at https://chat.z.ai/ and create a new account. This platform, powered by Zhipu AI, provides the gateway to their advanced models tailored for coding scenarios.
During registration, you'll provide basic details like email and password, followed by verification—typically via email link. Once logged in, explore the dashboard to grasp the ecosystem, which includes chat interfaces and API management. This account not only unlocks GLM 4.5 but also grants entry to the GLM Coding Plan, essential for seamless GLM 4.5 with Claude Code setups. Take a moment to review the terms, as they outline usage limits and plan tiers, ensuring your integration aligns with your project's scale.

Generating and Managing Your GLM 4.5 API Key
Account creation complete? Now, navigate to the API platform at https://z.ai/manage-apikey/apikey-list. This secure section allows you to generate a new API key specifically for external tools like Claude Code.
Click the "Create API Key" button, assign a descriptive name (e.g., "Claude Code Integration"), and select necessary permissions—focus on model access for GLM 4.5. Upon generation, the key appears as a string (e.g., "glm_abc123..."); copy it immediately and store it securely, perhaps in a password manager or environment variable file. Avoid hardcoding it in scripts to maintain security best practices.
This key acts as your authentication token, bridging Zhipu AI's endpoints with Claude Code's configuration. With it in hand, you're primed for the integration that enables GLM 4.5 with Claude Code, transforming abstract prompts into precise code outputs.

Configuring Claude Code for GLM 4.5
Return to your terminal and ensure Claude Code is running, then log out of any existing session with /logout
to clear prior authentications. This resets the environment for the new model.
To configure, execute the provided setup script, which automates the environment variables. Paste and run this command in your terminal:
curl -fsSL "https://cdn.bigmodel.cn/install/claude_code_zai_env.sh" | bash
When prompted, replace any placeholder with your freshly generated API key—this script modifies ~/.claude/settings.json
to set variables like ANTHROPIC_AUTH_TOKEN
to your key, ANTHROPIC_BASE_URL
to "https://api.z.ai/api/anthropic", and API_TIMEOUT_MS
to 3000000 for extended sessions.
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "your_zai_api_key",
"ANTHROPIC_BASE_URL": "https://api.z.ai/api/anthropic",
"API_TIMEOUT_MS": "3000000"
}
}
The script handles the heavy lifting, mapping GLM models to Claude's defaults: For instance, Haiku becomes GLM-4.5-Air, Sonnet and Opus to GLM-4.6. Relaunch Claude Code with claude
in a new terminal window. Enter /status
to verify—the output should confirm the switch to GLM 4.5 (or its variant), indicating successful GLM 4.5 with Claude Code activation.

If changes don't reflect, close all instances, delete ~/.claude/settings.json
for regeneration, or validate JSON syntax online. This configuration ensures Claude Code communicates via Zhipu AI's Anthropic-compatible endpoint, requiring no code modifications.
Verifying and Starting Your GLM 4.5 Session
With configuration applied, relaunch Claude Code and grant file access permissions when prompted—this allows the model to interact with your project directory. Type /status
again to double-check: You should see GLM 4.5 listed as active, perhaps with details on token limits or context window.
Now, you're equipped to tackle tasks. Prompt examples include "Refactor this Python function for efficiency" or "Generate unit tests for my Express routes"—GLM 4.5's strengths in logical reasoning will shine, often providing more concise outputs than stock Claude models. For vision or search features (PRO plan exclusive), additional MCP servers integrate effortlessly, expanding GLM 4.5 with Claude Code's utility.
Test a simple query to confirm: "Explain the quicksort algorithm in JavaScript." The response should feel attuned to coding nuances, validating your setup.
Troubleshooting Common Configuration Issues
Occasional snags can occur, but they're resolvable. If the model doesn't switch, ensure the script ran without errors—re-execute if needed, confirming no permission issues (use sudo
on Mac/Linux or admin mode on Windows). For JSON errors in settings.json
, use a validator to fix commas or quotes.
Version mismatches? Upgrade with claude update
and verify compatibility (tested up to 2.0.14). If API key revocation happens, regenerate at z.ai and rerun the script. These steps minimize downtime, keeping your GLM 4.5 with Claude Code experience smooth.
Pricing Considerations for GLM 4.5 Access
Accessing GLM 4.5 with Claude Code falls under Zhipu AI's GLM Coding Plan, starting at $3 per month for the basic tier. This unlocks core model usage, with PRO and higher plans ($9+/month) adding vision MCP and web search servers for enhanced interactivity. Pay-as-you-go options scale with tokens, but the flat rate suits most developers. Compared to competitors, it's budget-friendly, emphasizing value for coding-specific enhancements without hidden fees.

Conclusion: Empower Your Coding with GLM 4.5 and Claude Code
Integrating GLM 4.5 with Claude Code equips you with a potent duo for modern development, blending Zhipu AI's precision with Anthropic's usability. From account setup to verification, this process unlocks efficient, context-rich assistance for your projects. As AI tools evolve, such configurations will define productive workflows—start experimenting today to see the difference.
