Page summary

Choose the active provider for Claude Code and other supported AI coding tools.

Key takeaways
  • Select the active Claude Code provider from the desktop app.
  • Avoid repeating provider edits across shell profiles or project files.
  • Use this page before configuring local routing or failover.

2.2 Switch Provider

Connection Modes

At the top of the app page for Claude Code, Codex, Gemini CLI, and Grok Build there are three tabs: "Direct / Routing / Aggregation" (only Claude Code and Codex have Aggregation):

ModeHow requests travelSwitching providers
DirectThe client connects to the provider directlyRewrites the key fields in the client's config file
RoutingRequests go through CC Switch on your machine first, which can convert formats and fail overChanges only the routing target; the config file is no longer rewritten
AggregationRequests are split across several providers according to the model picked in /model; no failoverSwitching changes the default provider

Clicking a tab only views that page; it does not change your configuration. To actually change modes, click the button on the page that spells out the consequences: "Start routing", "Switch to Aggregation", or "Back to direct". The "active" marker next to a tab shows which mode is actually in effect. For details on Routing and Aggregation, see 4.2 App Routing.

The most common case, switching in Direct mode, comes first.

Switch from Main Interface

On the Direct page, click the "Switch" button on the target provider card.

OpenCode, OpenClaw, Hermes, Pi, and MiniMax Code are coexist apps that can have several providers added at the same time; see Coexist Apps below for how they work. Claude Desktop has no mode tabs; see 2.6 Claude Desktop.

Switching Flow

  1. Click the "Switch" button
  2. CC Switch updates the configuration file
  3. The button on the card changes to the "In use" state
  4. The change takes effect in the way each app supports (see "Activation Methods" below)

Status Indicators

StatusDisplayDescription
In useDirect-colored border + "In use"In Direct mode, the provider currently in the config file
RoutingRouting-colored border + "Routing"In Routing mode, the provider actually forwarding requests
Current defaultAggregation-colored border + "Current default"The default provider in Aggregation mode
NormalDefault styleOther providers

The buttons on the cards follow the mode:

Quick Switch via System Tray

Quickly switch providers via the system tray without opening the main interface.

Steps

  1. Right-click the CC Switch icon in the system tray
  2. Hover over the corresponding app submenu
  3. Click the provider name you want to switch to
  4. Switching completes with a brief tray notification (for example "Claude Code switched to xxx. Restart Claude Code to apply")

Tray Menu Structure

The tray has one submenu row for each switch-style app:

SubmenuDescription
Claude CodeThat app's providers
Claude DesktopThat app's providers; providers in model mapping mode carry " · Model mapping"
CodexThat app's providers
Gemini CLIThat app's providers
Grok BuildThat app's providers

The submenu title looks like "App name · [Routing / Aggregation ·] provider in use · quota summary", so you can see which provider is in use and which mode it is in without opening it. What the submenu does follows the current mode:

The tray holds only these five switch-style apps; use the main interface for coexist apps.

💡 Tip: The combination of background residency + Lightweight Mode + tray submenus is especially suited for heavy users who frequently switch among multiple apps. See 1.5 Personalization → Lightweight Mode.

Activation Methods

Claude Code

Takes effect immediately after switching, no restart needed.

Claude Code supports hot reload and automatically detects configuration file changes and reloads.

Claude Desktop

Restart Claude Desktop after switching. Providers in "Model Mapping" mode also need CC Switch to keep running; see 2.6 Claude Desktop for details.

Codex

Requires a restart after switching: for the CLI, quit and run codex again; for the desktop app, quit completely (⌘Q on macOS) and reopen it.

Gemini CLI

Requires a restart after switching: quit Gemini CLI and run gemini again. A notification appears when the switch succeeds.

Gemini CLI reads .env and settings.json at startup, so a running session doesn't pick up the new key, endpoint, or model.

Grok Build

Restart Grok Build after switching; a notification appears when the switch succeeds.

In Routing and Aggregation Modes

Requests are all forwarded through CC Switch. On the Routing page, switching providers changes only the routing target and applies to subsequent requests immediately; if the switch changes the model, Codex, Gemini CLI, and Grok Build may still need a restart.

While routing is on, the provider you were using in Direct mode stays the same (labeled "Used when direct" on its card), and the config file is written back to it once you return to Direct.

In Aggregation mode, changes to the aggregated model list take effect immediately in Claude Code; Codex needs a full restart to see the new model list: for the CLI, click "Restart Codex daemon" in the page prompt (this interrupts running tasks); for the desktop app, quit completely with ⌘Q and reopen it; for editor plugins, reopen the window.

Routing and Aggregation need CC Switch to keep running. Quitting CC Switch automatically returns to Direct, and it reconnects on the next launch. See 4.2 App Routing for details.

Configuration File Changes

When switching providers, CC Switch replaces only the key fields in the following files: the endpoint, key, model name, API protocol, and a few compatibility options that belong to the provider (such as the context window). Plugins, hooks, permissions, MCP, settings you added yourself, comments, and formatting all stay as they are. For exactly which keys each file changes, see 5.1 Configuration Files.

Claude

~/.claude/settings.json

Modified content (only the key fields are shown; nothing else in the file is touched):

{
  "env": {
    "ANTHROPIC_API_KEY": "new API Key",
    "ANTHROPIC_BASE_URL": "new endpoint"
  }
}

Codex

~/.codex/config.toml

A third-party provider's API Key is written to that provider's experimental_bearer_token in config.toml, not to ~/.codex/auth.json. auth.json is used only for the official OpenAI ChatGPT login: whether it is kept when you switch to a third-party provider is controlled by "Keep official login for direct switches" under "Settings → App config". Providers with a model mapping also generate ~/.codex/cc-switch-model-catalog.json.

Gemini

~/.gemini/.env
~/.gemini/settings.json

In .env, only the key-field lines change; in settings.json, only the auth method (security.auth.selectedType) and the model name (model.name) change.

Grok Build

~/.grok/config.toml

Only the default model (default under [models]) and the [model."<name>"] table that CC Switch writes change.

Claude Desktop

Writes Claude Desktop's 3P profile configuration (on macOS under ~/Library/Application Support/Claude-3p/). Providers in Direct mode have their endpoint and key written straight in; providers in model mapping mode point at the local routing service. See 2.6 Claude Desktop for details.

Coexist Apps

OpenCode, OpenClaw, Hermes, Pi, and MiniMax Code let multiple providers be written into the tool's own configuration at the same time, and you choose which one to use inside the tool:

AppButtonsWritten to
OpenCodeAdd / Remove~/.config/opencode/opencode.json
OpenClawAdd / Remove~/.openclaw/openclaw.json
HermesAdd / Removecustom_providers in ~/.hermes/config.yaml
PiEnable / Remove~/.pi/agent/models.json
MiniMax CodeAdd / Removecustom_provider in ~/.minimax/config.yaml

After adding:

Coexist apps do not support tray switching or the failover queue. In most cases you can delete a provider directly, with these exceptions:

Handling Switch Failures

If switching fails, possible reasons:

Configuration File Is Locked

Another program is using the configuration file.

Solution: Close the running CLI tool and try switching again.

Insufficient Permissions

No write permission to the configuration file.

Solution: Check the permission settings of the configuration directory.

Invalid Configuration Format

The provider's JSON configuration has format errors.

Solution: Edit the provider, check and fix the JSON format.