Skip to content

CC Switch

CC Switch is an open-source desktop tool (farion1231/cc-switch) for managing and switching API provider settings in coding tools such as Claude Code and Codex CLI. It edits each tool’s config files for you.

Official links: Releases · README · User Manual. The steps below follow the official README (latest release when checked: v4.0.39). Treat {version} in file names as whatever the Releases page shows.

Requirements: Windows 10 or later; macOS 12 or later; Linux on x86_64 or ARM64 with glibc 2.35+ and WebKitGTK 4.1 (for example Ubuntu 22.04+ or Debian 12+).

Download one of these from the Releases page:

  • Installer: CC-Switch-v{version}-Windows.msi
  • Portable: CC-Switch-v{version}-Windows-Portable.zip
  • Windows on ARM: CC-Switch-v{version}-Windows-arm64.msi or -Windows-arm64-Portable.zip

Homebrew is recommended:

终端窗口
brew install --cask cc-switch

Upgrade with brew upgrade --cask cc-switch.

Or download CC-Switch-v{version}-macOS.dmg (recommended) or the .zip from Releases. It is a Universal build for Apple Silicon and Intel. The README says the macOS build is code-signed and notarized by Apple, so you can open it directly.

Download the package for your architecture from Releases:

  • Debian / Ubuntu: CC-Switch-v{version}-Linux-x86_64.deb (ARM64: -Linux-arm64.deb)
  • Fedora and other RPM distros: CC-Switch-v{version}-Linux-x86_64.rpm (ARM64: -Linux-arm64.rpm)
  • Any other distro: CC-Switch-v{version}-Linux-x86_64.AppImage (ARM64: -Linux-arm64.AppImage)

On Arch Linux the README suggests paru -S cc-switch-bin.

  • Claude Code and/or Codex CLI is installed (see their official docs).
  • You have created a token in the console, and its group has models for the right endpoint type: Anthropic for Claude Code, Responses for Codex. Filter by endpoint type on the pricing page.
  • sk-xxxx below is a placeholder. Use your own token, and never share it or commit it to a repository.

Option 1: one-click import from the console

Section titled “Option 1: one-click import from the console”
  1. Install CC Switch and open it.
  2. On the API Keys page in the console (/keys), find the token you want to use and choose CC Switch from its action menu.
  3. Pick which tool to import into (for example Claude or Codex) and confirm. CC Switch opens an import confirmation; check the contents and confirm.

The Application option in the Import to CC Switch dialog offers Claude, Claude Desktop, Codex and Gemini. When you choose Claude Desktop:

  • It needs CC Switch v4.0.26 or later (v4.0.39 or later recommended).
  • If every model name you fill in looks like claude-sonnet-*, claude-opus-*, claude-haiku-* or claude-fable-* (without [1m]), it imports as direct and CC Switch can exit. Otherwise it imports as a mapping and CC Switch must keep running.
  • Fully restart Claude Desktop after importing.
  • It has no “Usage shown in CC Switch” choice.

After importing, skip to Enable and verify.

The flow in CC Switch (official manual: 2.1 Add Provider): select the tool in the sidebar, click + (Add Provider) at the top right, choose “Custom Configuration”, then fill in the form. Exact field labels follow the interface you actually see.

  1. Select Claude Code in the sidebar, click +, choose Custom Configuration.
  2. Fill in:
Item Value
Name OpenPalmLab
Request URL / Base URL https://api.openpalm.ai (do not add /v1; Claude Code appends /v1/messages itself)
API Key sk-xxxx
Model A model on the pricing page that supports the Anthropic endpoint; may be left empty
  1. If the screen is a JSON editor, the content is equivalent to:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.openpalm.ai",
"ANTHROPIC_AUTH_TOKEN": "sk-xxxx"
}
}

