<h1 align="center">
<a href="https://prompts.chat">
A provider-agnostic utility for toggling between different Claude API providers in Claude Code. Switch seamlessly between Anthropic's official API, Z.AI GLM models, OpenAI-compatible endpoints, or self-hosted solutions.
Sign in to like and favorite skills
A provider-agnostic utility for toggling between different Claude API providers in Claude Code. Switch seamlessly between Anthropic's official API, Z.AI GLM models, OpenAI-compatible endpoints, or self-hosted solutions.
claudenpm install -g @sekora_ai/claude-toggle
This works on macOS, Linux, and Windows (via WSL or Git Bash).
# Clone the repository git clone https://gitlab.com/sekora-ai/claude-code/claude-toggle.git cd claude-toggle chmod +x claude-toggle # Copy default config to user directory mkdir -p ~/.config/claude-providers cp providers.json ~/.config/claude-providers/ # Add to PATH (choose your shell) # For bash: echo 'export PATH="$HOME/path/to/claude-toggle:$PATH"' >> ~/.bashrc source ~/.bashrc # For zsh: echo 'export PATH="$HOME/path/to/claude-toggle:$PATH"' >> ~/.zshrc source ~/.zshrc
# Launch with default provider (Anthropic) ./claude-toggle # Launch with specific provider ./claude-toggle --provider glm # List available providers ./claude-toggle --list-providers # Validate provider configuration ./claude-toggle --validate --provider glm
All unrecognized options are forwarded to the Claude Code CLI:
# Pass options to Claude Code ./claude-toggle --provider glm --dangerously-skip-permissions # Any Claude Code option works ./claude-toggle --provider anthropic --help
| Option | Description |
|---|---|
| Select a specific provider |
| List all available providers |
| Validate provider configuration without launching |
| Enable verbose output |
| Show help message |
| Legacy alias for |
The script searches for
providers.json in this order:
~/.config/claude-providers/providers.json (recommended)~/.claude-providers.json<script-directory>/providers.jsonProviders are configured in
providers.json:
{ "version": "1.0", "default_provider": "anthropic", "providers": { "anthropic": { "description": "Anthropic's official API", "enabled": true, "env_vars": {}, "validation": {} }, "glm": { "description": "Z.AI GLM models via proxy", "enabled": true, "env_vars": { "ANTHROPIC_AUTH_TOKEN": { "value": "${ZAI_API_KEY}", "required": true }, "ANTHROPIC_BASE_URL": { "value": "https://api.z.ai/api/anthropic" } }, "validation": { "required_env_vars": ["ZAI_API_KEY"] } } } }
Interactive wizard (recommended):
If you're using Claude Code in this repository, run:
/add-provider
This walks you through the entire process interactively.
Manual configuration:
See PROVIDERS.md for detailed instructions on adding new providers.
Quick example:
"my-provider": { "description": "My custom provider", "enabled": true, "env_vars": { "ANTHROPIC_AUTH_TOKEN": {"value": "${MY_API_KEY}"}, "ANTHROPIC_BASE_URL": {"value": "https://api.example.com/v1"} }, "validation": { "required_env_vars": ["MY_API_KEY"] } }
| Provider | Description | Required Env Var |
|---|---|---|
| Anthropic's official API (default) | None (uses default auth) |
| Z.AI GLM models via proxy | |
# Set your API key export ZAI_API_KEY="your-key-here" # Launch Claude Code with GLM ./claude-toggle --provider glm
# Check if provider is properly configured ./claude-toggle --validate --provider glm # Output: Provider 'glm' is valid and ready to use
# See which provider is being used ./claude-toggle --verbose --provider glm # Output: Using provider: glm
This project uses GitLab CI/CD to automatically publish to npm when version tags are pushed.
Important: As of December 9, 2025, npm classic tokens have been permanently revoked. You must use Granular Access Tokens for CI/CD automation.
gitlab-ci-publish (or similar descriptive name)claude-toggle specificallyAlternatively, create a token via CLI:
npm token create
NPM_TOKENv*Since granular tokens expire after 90 days maximum, set a reminder to rotate the token before expiration. Update the
NPM_TOKEN variable in GitLab with the new token.
# 1. Update version in package.json and claude-toggle # 2. Commit changes git add -A && git commit -m "chore: bump version to X.Y.Z" # 3. Create and push version tag git tag vX.Y.Z git push origin main --tags
The pipeline will automatically validate and publish to npm.
claude-toggle/ ├── claude-toggle # Main executable script ├── providers.json # Provider configuration ├── package.json # npm package manifest ├── bin/ │ ├── wrapper.js # Node.js wrapper for npm │ └── postinstall.js # Post-install config setup ├── docs/ │ └── NPM_PUBLISHING.md # Publishing guide ├── .claude/ │ └── commands/ │ └── add-provider.md # Interactive provider wizard ├── CLAUDE.md # Claude Code project instructions ├── PROVIDERS.md # Provider configuration guide ├── DEVELOPER_GUIDE.md # Development documentation ├── LICENSE # MIT license └── README.md # This file
# Test help output ./claude-toggle --help # Test provider listing ./claude-toggle --list-providers # Validate all providers ./claude-toggle --validate --provider anthropic ./claude-toggle --validate --provider glm # Requires ZAI_API_KEY
See DEVELOPER_GUIDE.md for development setup, coding standards, and contribution guidelines.
git checkout -b feature/my-featureproviders.jsonexec claude to launch Claude CodeAll environment changes are scoped to the Claude Code subprocess - your shell environment remains unchanged.
| Platform | npm | Manual |
|---|---|---|
| macOS | Full support | Full support |
| Linux | Full support | Full support |
| Windows | Via WSL/Git Bash | Via WSL/Git Bash |
claude-toggle is a bash script and requires a Unix-like environment:
Windows Subsystem for Linux (WSL) - Recommended
# Install WSL, then inside WSL: npm install -g @sekora_ai/claude-toggle
Git Bash - With Python 3 installed
npm install -g @sekora_ai/claude-toggle
Create a configuration file in one of the search paths:
mkdir -p ~/.config/claude-providers cp providers.json ~/.config/claude-providers/
The error message includes detailed setup instructions. For example, for GLM:
export ZAI_API_KEY="your-api-key-here"
Install Python 3:
# macOS (using Homebrew) brew install python3 # Ubuntu/Debian sudo apt install python3 # Fedora sudo dnf install python3 # Windows (WSL) sudo apt install python3
MIT License - See LICENSE for details.