cc-switch-cli
Health Warn
- License — License: MIT
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Low visibility — Only 5 GitHub stars
Code Fail
- rm -rf — Recursive force deletion command in install.sh
Permissions Pass
- Permissions — No dangerous permissions requested
No AI report is available for this listing yet.
CLI tool to manage AI provider configs for Claude Code (and more). Switch between API providers with one command, auto backup, atomic write.
cc-switch-cli
CLI tool for managing AI provider configurations across coding assistants. Currently supports Claude Code, with architecture designed for future adapters (Codex, OpenCode, AntigravityCLI).
Install
One-line install (recommended)
curl -fsSL https://raw.githubusercontent.com/bigwhite/cc-switch-cli/main/install.sh | sh
Options via environment variables:
# Install a specific version
curl -fsSL https://raw.githubusercontent.com/bigwhite/cc-switch-cli/main/install.sh | CC_SWITCH_VERSION=v0.2.0 sh
# Install to a custom directory
curl -fsSL https://raw.githubusercontent.com/bigwhite/cc-switch-cli/main/install.sh | CC_SWITCH_INSTALL_DIR=~/bin sh
# Install without sudo (to ~/.local/bin)
curl -fsSL https://raw.githubusercontent.com/bigwhite/cc-switch-cli/main/install.sh | CC_SWITCH_NO_SUDO=1 sh
Via Go
go install github.com/bigwhite/cc-switch-cli@latest
Build from source
git clone https://github.com/bigwhite/cc-switch-cli
cd cc-switch-cli && make build
Quick Start
# Add a provider from a builtin preset
cc-switch-cli add --preset deepseek --name my-deepseek --api-key sk-your-key
# List all providers
cc-switch-cli list
# Switch to a provider (writes ~/.claude/settings.json + auto backup)
cc-switch-cli use my-deepseek
# Show currently active provider
cc-switch-cli current
Commands
Provider Management
| Command | Description |
|---|---|
add |
Add a new provider (supports --preset for builtin templates, --env KEY=VALUE for overrides) |
list |
List all providers, marks active with * |
show <name|id> |
Show provider details (auth tokens masked) |
edit <name|id> |
Edit provider fields (base-url, api-key, model, --env KEY=VALUE) |
remove <name|id> |
Remove a provider (cannot remove active) |
use <name|id> |
Switch active provider (atomic write + backup) |
current |
Display the currently active provider |
Presets
cc-switch-cli preset list # list available presets
cc-switch-cli preset show deepseek # show preset details
Builtin presets (multi-tier per provider):
| Provider | Presets |
|---|---|
| Zhipu GLM | zhipu-glm, zhipu-glm-5.2, zhipu-glm-4.7 |
| DeepSeek | deepseek, deepseek-v4-pro, deepseek-v4-flash |
| Qwen/DashScope | qwen-dashscope, qwen3.7-max, qwen3.6-flash |
Advanced: Override Model Mappings
Use --env KEY=VALUE (repeatable) to override any managed field:
# Use a specific model version not covered by presets
cc-switch-cli add --preset zhipu-glm --name my-glm --api-key xxx \
--env ANTHROPIC_DEFAULT_OPUS_MODEL=glm-5.2 \
--env ANTHROPIC_DEFAULT_SONNET_MODEL=glm-4.7
# Edit an existing provider's model mapping
cc-switch-cli edit my-glm --env ANTHROPIC_DEFAULT_OPUS_MODEL=glm-5.3
Configuration
cc-switch-cli extract-common # extract non-managed fields from live config
cc-switch-cli import <file.json> # import providers from JSON
cc-switch-cli export # export providers as JSON
cc-switch-cli backup list # list config backups
cc-switch-cli backup restore <ts> # restore a backup by timestamp
Diagnostics
cc-switch-cli tools # list registered tool adapters
cc-switch-cli doctor # check config health and diagnose issues
Global Flags
| Flag | Default | Description |
|---|---|---|
--tool |
claude-code |
Target CLI tool adapter |
--json |
false |
Output in JSON format (for scripting) |
--yes |
false |
Skip confirmation prompts |
--home |
~/.cc-switch-cli |
Override data directory (or set CC_SWITCH_HOME) |
How It Works
cc-switch-cli maintains a single source of truth at ~/.cc-switch-cli/store.json. When you use a provider:
- Reads the current live config (
~/.claude/settings.json) - Backs it up to
~/.cc-switch-cli/backups/claude-code/<timestamp>.json - Merges the provider's managed fields with the common fragment (non-managed fields)
- Atomically writes the result back (tmpfile + rename)
Non-managed fields (like DISABLE_TELEMETRY, permissions, hooks) are always preserved.
Data Layout
~/.cc-switch-cli/
├── store.json # provider data (SSOT)
├── presets/ # (embedded in binary)
├── common-fragments/ # common config snapshots
└── backups/
└── claude-code/
└── 2026-07-01T12-00-00.json
Donate
If you find cc-switch-cli useful, consider buying me a coffee!
WeChat Pay / Alipay:
License
MIT
Inspired by cc-switch — the GUI/Tauri version for desktop.
Reviews (0)
Sign in to leave a review.
Leave a reviewNo results found