The official manual lists both ANTHROPIC_API_KEY and ANTHROPIC_AUTH_TOKEN as ways to authenticate; set only one. The gateway accepts both, see Claude Code.

  1. Pick a model: if Claude Code’s default model isn’t in your group, enter a model name in the form, or use the fetch-models button next to the model field (the official docs say it calls /v1/models with your key; follow the actual interface).
  2. Save.

This has the same effect as configuring Claude Code by hand: CC Switch writes ANTHROPIC_BASE_URL and the token into Claude Code’s settings.

  1. Select Codex in the sidebar, click +, choose Custom Configuration.
  2. Fill in:
Item Value
Name OpenPalmLab
Base URL https://api.openpalm.ai/v1 (for Codex the /v1 is required)
API Key sk-xxxx
Model / Model Mapping A model on the pricing page that supports the Responses endpoint (see the note below)
  1. If the screen is the two-part auth.json + config.toml editor (as in the official manual), the content looks roughly like this. In config.toml change only base_url and model (and the name); keep the other lines the editor already has (for example the preset’s requires_openai_auth = true) instead of replacing the whole block:
{
"OPENAI_API_KEY": "sk-xxxx"
}
model_provider = "openpalmlab"
model = "YOUR_MODEL"
[model_providers.openpalmlab]
name = "OpenPalmLab"
base_url = "https://api.openpalm.ai/v1"
wire_api = "responses"
requires_openai_auth = true

model_provider must match the name in [model_providers.xxx]. Per the official docs, when you switch to a third-party provider the key is written to that provider’s experimental_bearer_token in ~/.codex/config.toml, not to auth.json. Unlike the env_key approach in Codex CLI by hand, you don’t need to set that environment variable when using CC Switch.

  1. Pick a model: use the fetch-models button or type a model name. The form for non-official Codex providers has a Model Mapping table (official manual 2.1) that is the only source of the model list in Codex’s /model command: put the model name from the pricing page in “Actual Request Model”; “Menu Display Name” is what /model shows; if “Default Model” is empty, the first row is used. Entering a model name without adding it to the table may leave it missing from /model. Restart Codex after changes.
  2. Save.
  1. Back in the tool’s provider list, select the new OpenPalmLab entry and click Enable. You can also switch from the system tray menu by clicking the provider name.
  2. When it takes effect (official README): Claude Code needs no restart; for Codex, restart your terminal or the CLI.
  3. Verify:
终端窗口
claude
# or
codex "list the files in this directory"

If it replies normally and the console Usage Logs page shows a request record for that token, the setup works. To go back to the official login, switch to the built-in official provider in the list, restart the tool, and follow its login flow.

A CC Switch provider can have a usage script, which shows balance or subscription usage on the provider card.

  • Choose it during one-click import: the import dialog in Option 1 has Usage shown in CC Switch with Balance or Subscription (available for Claude Code and Codex). It defaults to Subscription when your account has an active subscription, otherwise Balance. The matching usage script is written into CC Switch with the import.
  • Copy the script when adding by hand: in the usage dialog on the console My Subscriptions page, click Copy CC Switch usage script and paste it as the custom usage script of that provider in CC Switch (the exact place depends on the CC Switch UI). The script uses the provider’s own token and only sends GET requests. For the subscription itself, see the console My Subscriptions page.
Symptom What to do
401 Token wrong, expired or out of quota. Recheck the API Key in CC Switch.
404 Wrong path form: no /v1 for Claude Code, with /v1 for Codex.
No available channel for model ... No channel for that model in the group. Pick another model or token group.
Nothing changed after switching Codex needs a terminal or CLI restart; confirm the OpenPalmLab entry is the enabled one.
127.0.0.1 and PROXY_MANAGED in the config file CC Switch’s “Routing” mode is on, so requests go to a local proxy first. Connecting directly to OpenPalmLab doesn’t need it; click “Back to direct” on that tool’s page (clicking only the “Direct” tab at the top just changes what you are viewing and does not change the configuration).

More in Errors and troubleshooting.