cc-switch-cli: Seamless Multi‑Model Switching for Claude Code in Terminal Environments
The article introduces cc-switch-cli, a Go‑based command‑line utility that lets developers effortlessly switch Claude Code’s underlying AI models in remote or terminal‑only environments, balancing performance and cost through preset configurations, atomic writes, backup management, and JSON‑friendly output.
Why you need cc-switch-cli?
When using Claude Code, developers often face a trade‑off between model performance and API cost: high‑end models like Sonnet or Opus are needed for complex refactoring, while cheaper models suffice for simple completions or unit tests. Manually editing JSON configuration files in remote terminals is error‑prone, and GUI tools are unusable without a desktop environment.
Core philosophy
The tool follows the Unix philosophy: solve AI‑era configuration pain with a small, composable command‑line program.
Key features
Pure terminal experience : No desktop dependencies; works inside tmux, SSH, or DevContainers.
Rich preset templates : Built‑in presets for popular Chinese models such as DeepSeek, Zhipu‑GLM, and Qwen, requiring only an API key.
Atomic writes and safe backups : Configuration changes are written atomically and previous files are retained. Non‑AI settings like DISABLE_TELEMETRY and permissions are preserved.
Extensible adapter design : Currently supports Claude Code, but the architecture can be extended to Codex, OpenCode, Antigravity CLI, and other AI coding agents.
Getting started: three steps
Step 1: Install the tool
Run the one‑click installer script:
curl -fsSL https://raw.githubusercontent.com/bigwhite/cc-switch-cli/main/install.sh | shGo developers can also install directly:
go install github.com/bigwhite/cc-switch-cli@latestStep 2: Add a provider preset
Use a built‑in preset to create a configuration, e.g., DeepSeek:
# Use built‑in deepseek preset, create a config named my-ds
cc-switch-cli add --preset deepseek --name my-ds --api-key sk-your-keyList available presets:
cc-switch-cli preset listStep 3: Switch model
Show the current provider list and switch to the newly added configuration:
# List configured providers
cc-switch-cli list
# Switch Claude Code to the DeepSeek configuration
cc-switch-cli use my-dsThe tool updates ~/.claude/settings.json atomically, and the claude command will now use the selected model.
Advanced usage
1. Override underlying variables
If a preset does not cover a specific model version, use the --env flag to replace the mapping:
# Force an Opus‑level model to the latest version (e.g., glm‑5.3)
cc-switch-cli edit my-glm --env ANTHROPIC_DEFAULT_OPUS_MODEL=glm-5.32. Backup and diagnostics
Each use operation creates a timestamped backup under ~/.cc-switch-cli/backups/. You can list and restore backups:
cc-switch-cli backup list
cc-switch-cli backup restore <timestamp>Run cc-switch-cli doctor to diagnose the current configuration health.
3. JSON output for automation
Append --json to any command to receive clean JSON, which can be piped into tools like jq for scripting.
Conclusion
Inspired by the cc-switch GUI project, cc-switch-cli fills the missing CLI gap for remote development, allowing developers to manage high‑performance and cost‑effective AI models without leaving the terminal.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
TonyBai
Tony Bai's tech world (tonybai.com). Not satisfied with just "knowing how", we strive for mastery. Focused on Go language internals, high-quality engineering practices, and cloud‑native architecture, exploring cutting‑edge intersections of Go and AI. Gophers who pursue technology are welcome—follow me and evolve with Go.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
