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
~/.bashrcand~/.codex/auth.jsonfor you.
Step 1: Download CC-Switch
Grab the installer from GitHub Releases:
- Windows:
.exeor.msi - macOS:
.dmg(watch Apple Silicon vs Intel) - Linux:
.AppImageor.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)
- Sign in to Tokensmart, go to API Keys
- Pick the key you want, open the menu next to it and click Config Guide
- Select CC-Switch in the left pane of the modal
- Click Import to Claude Code or Import to Codex
- The browser prompts "Open CC-Switch?" β confirm
- 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 theccswitch://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):
- Open CC-Switch, click Add Provider, pick Custom
- Fill in:
Claude Code provider
| Field | Value |
|---|---|
| Name | Tokensmart |
| API URL | https://api.tokensmart.ai |
| API Key | pk_live_xxxxxxxxxxxxxxxx |
| Default model | claude-sonnet-4-6 |
| Haiku mapping | (leave blank) |
| Sonnet mapping | claude-sonnet-4-6 |
| Opus mapping | claude-opus-4-8 |
Codex provider
| Field | Value |
|---|---|
| Name | Tokensmart |
| API URL | https://api.tokensmart.ai/v1 |
| API Key | pk_live_xxxxxxxxxxxxxxxx |
| Default model | gpt-5.4-mini |
- Save and enable
- 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
~/.bashrcand~/.codex/for you. When Tokensmart is active, requests go straight from your terminal toapi.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 toresponses. - 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.