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)

  1. Install and launch CC Switch at least once so your OS registers the ccswitch:// URL scheme.
  2. 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 or Claude Official (see Claude Code API Guide);
    • For Codex CLI: pick Codex (Codex Only) or Codex Pro (External) (see Codex API Guide);
    • For Gemini CLI: pick a Gemini channel group.
  3. Click the Use / Import action next to your key, choose the target tool, and click Import to CC Switch.
  4. 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 claude or codex.

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):
Claude Code Base URL (no /v1)
1https://api.zhenapi.ai
  • Model (Optional): copy a model ID from Pricing, such as claude-fable-5-2, claude-opus-5-5 or claude-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 API responses):
Codex Base URL (with /v1)
1https://api.zhenapi.ai/v1

Reference ~/.codex/config.toml snippet written by CC Switch:

~/.codex/config.toml
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

SymptomCauseFix
Clicking "Import to CC Switch" does nothingCC 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 terminalRunning 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 ForbiddenKey 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.