Quick switcher for Claude Code endpoints - switch between GLM (z.ai) and default Anthropic endpoints
npm install cc-glm-switchQuick switcher for Claude Code endpoints - switch between GLM (z.ai) and default Anthropic endpoints.
``bash`
npm install -g cc-glm-switch
After installation, configure your Z.AI API key:
`bash`
cc-switch setup
Get your API key from: https://z.ai/manage-apikey/apikey-list
| Command | Description |
|---------|-------------|
| glmcode | Launch Claude Code with GLM (z.ai) endpoint |cccode
| | Launch Claude Code with default Anthropic endpoint |cc-switch status
| | Show current endpoint configuration |cc-switch setup
| | Configure API key and settings |cc-switch config
| | Show config file location |
`bashStart Claude Code with GLM endpoint
glmcode
$3
You can run different terminals with different endpoints on the same project:
- Terminal 1:
glmcode (uses GLM/z.ai)
- Terminal 2: cccode (uses default Anthropic)Each terminal session maintains its own endpoint configuration.
Configuration
Configuration is stored using the conf package.
View config location:
`bash
cc-switch config
`$3
Default GLM model mappings:
- Haiku →
glm-4.5-air
- Sonnet → glm-4.7
- Opus → glm-4.7You can customize these during setup:
`bash
cc-switch setup
Answer 'y' when asked to configure model mappings
`Environment Variables
When using
glmcode, these environment variables are set:| Variable | Value |
|----------|-------|
|
ANTHROPIC_BASE_URL | https://api.z.ai/api/anthropic |
| ANTHROPIC_AUTH_TOKEN | Your Z.AI API key |
| API_TIMEOUT_MS | 3000000 |
| ANTHROPIC_DEFAULT_HAIKU_MODEL | glm-4.5-air |
| ANTHROPIC_DEFAULT_SONNET_MODEL | glm-4.7 |
| ANTHROPIC_DEFAULT_OPUS_MODEL | glm-4.7 |
| CC_ENDPOINT | GLM |When using
cccode, GLM-specific variables are cleared and CC_ENDPOINT is set to CC`.- Endpoint mixing (route different task types to different providers)
- Integration with claude-code-router
MIT