CC Switch, hands-on: run Claude Code, Codex, and Gemini CLI on any provider from one switchboard
Every AI coding tool keeps its provider settings in a different file, in a different format, in a different place — and the moment you run two tools on two providers, you are hand-editing JSON, TOML, and YAML before every session. CC Switch is the switchboard that ends that: one app, twelve tools, ninety-plus provider presets, one click to change what your agent is running on.
- CC Switch v4.0.45 shipped 2026-11-29; the project (farion1231/cc-switch) has 158,060 stars, 10,325 forks, and is MIT-licensed. The desktop app is a Tauri 2 / Rust / React build for Windows, macOS, and Linux.
- Switching replaces only the key fields — endpoint, key, model, API protocol — and backs up each config file before its first rewrite. Verified live: the permissions and hooks sections of the test settings file survived the switch byte-for-byte.
- The headless path is a separate project: the community CLI (SaladDay/cc-switch-cli) v5.11.4, also MIT, shares the
~/.cc-switchdata directory with the desktop app. Install it with the static musl binary; every command in this tutorial was run against it. - What was verified live: CLI install and version, provider add/list/switch/current, the before-and-after diff of
~/.claude/settings.json, the backup file, a per-launchstartwith its generated settings file captured, the Codexconfig.tomlrewrite, and a stream-check against a local stub server. No real API key and no real model call were used anywhere in this tutorial — the keys below are placeholders, and the DeepSeek endpoint and model names were checked against DeepSeek's official API docs. - The desktop GUI steps follow the official README and user manual — the GUI itself was not driven on the headless machine used for verification. The CLI steps are the executed ones.

CC Switch is having a moment, and the numbers explain why. The project passed 158,000 stars, gained roughly 240 stars a day through the last week of November, and shipped v4.0.45 on November 29, 2026 — the day before this tutorial was written. It sits at the intersection of two things that both exploded this year: AI coding CLIs, and the cheap, fast, open-weight models that make switching providers worth doing at all.
The problem it solves is mundane, which is exactly why it matters. Claude Code reads ~/.claude/settings.json. Codex reads ~/.codex/config.toml. Gemini CLI reads its own settings file. Each one stores the endpoint, the key, and the model in its own dialect, and each one expects you to edit that file by hand whenever you want to point it somewhere else — at DeepSeek for a cheap bulk job, at GLM for a long-context task, back to the official subscription when you want the frontier model. Do that twice a day across two tools and the config files drift, keys end up in the wrong file, and a model name you picked inside the tool silently reverts on the next switch.
CC Switch replaces that whole ritual with a provider list. Add a provider once — pick a preset, paste a key — and switching is one click in the desktop app, or one command in the CLI. The app rewrites only the connection fields in each tool's config and leaves everything else alone: your plugins, hooks, MCP servers, and permissions survive every switch. That claim is the one this tutorial tests, not takes on trust — the diffs are below, from a real run.
1. What you'll need#
- One AI coding CLI already installed. Claude Code, Codex, Gemini CLI, or any of the other nine tools CC Switch supports. This tutorial verifies against Claude Code's settings file and a real Codex 0.164.0-alpha.9 binary; the steps are the same for the rest.
- An API key for a second provider — or a placeholder while you follow along. The worked example uses DeepSeek's Anthropic-compatible endpoint, which needs a key from platform.deepseek.com. You can do every step in this tutorial with a placeholder key and no spend: the switching, the diffs, and the launches all work without a live model call. Only a real request to the model needs a real key with balance.
- About 25 minutes. Ten to install and add a provider, ten to work through the CLI verification, five to read the routing section and decide whether you need it. There is no cost to install or run either app; model usage is billed by your provider, not by CC Switch.
One decision to make up front: desktop app, CLI, or both? Install the desktop app if you work on a machine with a screen — it is the full product, with the usage dashboard, the session browser, and the tray switcher. Install the CLI if you live on SSH servers or want to script the switch. Install both if you want the GUI at your desk and the same providers on your server: they share the ~/.cc-switch data directory, so a provider added in one appears in the other.
2. Step 1: Install the desktop app#
Pin the version. CC Switch ships often — 101 releases so far — and the exact asset names carry the version number, so download the release you mean. v4.0.45 is current as of this writing (released 2026-11-29). The release page carries signed installers for every platform:
- macOS (recommended):
brew install --cask cc-switch, thenbrew upgrade --cask cc-switchto update. Or downloadCC-Switch-v4.0.45-macOS.dmgfrom the releases page — a universal build, code-signed and notarized. - Windows:
CC-Switch-v4.0.45-Windows.msi, or the portableCC-Switch-v4.0.45-Windows-Portable.zipif you do not want an installer. ARM64 builds exist for both. - Linux:
CC-Switch-v4.0.45-Linux-x86_64.debfor Debian/Ubuntu, the.rpmfor Fedora and other RPM distributions, or the.AppImagefor anything else. Linux needs glibc 2.35 or later and WebKitGTK 4.1 — Ubuntu 22.04+, Debian 12+, and recent Fedora releases qualify; RHEL, Rocky, and Alma 8–9 do not, yet. Arch users installcc-switch-binwith paru.
On first launch, CC Switch imports your existing configuration instead of overwriting it. It reads your Claude Code, Codex, Gemini CLI, and Grok Build configs and saves each one as a provider named default, then adds a built-in official provider for each tool — so nothing you had configured is lost, and switching back to the official login is always one click away.
That import is the first thing to check. Open the app, pick Claude Code in the sidebar, and confirm your current setup is there as the default provider before you add anything. If the list is empty, the app did not find your tool's config directory — check Settings → App config, where each tool's config path can be pointed at the right place (on Windows, this is also how you aim it at a tool running inside WSL, with a path like \\wsl.localhost\Ubuntu\home\<user>\.claude).
3. Step 2: Add your first provider#
Click the orange + (Add Provider) at the top right of the tool page. CC Switch offers 90-plus presets; pick one and the endpoint is filled in for you — you only paste the key. The preset list includes the official providers, DeepSeek, GLM, Qwen, Kimi, MiniMax, and a long tail of relays. This is the add-provider screen, from the project's own repository:

