Tired of constantly switching between Claude Code configurations? This script solves the common problem of having to choose between your Claude Code Pro / Max subscription and Z.AI Coding Plan. Now you can use both side-by-side with simple, separate commands - no more complicated file edits or Docker setups!
- Claude Code Pro / Max Subscription: You have a Pro / Max subscription that you want to use for certain tasks
- Z.AI Coding Plan: You also have Z.AI's coding plan and want to use it for certain tasks
- Configuration Hell: The official documentation tells you to edit
~/.claude/settings.jsonto switch between them - Constant Switching: Every time you want to change providers, you have to manually edit configuration files
- Complicated Solutions: Docker setups and other workarounds are complex and heavy-weight
# Use your Claude Code Pro / Max subscription
claude "Help me with planning my project"
# Use Z.AI's coding plan with cheaper models
zclaude "Help me with debugging this code"
zclaude "Help me with building this project"- Zero Configuration Switching: Both commands work instantly without any file edits
- Dual Configuration: Run both
claudeandzclaudecommands simultaneously - Smart Shell Detection: Automatically detects and configures your shell (bash, zsh, fish, ksh, csh)
- MCP Server Integration: Adds Z.AI MCP servers for enhanced functionality
- Multi-Platform Support: Works on Linux, macOS, and WSL
- Safe Installation: Creates backups of existing configurations
- Enhanced Models: Access to glm-4.5-air and glm-4.6 models via Z.AI
- Node.js and npm (for Claude CLI installation)
- Internet connection for downloading packages
- Your Z.AI Coding Plan API token
-
Download the setup script:
curl -O https://raw.githubusercontent.com/dharmapurikar/zclaude/main/setup_zclaude.sh chmod +x setup_zclaude.sh
-
Run the setup:
./setup_zclaude.sh
-
Follow the prompts:
- Enter your Z.AI Coding Plan API Token when prompted
- The script will detect your shell and configure everything automatically
For testing in a fresh environment:
# Build and run with Docker Compose
docker-compose up --build
# Or build and run manually
docker build -t zclaude-test .
docker run -it --rm -v $(pwd):/app zclaude-test- Installs
@anthropic-ai/claude-codevia npm - Verifies installation and PATH configuration
- bash:
~/.bashrcor~/.bash_profile - zsh:
~/.zshrc - fish:
~/.config/fish/config.fish - ksh:
~/.kshrc - csh/tcsh:
~/.cshrc
zai-mcp-server: Z.AI's enhanced functionalityweb-search-prime: Web search capabilitiesweb-reader: Web page reading functionality
After installation, you'll have access to both commands without any configuration switching:
claude --help
claude "Review this professional document for quality"
claude "Help me with advanced analysis"zclaude --help
zclaude "Debug this code"
zclaude "Build this project with web search capabilities"claude: Professional tasks, document analysis, when you want to use your Claude Code Pro / Max subscription benefitszclaude: Coding projects, debugging, when you want Z.AI's higher limits and capable models and MCP server capabilities
- Higher Limits: glm-4.5-air, glm-4.6
- Web Search: Via web-search-prime MCP server
- Web Reading: Via web-reader MCP server
The zclaude command sets these environment variables automatically:
ANTHROPIC_BASE_URL="https://api.z.ai/api/anthropic"
API_TIMEOUT_MS="3000000"
ANTHROPIC_DEFAULT_HAIKU_MODEL="glm-4.5-air"
ANTHROPIC_DEFAULT_SONNET_MODEL="glm-4.6"
ANTHROPIC_DEFAULT_OPUS_MODEL="glm-4.6"
ANTHROPIC_AUTH_TOKEN="your-token"zclaude_env() {
ANTHROPIC_BASE_URL="https://api.z.ai/api/anthropic" \
API_TIMEOUT_MS="3000000" \
ANTHROPIC_DEFAULT_HAIKU_MODEL="glm-4.5-air" \
ANTHROPIC_DEFAULT_SONNET_MODEL="glm-4.6" \
ANTHROPIC_DEFAULT_OPUS_MODEL="glm-4.6" \
ANTHROPIC_AUTH_TOKEN="your-token" \
claude "$@"
}
alias zclaude="zclaude_env"function zclaude_env
set -gx ANTHROPIC_BASE_URL "https://api.z.ai/api/anthropic"
set -gx API_TIMEOUT_MS "3000000"
set -gx ANTHROPIC_DEFAULT_HAIKU_MODEL "glm-4.5-air"
set -gx ANTHROPIC_DEFAULT_SONNET_MODEL "glm-4.6"
set -gx ANTHROPIC_DEFAULT_OPUS_MODEL "glm-4.6"
set -gx ANTHROPIC_AUTH_TOKEN "your-token"
claude $argv
end
alias zclaude=zclaude_envalias zclaude_env 'setenv ANTHROPIC_BASE_URL "https://api.z.ai/api/anthropic"; \
setenv API_TIMEOUT_MS "3000000"; \
setenv ANTHROPIC_DEFAULT_HAIKU_MODEL "glm-4.5-air"; \
setenv ANTHROPIC_DEFAULT_SONNET_MODEL "glm-4.6"; \
setenv ANTHROPIC_DEFAULT_OPUS_MODEL "glm-4.6"; \
setenv ANTHROPIC_AUTH_TOKEN "your-token"; \
claude \!*'
alias zclaude zclaude_env-
Claude CLI not found:
npm install -g @anthropic-ai/claude-code
-
zclaude command not found:
# Reload your shell configuration source ~/.bashrc # or ~/.zshrc, etc.
-
MCP servers not connecting:
# Check server status claude mcp list # Verify your API token is correct
-
Permission denied:
chmod +x setup_zclaude.sh
- Claude Documentation: https://docs.claude.com
- GitHub Issues: https://github.com/anthropics/claude-code/issues
- Z.AI Support: Check with your Z.AI provider
To remove the Z.AI configuration:
-
Remove the zclaude configuration from your shell file:
# Edit your shell configuration file and remove the # Z.AI Claude Configuration section
-
Remove MCP servers:
claude mcp remove zai-mcp-server claude mcp remove web-search-prime claude mcp remove web-reader
You can also run the setup script again - it will automatically remove existing configurations before installing new ones.
zclaude/
βββ setup_zclaude.sh # Main setup script
βββ Dockerfile # Docker configuration for testing
βββ docker-compose.yml # Docker Compose configuration
βββ README.md # This file
βββ DOCKER_README.md # Docker-specific instructions
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly using the Docker environment
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Anthropic for the Claude CLI
- Z.AI for generous limits on awesome models and MCP servers
- The open-source community for shell compatibility solutions
π Enjoy using both Claude Code Pro / Max subscription and Z.AI Coding Plan seamlessly!
