Back to Home

CC-Switch

CC-Switch is an open-source desktop app (Windows / macOS / Linux) dedicated to managing multiple Claude Code and Codex CLI provider configs β€” one-click switching and one-click import. Tokensmart integrates deeply with it: a single click in the Tokensmart console pushes Tokensmart into CC-Switch as a ready-to-use provider.

πŸ’‘ Why CC-Switch: Claude Code and Codex live in env vars and config files, and editing those by hand to switch providers is tedious. CC-Switch centralizes every provider under one UI β€” one click swaps ~/.bashrc and ~/.codex/auth.json for you.

Step 1: Download CC-Switch

Grab the installer from GitHub Releases:

  • Windows: .exe or .msi
  • macOS: .dmg (watch Apple Silicon vs Intel)
  • Linux: .AppImage or .deb

Launch it once so it can register the ccswitch:// URL scheme with your OS.

Step 2: Import the Tokensmart provider

Option A β€” One-click (recommended)

  1. Sign in to Tokensmart, go to API Keys
  2. Pick the key you want, open the menu next to it and click Config Guide
  3. Select CC-Switch in the left pane of the modal
  4. Click Import to Claude Code or Import to Codex
  5. The browser prompts "Open CC-Switch?" β€” confirm
  6. CC-Switch comes to the foreground with Tokensmart already filled in

⚠️ Security note: One-click import hands your full key to the local app via the ccswitch:// scheme. Only use it on a personal device you trust; for shared / borrowed machines, fall back to Option B below. Reason: if a malicious app on the same machine has claimed the ccswitch:// scheme, it would also receive the key.

Option B β€” Manual configuration

If you would rather not use the URL scheme, or you missed the one-click window (it is only available at key creation time, because the key is masked afterwards):

  1. Open CC-Switch, click Add Provider, pick Custom
  2. Fill in:

Claude Code provider

FieldValue
NameTokensmart
API URLhttps://api.tokensmart.ai
API Keypk_live_xxxxxxxxxxxxxxxx
Default modelclaude-sonnet-4-6
Haiku mapping(leave blank)
Sonnet mappingclaude-sonnet-4-6
Opus mappingclaude-opus-4-8

Codex provider

FieldValue
NameTokensmart
API URLhttps://api.tokensmart.ai/v1
API Keypk_live_xxxxxxxxxxxxxxxx
Default modelgpt-5.4-mini
  1. Save and enable
  2. Restart your terminal so Claude Code / Codex pick up the new config CC-Switch wrote

Step 3: Verify

# Claude Code
claude "hi, tell me your model name"

# Codex CLI
codex "list files in this folder"

A normal response means you're set. From now on, toggling the provider list in CC-Switch flips you freely between Tokensmart, official Anthropic, official OpenAI, and any other providers you add.

Tokensmart tips

  • CC-Switch is just a config manager: it does not proxy traffic. It just edits ~/.bashrc and ~/.codex/ for you. When Tokensmart is active, requests go straight from your terminal to api.tokensmart.ai β€” no extra hop.
  • Switching provider does not touch Tokensmart balance: while you're on official Anthropic, those calls bill Anthropic directly. You only spend Tokensmart credits when Tokensmart is the active provider. Great for A/B comparison.
  • One Tokensmart key serves both providers: the Claude Code and Codex entries inside CC-Switch can share the same pk_live_* β€” Tokensmart keys speak both Anthropic and OpenAI protocols natively.
  • Share provider configs with teammates: CC-Switch can export a provider as JSON for colleagues to import directly β€” no need for each person to click through the Tokensmart console. (The export contains the key in cleartext; treat it like a secret.)

Troubleshooting

  • "Import" does nothing / browser says "Can't open link": CC-Switch is not installed, or the ccswitch:// scheme is not registered. Launch CC-Switch once and retry. Still broken? Use Option B.
  • Claude Code still uses the old key: env vars only load on terminal start. Restart the terminal (or source ~/.zshrc) after switching providers.
  • Codex reports "invalid wire_api": CC-Switch's Codex template defaults to responses, which Tokensmart expects. If you manually changed it, set it back to responses.
  • One-click buttons are greyed out: the key is already masked (pk_live_****xxxx), so the browser does not have the full value to pass along. Either one-click at creation time, or use Option B with the full key you saved.