The worked example in this tutorial is DeepSeek, because its Anthropic-compatible endpoint is the cleanest demonstration of why the switch matters: the same Claude Code, pointed at a different model, with no other change. DeepSeek's official docs give the endpoint as https://api.deepseek.com/anthropic and the current models as deepseek-flash and deepseek-v4-pro. (The older deepseek-chat and deepseek-reasoner IDs are on their way out.) One useful detail from those docs: if your codebase passes a Claude model name, DeepSeek maps it automatically — names starting claude-opus go to deepseek-v4-pro, and claude-sonnet or claude-haiku names go to deepseek-flash.
Add it from the DeepSeek preset, paste your key, and set the model to deepseek-flash. Then switch to it: select the provider card and click Enable. For Claude Code the switch takes effect immediately — no restart. For Codex, Gemini CLI, and Grok Build, restart the terminal or the CLI tool; for Claude Desktop, quit and reopen the app. The coexist-mode tools — OpenCode, OpenClaw, Hermes, Pi, MiniMax Code, Kimi Code, Oh My Pi — work differently: clicking Add writes the provider into the tool's own config alongside the others, and you pick the model you want inside the tool itself.
Switch back the same way to confirm the round trip: select the built-in Claude Official provider, click Enable, and follow the tool's own login flow (/login in Claude Code) if it asks. If you ever delete a provider, note that CC Switch will not let you delete the one currently in use — switch to another first. That is deliberate: deleting every configuration would leave the tool unusable, and the app refuses to do that to you.
4. Step 3: Install the CLI companion#
The desktop app needs a graphical interface, and the README says so plainly: for servers, SSH sessions, or machines without a desktop, use the community-maintained CC Switch CLI instead. It is a separate project — SaladDay/cc-switch-cli, MIT-licensed, 5,613 stars — and it offers the same provider switching as a terminal UI and a scriptable command line, sharing the desktop app's ~/.cc-switch data directory.
Install it with the project's install script, which drops the static musl binary into ~/.local/bin:
curl -fsSL https://github.com/SaladDay/cc-switch-cli/releases/latest/download/install.sh | bash
If you would rather see exactly what lands on your machine, download the tarball by hand instead — this is what the verification for this tutorial did, against v5.11.4 (released 2026-11-17):
curl -LO https://github.com/SaladDay/cc-switch-cli/releases/download/v5.11.4/cc-switch-cli-linux-x64-musl.tar.gz
tar -xzf cc-switch-cli-linux-x64-musl.tar.gz
chmod +x cc-switch
sudo mv cc-switch /usr/local/bin/
cc-switch --version
# cc-switch 5.11.4
macOS users can install with Homebrew (brew install cc-switch-cli). The installer honours three environment variables: CC_SWITCH_INSTALL_DIR to change the target directory, CC_SWITCH_FORCE=1 to overwrite without prompting, and CC_SWITCH_VERSION to pin a release. There is also a cc-switch update command for later.
Before doing anything else, check what the CLI sees on your machine:
cc-switch env tools
On the verification machine this reported Claude as installed (a stand-in binary was in PATH for the test), Codex as ok at 0.164.0-alpha.9, and Gemini, OpenCode, Hermes, OpenClaw, and Pi as not installed — exactly the shape of a real report, including the honest "version unavailable" note for a binary whose --version output it did not recognise. If a tool you use shows as not installed, the CLI cannot manage it until the tool itself is on your PATH.
5. Step 4: Add and switch providers from the terminal#
This is the heart of the tutorial, and every command below was run, not read. The setup: a clean home directory, a Claude Code settings file with an official-looking configuration, and placeholder keys throughout. First, list what is there:
cc-switch provider list
┌───┬─────────────────┬─────────────────┬───────────────────────────┐
│ ┆ ID ┆ Name ┆ API URL │
╞═══╪═════════════════╪═════════════════╪═══════════════════════════╡
│ ┆ claude-official ┆ Claude Official ┆ N/A │
├╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ ✓ ┆ default ┆ default ┆ https://api.anthropic.com │
└───┴─────────────────┴─────────────────┴───────────────────────────┘
ℹ Application: claude
→ Current: default
The CLI imported the existing settings file as the default provider, exactly as the desktop app does on first launch. Now add DeepSeek — non-interactively, with every field on the command line:
cc-switch provider add --name "DeepSeek Relay" --id deepseek-relay \
--base-url "https://api.deepseek.com/anthropic" \
--api-key "sk-deepseek-..." \
--model "deepseek-flash" --api-format anthropic
=== Provider Configuration Summary ===
ID: deepseek-relay
Provider Name:: DeepSeek Relay
Core Configuration:
API Format: Anthropic Messages (Native)
API Key: sk-deepseek-...
Base URL: https://api.deepseek.com/anthropic
Model: deepseek-flash
======================
✓ Successfully added provider 'deepseek-relay'
Two flags deserve a note. --api-format tells CC Switch which wire protocol the upstream speaks — anthropic, openai_chat, openai_responses, or gemini_native for Claude — and it matters in Routing mode (Step 7). For a direct switch to an Anthropic-compatible endpoint, anthropic is correct. The --template flag is the shortcut for the presets: --template deepseek fills in the endpoint for you, and the template list also includes the relay services (88api, apimart, patewayai, cubence, openmodel, packycode, dds, runapi, aicodemirror, qiniu, fenno) and the official providers.
Now the switch, and the proof. Before switching, the settings file looked like this:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.anthropic.com",
"ANTHROPIC_AUTH_TOKEN": "sk-ant-official-...",
"ANTHROPIC_MODEL": "claude-sonnet-5-5",
"ANTHROPIC_SMALL_FAST_MODEL": "claude-haiku-4-5"
},
"permissions": { "allow": ["Bash(npm run test)"] },
"hooks": {}
}
cc-switch provider switch deepseek-relay
# ✓ Switched to provider 'deepseek-relay'
# Application: claude
# Note: Restart your CLI client to apply the changes.
After the switch, the same file read:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.deepseek.com/anthropic",
"ANTHROPIC_AUTH_TOKEN": "sk-deepseek-...",
"ANTHROPIC_MODEL": "deepseek-flash",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "deepseek-flash",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "deepseek-flash",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "deepseek-flash"
},
"permissions": {
"allow": [
"Bash(npm run test)"
]
},
"hooks": {}
}
That diff is the whole value proposition, verified. Only the env block changed — endpoint, key, model — and the permissions and hooks sections survived intact (the switch re-serialises the JSON, so the one-line permissions object is now pretty-printed, but the content is identical). Two details are worth knowing. First, CC Switch normalises the model keys: the old ANTHROPIC_SMALL_FAST_MODEL is gone, replaced by the three ANTHROPIC_DEFAULT_HAIKU_MODEL / SONNET / OPUS keys — so if you hand-edited a role-model key, expect it to be rewritten in this scheme on the next switch. Second, the original file was backed up before the first rewrite, exactly as the README promises, at ~/.cc-switch/backups/live-first-write/<hash>-settings.json, next to a .source companion file. Switching back to default restored the official endpoint and key, with the same normalised model keys.
The remaining provider commands are all scriptable: provider current shows the active provider in full, provider duplicate <id> clones one, provider fetch-models <id> pulls the remote model list, and use <id> is the one-word shortcut for provider switch <id>. Two commands are not scriptable: provider edit and provider delete are interactive — they open a prompt and need a TTY. The delete confirmation can be driven from a script with a pseudo-terminal (printf 'y\n' | script -qec "cc-switch provider delete deepseek-relay" /dev/null worked in verification), but that is a workaround, not a supported flag.

