Claude Code is even more powerful with the GLM Coding Planβ giving you 3Γ the usage at a fraction of the cost. Code faster, debug smarter, and manage workflows seamlessly with more tokens, and rock-solid reliability.
Step 1: Installing the Claude Code
- Recommended Installation Method
- Cursor Guided Installation Method
Prerequisites: Node.js 18 or newer
Note: If you encounter permission issues during installation, try using
sudo (MacOS/Linux) or running the command prompt as an administrator (Windows) to re-execute the installation command.Step 2: Config GLM Coding Plan
1
Get API Key
- Access Z.AI Open Platform, Register or Login.
- Create an API Key in the API Keys management page.
- Copy your API Key for use.
2
Configure Environment Variables
Set up environment variables using one of the following methods in the macOS Linux or Windows:
Note: Some commands show no output when setting environment variables β thatβs normal as long as no errors appear.
- For first-time use in scripts (Mac/Linux)
- Manual configuration (Windows MacOS Linux)
Just run the following command in your terminalThe script will automatically modify
~/.claude/settings.json to configure the following environment variablesStep 3: Start with Claude Code
Once the configuration is complete, you can start using Claude Code in your terminal or cmd:If prompted with βDo you want to use this API key,β select βYes.βAfter launching, grant Claude Code permission to access files in your folder as shown below:
You can use Claude Code for development Now!
FAQ
How to Switch the Model in Use
Mapping between Claude Code internal model environment variables and GLM models, with the default configuration as follows:
ANTHROPIC_DEFAULT_OPUS_MODEL:GLM-4.6ANTHROPIC_DEFAULT_SONNET_MODEL:GLM-4.6ANTHROPIC_DEFAULT_HAIKU_MODEL:GLM-4.5-Air
It is generally not recommended to manually adjust the model mapping, as hardcoding the model mapping makes it inconvenient to automatically update to the latest model when the GLM Coding Plan models are updated.
- Configure
~/.claude/settings.jsonwith the following content:
- Open a new terminal window and run
claudeto start Claude Code, enter/statusto check the current model status.
Vision and Search MCP
Refer to the Vision MCP Server and Search MCP Server documentation; once configured, you can use them in Claude Code.Manual Configuration Not Work
If you manually modified the~/.claude/settings.json configuration file but found the changes did not take effect, refer to the following troubleshooting steps.
- Close all Claude Code windows, open a new command-line window, and run
claudeagain to start. - If the issue persists, try deleting the
~/.claude/settings.jsonfile and then reconfigure the environment variables; Claude Code will automatically generate a new configuration file. - Confirm that the JSON format of the configuration file is correct, check the variable names, and ensure there are no missing or extra commas; you can use an online JSON validator tool to check.
Recommended Claude Code Version
We recommend using the latest version of Claude Code. You can check the current version and upgrade with the following commands:We have verified compatibility with Claude Code 2.0.14 and other versions.