Skip to content

cc-switch

cc-switch is an open-source desktop tool for managing multi-provider Claude/Codex configurations (Tauri, cross-platform). It stores multiple API configurations as a set of "providers" and lets you switch the active provider with one click from the system tray, sparing you the hassle of manually editing ~/.claude/settings.json / environment variables.

Who it's for: developers who simultaneously use the official Anthropic endpoint + a third-party relay + a self-hosted gateway, or who frequently switch between "budget", "primary", and "fallback" options.

This guide: add claude-api.org to cc-switch so you can use the Anthropic protocol for Claude Code and the OpenAI protocol for Codex CLI / opencode.

Choose based on the client you want to switch to:

  • Claude Code CLI / Claude Code IDE pluginClaude Official (Claude Code only) (1.4x, all models, high-quality upstream) or Claude Sonnet Discount (0.5x, Sonnet only)
  • opencode / Cline calling Claude / custom Anthropic SDKClaude Official (any client) (2.0x) or Budget Claude (0.5x, relatively unstable quality)
  • Codex CLI / Cursor / Cline calling GPT / ChatboxOpenAI
  • Gemini CLIGemini

Installation

Go to farion1231/cc-switch releases and download the installer for your system:

  • Windows: *.msi / *.exe
  • macOS: *.dmg (choose x64 for Intel, aarch64 for Apple Silicon)
  • Linux: *.AppImage / *.deb

On first launch it creates a configuration directory at ~/.cc-switch/.

Add claude-api.org as a provider

cc-switch main screen → on the left, select the client you want to switch (Claude Code / Codex / opencode / Gemini) → "Add" in the top right.

For Claude Code (Anthropic protocol)

FieldValue
Nameclaude-api.org (anything you like, for easy identification)
Base URLhttps://claude-api.org
API Keysk-你的key (from the dashboard → API Keys)

The "root" is enough — do not add /v1

By default, cc-switch automatically appends the protocol path to base_url (e.g. /v1/messages). So enter only the root domain, without /v1. Only if your version is ≥ v3.13.0 and you have enabled "Full URL Mode" do you need to enter the complete endpoint.

cc-switch writes this configuration into the env field of ~/.claude/settings.json, equivalent to:

json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://claude-api.org",
    "ANTHROPIC_AUTH_TOKEN": "sk-你的key"
  }
}

For Codex CLI / opencode (OpenAI protocol)

FieldValue
Nameclaude-api.org
Base URLhttps://claude-api.org (same as above, without /v1)
API Keysk-你的key

Codex works with either the Anthropic protocol or the OpenAI protocol, but our OpenAI Channel supports both the ChatCompletions and Responses protocols, so pointing Codex there is the most hassle-free option.

Switch + apply

In the cc-switch main panel, click the newly created provider → "Apply" / "Set as current".

Claude Code does not reload automatically

After switching you must restart the Claude Code CLI (Ctrl+C to quit, then reopen) before the environment variables pick up the new values. The same applies to the Codex CLI.

After switching, check the tray icon — it shows the name of the currently active provider; confirm it's the one you just selected.

Verification

Run this in any terminal (replace sk-):

bash
curl -sS https://claude-api.org/v1/messages \
  -H "x-api-key: sk-你的key" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{"model":"claude-sonnet-4-6","max_tokens":32,"messages":[{"role":"user","content":"ping"}]}'

A 200 + JSON response means setup succeeded. You can also just send a Hello from within Claude Code and check the reply.

FAQ

I switched, but Claude Code is still using the old provider

  • Not restarted: Claude Code reads the env / settings.json once at process startup; changes made while it's running don't take effect on the fly — press Ctrl+C to quit and reopen
  • System-level environment variable override: if your shell rc (~/.zshrc / ~/.bashrc / Windows PowerShell $PROFILE) already sets ANTHROPIC_AUTH_TOKEN, it takes priority over cc-switch's settings.json. Fix: remove it from the rc, or keep only cc-switch as the single source

Getting a 401

  • The key was copied with a space → copy it again
  • The key's bound Channel doesn't match the client → Claude Code CLI must be bound to Claude Official (Claude Code only) or Claude Sonnet Discount; non-CC clients calling Claude must be bound to Claude Official (any client); the Codex CLI must be bound to OpenAI
  • The key was deleted/regenerated in the dashboard → create a new one and fill it back in

Getting 503 No available accounts

Wrong model name. We have no short-name fallbackgpt-5 will not automatically fall back to gpt-5.4; it returns 503 directly. See Channels & Pricing for the exact model names each Channel supports.

claude-sonnet-4-6 / gpt-5.4 isn't in the model dropdown

cc-switch's model field is free-text; just type the exact name directly — no need to pick from a dropdown.

404 after setting Base URL to https://claude-api.org/v1

cc-switch's default behavior appends the protocol path again, producing /v1/v1/messages. Two fixes:

  • Change the Base URL back to the root https://claude-api.org (recommended)
  • Enable "Full URL Mode" in cc-switch v3.13.0+, then enter the complete endpoint (not recommended — easy to get wrong)

Advanced

Managing several keys for different identities/wallets at once

This is one of cc-switch's strengths. Create several keys in the dashboard (e.g. "My Cursor", "Company Claude Code", "Budget testing"), bind each key to a different Channel, create one provider per key in cc-switch, and switch in seconds. Far more elegant than editing environment variables directly.

Pairing with the one-click install script

If you only want to run Claude Code and don't want to use cc-switch, just use our one-click script:

bash
curl -fsSL https://claude-api.org/install.sh | bash -s -- "sk-你的key"

After it writes to your shell rc, reopen the terminal and you're done. If you later want to add multiple providers, install cc-switch then.

References

For more setup error codes, see the FAQ.

This site is an API reverse-proxy service, not affiliated with Anthropic / OpenAI / Google.