cc-glm-switch
v1.0.0
Published
Quick switcher for Claude Code endpoints - switch between GLM (z.ai) and default Anthropic endpoints
Maintainers
Readme
cc-glm-switch
Quick switcher for Claude Code endpoints - switch between GLM (z.ai) and default Anthropic endpoints.
Installation
npm install -g cc-glm-switchSetup
After installation, configure your Z.AI API key:
cc-switch setupGet your API key from: https://z.ai/manage-apikey/apikey-list
Usage
Commands
| 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 |
Examples
# Start Claude Code with GLM endpoint
glmcode
# Start Claude Code with default endpoint
cccode
# Pass arguments to Claude Code
glmcode --print "Hello, world"
cccode -r
# Check current configuration
cc-switch statusMultiple Terminals
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:
cc-switch configModel Mappings
Default GLM model mappings:
- Haiku →
glm-4.5-air - Sonnet →
glm-4.7 - Opus →
glm-4.7
You can customize these during setup:
cc-switch setup
# Answer 'y' when asked to configure model mappingsEnvironment 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.
Future Plans
- Endpoint mixing (route different task types to different providers)
- Integration with claude-code-router
License
MIT
