If you use Claude Code with more than one API provider, you know the routine: open ~/.claude/settings.json, swap the base URL, swap the key, swap the model, hope you did not break the JSON, and do it again tomorrow when you hit a limit. Multiply that by Codex and Gemini CLI, which each keep their own config in their own format, and switching becomes a chore you avoid.
CC Switch is a desktop app for Windows, macOS and Linux that does this in one click. Pick a preset, paste a key, press Enable. It manages Claude Code, Claude Desktop, Codex, Gemini CLI, Grok Build, OpenCode, OpenClaw, Hermes Agent, Pi, MiniMax Code, Kimi Code and Oh My Pi, and the README lists 90+ provider presets, including AWS Bedrock and NVIDIA NIM.
This guide covers install, your first switch, running GPT or local models inside Claude Code through its routing mode, and the details that trip people up.
Install
macOS (Homebrew is the recommended route):
brew install --cask cc-switch
Update later with:
brew upgrade --cask cc-switch
The macOS build is universal (Apple Silicon and Intel) and is signed and notarized. On Arch Linux:
paru -S cc-switch-bin
Windows and other Linux users download the .msi, .deb, .rpm or .AppImage from the repo's Releases page. Requirements per the README: Windows 10+, macOS 12+, or Linux with glibc 2.35+ and WebKitGTK 4.1 (Ubuntu 22.04+, Debian 12+).
Working on a server over SSH with no desktop? The README points to the community CC Switch CLI, which shares the same ~/.cc-switch data folder:
brew install cc-switch-cli
Nothing you already have gets lost
On first launch, CC Switch imports your existing Claude Code, Codex, Gemini CLI and Grok Build config as a provider called default, and adds an official provider for each tool. Before it rewrites any config file for the first time, it backs up the original to ~/.cc-switch/backups/live-first-write/.
It also only touches the key fields when you switch: endpoint, key, model and API protocol. Your plugins, hooks, permissions, MCP servers, your own environment variables and even comments in the file stay as they are. That is the main reason to use it over a shell script that overwrites the whole file.
Your first switch
- Pick the tool in the sidebar (say, Claude Code).
- Click "+" in the top right and choose a preset, or create a custom config.
- Paste your API key and save.
- Select the provider and click "Enable".
Claude Code picks up the change without a restart. Codex, Gemini CLI and Grok Build need you to restart the terminal or the CLI. Claude Desktop needs a full quit and reopen.
You can also switch from the system tray, which shows one row per tool with its current mode, provider and quota.
To go back to your subscription, switch to the built-in "Claude Official" provider and run /login in Claude Code. For Codex, use "OpenAI Official" and codex login.
Use GPT, Gemini or a local model inside Claude Code
Claude Code speaks the Anthropic Messages format. Many providers, and most local model servers, only offer an OpenAI-style Chat Completions endpoint. CC Switch handles this with Routing mode: it runs a local router on your machine that converts between Anthropic Messages, OpenAI Chat Completions, OpenAI Responses and Gemini's native format.
To set it up:
- Edit the provider and open "Advanced Options".
- Set "Upstream Format" to match the provider: "OpenAI Chat Completions" for Chat Completions only services (many local servers), "OpenAI Responses API" for Responses endpoints, or "Gemini Native generateContent" for Gemini.
- On the Claude Code page, open the "Routing" tab and click "Start routing".
The README is direct about the failure mode: choosing the wrong format or forgetting to start routing usually gives you a 404 or 405.
While routing is on, your Claude Code config points at http://127.0.0.1:15721 with a placeholder key PROXY_MANAGED. That is expected. The real address and key live in CC Switch, and "Usage" in the sidebar shows "requested model to actual model" for each request. Quitting CC Switch writes your direct config back first, so Claude Code keeps working without it.
Routing also gives you auto-failover: set a queue of providers per tool, and when a request fails CC Switch moves to the next one. Note that official providers like Claude Official cannot go through routing.
Aggregation: several providers in one model picker
On the Claude Code and Codex pages there is also an "Aggregation" mode. Add a few providers and their models all appear in the tool's own model list, and each request goes to whichever provider owns the model you picked. Two caveats from the docs: aggregation does not do failover, and Claude Code needs version 2.1.243 or later. Switching models mid-session also rebuilds the prompt cache, so the first turn after a switch costs a bit more.
Gotchas
-
The model resets after a switch. The model is a key field that belongs to the provider. If you change it with
/modelinside Claude Code, it lasts until your next switch. To keep it, edit the provider in CC Switch. - "Connectivity check" passing does not mean your key works. It only checks the address is reachable. If requests fail, check the key, model name and upstream format, and read the request log under "Usage".
-
WSL on Windows. Point the tool's config folder at the WSL path (for example
\\wsl.localhost\Ubuntu\home\<user>\.claude) in "Settings, App config". For routing, switch WSL2 to mirrored networking, because127.0.0.1inside WSL cannot reach the router on Windows in the default NAT mode.
Bonus: one place for MCP, skills and prompts
CC Switch also has panels to add an MCP server or skill once and sync it to each tool, and a prompt library that writes to CLAUDE.md, AGENTS.md or GEMINI.md. Its usage dashboard tracks tokens, cache hit rate and spending per provider and model from each tool's local session logs, even with routing off.
CC Switch or a gateway?
CC Switch is for one developer on one machine who wants to flip providers without editing files. If you need a shared, server-side gateway for a team or an app, look at something like LiteLLM, which lets you call 100+ LLMs with one OpenAI-format API. We compare both kinds in the best AI repos for LLM gateways and routers.
The short version of this guide, with the exact steps and a prompt, lives on the Deduped page for switching Claude Code providers in one click.
Get one email every Monday with the week's hottest AI repos and exactly how to use them: subscribe free at dedupedai.com
Top comments (0)