Client setup
CC Switch Setup Guide
One-click ccswitch:// deep-link import from the ZhenAPI Console, or manual multi-profile setup for Claude Code, Codex CLI and Gemini CLI.
CC Switch is an open-source cross-platform provider switcher for Windows, macOS and Linux that manages API profiles across Claude Code, Codex CLI, Gemini CLI and OpenCode. The ZhenAPI Console supports native ccswitch:// deep-link import so you can add providers without editing config files by hand.
Windows Tip: On Windows, you can also use our official ZhenAPI Desktop Toolkit, which adds browser-based authorization, encrypted config backups, one-click rollback, and support for 13 AI coding tools including Cline, Cherry Studio and Cursor.
Option 1: One-Click Deep-Link Import from Console (Recommended)
- Install and launch CC Switch at least once so your OS registers the
ccswitch://URL scheme. - Sign in to the ZhenAPI Console, open API Keys, and create a key bound to the matching channel group:
- For Claude Code: pick
Claude Max (CC Only)for maximum savings orClaude Official(see Claude Code API Guide); - For Codex CLI: pick
Codex (Codex Only)orCodex Pro (External)(see Codex API Guide); - For Gemini CLI: pick a
Geminichannel group.
- For Claude Code: pick
- Click the Use / Import action next to your key, choose the target tool, and click Import to CC Switch.
- Approve the browser prompt to open CC Switch, confirm the pre-filled Base URL, API key and default model, click Enable, and open a new terminal session to run
claudeorcodex.
Option 2: Add a Provider Manually in CC Switch
Open CC Switch, select the target CLI tab at the top, and click + Add Provider with the settings below:
1. Claude Code Tab (Anthropic Messages Protocol)
- Provider Name:
ZhenAPI Claude - API Key / Auth Token: your Claude group
sk-...key - Base URL (do NOT append
/v1):
1https://api.zhenapi.ai
- Model (Optional): copy a model ID from Pricing, such as
claude-fable-5-2,claude-opus-5-5orclaude-sonnet-4-6.
2. Codex Tab (OpenAI Responses Protocol)
- Provider Name:
ZhenAPI Codex - API Key: your Codex / OpenAI group
sk-...key - Base URL (include
/v1, wire APIresponses):
1https://api.zhenapi.ai/v1
Reference ~/.codex/config.toml snippet written by CC Switch:
1model_provider = "zhenapi"
2model = "gpt-6.2-sol"
3
4[model_providers.zhenapi]
5name = "ZhenAPI"
6base_url = "https://api.zhenapi.ai/v1"
7wire_api = "responses"
3. Gemini CLI Tab (Gemini Native Protocol)
- Base URL:
https://api.zhenapi.ai(no/v1) - API Key: your Gemini group
sk-...key
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| Clicking "Import to CC Switch" does nothing | CC Switch has not registered the ccswitch:// handler yet, or the browser blocked external protocol launch. | Launch CC Switch once first, allow external app launch in your browser address bar, or copy the parameters manually using Option 2. |
| Switching provider in CC Switch does not affect an open terminal | Running CLI sessions read configuration and environment variables at startup. | Exit your active claude / codex session and open a fresh terminal window. |
404 Not Found | /v1 was added to Claude/Gemini Base URL, or omitted from Codex/OpenCode Base URL. | Use https://api.zhenapi.ai for Claude Code & Gemini CLI, and https://api.zhenapi.ai/v1 for Codex & OpenCode. |
403 Forbidden | Key group does not match the client (e.g., using a "CC Only" key inside OpenCode, or a Codex key inside Claude Code). | Edit the key's group on the API Keys page. See Error Codes for details. |