A command-line tool for switching between different Claude Code model configurations.
This tool allows you to easily switch between different model configurations for Claude Code by updating the ~/.claude/settings.json file with environment variables from JSON configuration files.
Features:
- Simple model switching between multiple configurations
- Fast switching using Claude Code's built-in environment variables
- Works with LLM models that natively support Anthropic API format
| Feature | switch-cc-model | claude-code-router |
|---|---|---|
| Switching Speed | Instant (environment variables) | Slower (needs config file changes) |
| API Format Support | Anthropic API only | Anthropic + OpenAI APIs |
| Configuration | Simple JSON files | More complex routing rules |
| Dependencies | None (uses Claude Code built-in) | Requires proxy service |
| Resource Usage | Minimal | Additional service |
| Setup Complexity | Very simple | More involved |
Choose switch-cc-model if:
- You need fast switching between Anthropic-compatible models
- You prefer simple setup and minimal resource usage
- You want to use Claude Code's built-in configuration system
Choose claude-code-router if:
- You need OpenAI API compatibility
- You require advanced routing and transformation features
- You need more complex model management
- Python 3
- Claude Code installed
- sudo access (for installation to
/usr/local/bin)
- Clone or download this repository
- Run the installation script:
./install.shThis will:
- Copy all JSON configuration files to
~/.claude/my-models/ - Install the
switch-cc-modelcommand to/usr/local/bin/
# Use default configuration directory (~/.claude/my-models)
switch-cc-model
# Use custom configuration directory
switch-cc-model --config-dir /path/to/your/configs
# Show help
switch-cc-model --helpThis repository includes configurations for GLM and DeepSeek models, but you can add any model that supports the Anthropic API format:
- Create a new JSON file in your configuration directory (e.g.,
your-model.json) - Use the configuration format shown below
- The new model will automatically appear in the selection menu
Configuration files are JSON files with the following structure:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.example.com/anthropic",
"ANTHROPIC_AUTH_TOKEN": "your-api-key-here",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "model-name",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "model-name",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "model-name",
"API_TIMEOUT_MS": 600000,
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": 1
}
}Note: The configuration files in this repository have empty ANTHROPIC_AUTH_TOKEN values. When you switch to a configuration with an empty API key, the script will automatically prompt you to enter your API key.
When you select a configuration with an empty API key, the script will:
- Display a yellow warning message
- Prompt you to enter your API key
- Ask if you want to save the API key to the configuration file for future use
- Apply the configuration with your API key
You can cancel the operation at any time by pressing Ctrl-C.
- Default:
~/.claude/my-models/ - Custom: Use
--config-dirflag to specify a different directory
The tool looks for all .json files in the configuration directory and presents them as numbered options.