6. Step 5: Launch one session on another provider — without switching#
Global switching is for changing your default. Sometimes you want the opposite: one terminal on DeepSeek while everything else stays on the official provider. That is what cc-switch start does, and it is the most useful command in the CLI for day-to-day work. Preview it first:
cc-switch start claude deepseek-relay --dry-run
Claude dry run
Provider ID: deepseek-relay
Provider name: DeepSeek Relay
Executable: /home/user/.local/bin/claude
Settings path preview: /tmp/cc-switch-claude-deepseek-relay-2954-1796015999853940061.json
Launch command: /home/user/.local/bin/claude --settings /tmp/cc-switch-claude-deepseek-relay-2954-1796015999853940061.json
Passthrough args: (none)
Dry run only; no temporary files were written and the app was not started.
The mechanism is visible in that output: start writes a temporary settings file containing the provider's configuration, then launches claude --settings <tempfile>. The global provider never changes. Run it for real and the same thing happens — verified by capturing the temporary settings file with a stand-in claude binary that saved the file it was handed:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.deepseek.com/anthropic",
"ANTHROPIC_AUTH_TOKEN": "sk-deepseek-...",
"ANTHROPIC_MODEL": "deepseek-flash",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "deepseek-flash",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "deepseek-flash",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "deepseek-flash"
},
"permissions": {
"allow": [
"Bash(npm run test)"
]
},
"hooks": {}
}
The generated file is the provider's env merged over your own settings — your permissions and hooks travel with the launch. A cc-switch provider current immediately after the launch still reported default. Use this whenever you want two providers side by side: one terminal on the cheap model for bulk work, another on the official subscription for the hard task, no global state to remember to switch back.
While you are in the terminal, run the health commands so you know what a clean report looks like:
cc-switch env check
cc-switch config backup --name before-deepseek
cc-switch sessions list --all
env check runs a configuration doctor: it confirms the settings file exists, flags a missing ~/.claude.json onboarding file, and reports the current provider, the auth token state, and the base URL. config backup snapshots the whole ~/.cc-switch database (the verification run created verify-run_20261130_051843.sql under backups/). sessions list was empty on a fresh machine — it fills in as you work, and sessions sync-usage --all imports local session logs into the token and cost statistics.
7. Step 6: Do the same for Codex#
The same switch works for Codex, with one difference that matters: Codex reads TOML, not JSON, and the switch writes a different shape. Add a Codex provider with the --app codex flag:
cc-switch --app codex provider add --name "DeepSeek Codex" --id deepseek-codex \
--base-url "https://api.deepseek.com/v1" \
--api-key "sk-deepseek-..." \
--model "deepseek-chat" \
--api-format chat
cc-switch --app codex provider switch deepseek-codex
# ✓ Switched to provider 'deepseek-codex'
# Application: codex
# Note: Restart your CLI client to apply the changes.
The resulting ~/.codex/config.toml — written by the switch, read back verbatim:
model_provider = "custom"
model = "deepseek-chat"
model_reasoning_effort = "high"
disable_response_storage = true
[model_providers.custom]
name = "DeepSeek Codex"
base_url = "https://api.deepseek.com/v1"
wire_api = "responses"
requires_openai_auth = false
experimental_bearer_token = "sk-deepseek-..."
Two things to notice. First, the OpenAI-compatible base URL for Codex is https://api.deepseek.com/v1 — the same host, a different path from the Anthropic-compatible endpoint used for Claude Code. Second, the wire_api is responses even though the provider was added with --api-format chat: adding a second provider with --api-format responses produced the identical file. In direct mode the Codex writer always uses the Responses wire API; the chat-versus-responses choice only changes behaviour in Routing mode, where the local proxy does the conversion. And unlike Claude Code, Codex needs a restart after a switch — the CLI says so in its output, and the README confirms it: for Codex, closing the terminal and running codex again is not even enough on its own, because every codex invocation shares one background daemon that must be restarted to pick up a new model list. Switch back to codex-official when you are done, the same way.
8. Step 7: Routing and aggregation, when they earn their complexity#
Everything so far is the direct mode: CC Switch writes the provider's endpoint, key, and model straight into the tool's config. Two advanced modes sit on top of it, and both are worth understanding before you touch them.
Routing puts CC Switch between the tool and the provider. The tool's config is rewritten to point at http://127.0.0.1:15721 with the placeholder key PROXY_MANAGED, and CC Switch forwards each request to the real provider, converting between API formats as it goes. That conversion is what makes the combinations possible that direct mode cannot do: Claude Code against an OpenAI- or Gemini-format provider, Codex against an Anthropic-format provider, a local Ollama server behind Claude Code. Start it from the Routing tab of the Claude Code, Codex, Gemini CLI, or Grok Build page — in the CLI, cc-switch proxy enable turns on the route for the current app — and set the provider's Upstream Format to match the real API before you do, or the requests come back 404 or 405. Routing also enables the auto-failover queue: when a request fails, CC Switch moves to the next provider in the queue, with a circuit breaker and health monitoring. The local proxy's own status is inspectable at any time:
cc-switch proxy show
Local Proxy
Running: no
Active routes: Claude=off, Codex=off, Gemini=off
Listen address: 127.0.0.1
Mode: local proxy (manual takeover and automatic failover follow app settings)
Retries: 6
Logging: enabled
Timeouts (first-byte / idle / non-stream): 90s / 180s / 600s
Proxy app routes:
- Claude: disabled, configured 15721
- Codex: disabled, configured 15722
- Gemini: disabled, configured 15723
Three limits, all from the README. Official providers cannot go through local routing — the exception is Codex's OpenAI Official. Quitting CC Switch writes the direct provider back into the config first, so a routing session never strands your tools pointing at a dead local port. And on Windows, the daemon-managed proxy is unavailable; the foreground mode (cc-switch proxy serve --takeover claude) is the alternative there.
Aggregation is the other mode: on the Claude Code or Codex page, add several providers to one aggregated model list, and every model appears in the client's own model picker. Each request goes to the provider of the model you pick — no switching at all. Claude Code needs version 2.1.243 or later; Codex needs a full restart after the list changes. Aggregation does not provide failover, and switching models mid-session rebuilds the prompt cache, so the first turn on a new model costs a little more.
When do these earn their complexity? Routing, when you need a format the tool does not speak natively — a local model server, GPT inside Claude Code, Claude inside Codex. Aggregation, when you hop between models from different providers inside a single session. Failover, when a provider's outage costs you real work. For everything else, direct switching is the whole product, and the simpler path is the right one.
9. Gotchas: what the checks don't check, and the traps I hit#
stream-checkandspeedtestprove reachability, not that the provider works. Verified against a local stub server:stream-checkissued twoGET /requests against the base URL and reported the provideroperationalwith HTTP 501 and the message "Reachable" — in 4 ms, without ever sending a model request.speedtestreported the same 501 with a 0 ms latency. The desktop README warns about this in its own words: the connectivity check only verifies the address is reachable; it cannot verify the key or the model name. Treat a green check as "the endpoint answers", and prove the rest by launching the tool.- Model keys get normalised on switch. As shown in Step 4,
ANTHROPIC_SMALL_FAST_MODELdoes not survive a switch — it becomesANTHROPIC_DEFAULT_HAIKU_MODEL(and Sonnet/Opus siblings). If you hand-edited a role-model key, re-check it after your first switch. - Codex's wire API is
responsesin direct mode, whatever you pass. Both--api-format chatand--api-format responseswrote the identicalconfig.toml. If you need Chat Completions semantics for Codex, that is a Routing-mode concern, not a direct-switch flag. - Your in-tool model pick does not stick across switches. The model belongs to the provider. A model you pick with
/modelinside Claude Code stays until the next switch, then the config is replaced with the model saved in the target provider. To keep a model long-term, edit that provider in CC Switch. - Edit and delete need a terminal.
provider add,switch,list, andcurrentare scriptable;provider editandprovider deleteopen interactive prompts and fail without a TTY. - Relay providers are a trust decision, not a free lunch. Much of the preset list — and much of the README's sponsor section — is third-party relays offering the same models at a fraction of the official price. Your key and your prompts go through them. Check what a relay is before you route work through it, and keep anything sensitive on the official provider. The README also notes that using a subscription outside the official client may violate the vendor's terms of service; assess that risk yourself.
- Version lag between the two projects is real. The desktop app and the CLI are released separately, and the CLI's supported database version sometimes lags behind the desktop app's. If you see a "database version is too new" message in the CLI, upgrade it or wait for it to catch up.
10. When to use this vs alternatives#
| Approach | Use it when | Watch out for |
|---|---|---|
| CC Switch (desktop) | You switch providers or tools more than once a week, or you want usage stats, session browsing, and tray switching in one place. | Needs a desktop; Linux needs WebKitGTK 4.1. |
| CC Switch CLI | SSH servers, headless machines, or scripting the switch in a shell function or alias. | Community-maintained fork; edit and delete are interactive-only. |
| Hand-editing config files | One provider, one tool, and you change it rarely. Nothing to install, nothing to learn. | Breaks down at two providers: keys drift, model names revert, formats differ. |
| An LLM gateway (LiteLLM, OpenRouter) | You want one endpoint and one key for many models across many applications, not just coding CLIs. | A server to run (LiteLLM) or a middleman on every request (OpenRouter); the coding tool still points at one endpoint. |
| Environment variables per shell | Throwaway experiments in one terminal: ANTHROPIC_BASE_URL plus a key, gone when the shell closes. | Nothing persists, nothing is tracked, and a leaked shell history leaks the key. |
The honest summary: CC Switch is the right tool when the switching itself is the recurring work. If your provider changes once a quarter, a text editor is the better tool — it is already installed, and it cannot lag behind a database version. If it changes once a day, the switchboard pays for itself in the first week.
11. The takeaway#
CC Switch does one thing, and the verification in this tutorial is that it does it without side effects: it rewrites the connection fields in your tools' config files and nothing else. Add a provider from a preset, switch with one click or one command, and your plugins, hooks, MCP servers, and permissions are exactly where you left them. The CLI gives you the same switch on a headless machine, the per-launch start gives you two providers in two terminals with no global state, and routing and aggregation are there for the day you need a format conversion or a combined model list.
Start with the desktop app and one second provider — DeepSeek's deepseek-flash through the Anthropic-compatible endpoint is the cheapest honest test. Switch to it, run one real task, switch back. Then install the CLI on your server and put the same providers there, so the machine you SSH into stops being the machine with the stale config. The switchboard only helps if the providers in it are ones you actually use — add two, delete the ones you never touch, and let the rest stay a list you never open.