MCPcopy Index your code
hub / github.com/SaladDay/cc-switch-cli

github.com/SaladDay/cc-switch-cli @v5.8.7

Chat with this repo
repository ↗ · DeepWiki ↗ · release v5.8.7 ↗ · + Follow
11,985 symbols 43,033 edges 376 files 690 documented · 6%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

CC-Switch CLI

Version Platform Built with Rust License

SaladDay%2Fcc-switch-cli | Trendshift

TUI + CLI dual-mode manager for Claude Code, Codex, Gemini, OpenCode, Hermes & OpenClaw

Use the interactive TUI for daily switching, account, and session work, or the CLI for scripts and repeatable terminal workflows.

Unified management for provider configurations, MCP servers, skills, prompts, local proxy routes, usage statistics, and environment checks across supported AI coding assistants.

English | 中文


📖 About

This project is a CLI fork of CC-Switch.

🔄 The WebDAV sync feature is fully compatible with the upstream project.

Credits: Original architecture and core functionality from farion1231/cc-switch

Changelog: CHANGELOG.md


❤️ Sponsor

ClaudeAPI Thanks to ClaudeAPI for supporting this project! ClaudeAPI is a Claude-focused API access provider built on official and AWS channels, offering high stability, low latency, and full support for Claude Code, Codex, Agent workflows, and enterprise use cases. It also supports business onboarding, team usage management, and invoicing. Exclusive offer for CC-Switch CLI users: register via this exclusive link to receive free trial credits and get started with Claude Code instantly.
Qiniu Cloud AI Thanks to Qiniu Cloud AI for sponsoring this project! Qiniu Cloud AI is an enterprise-grade large-model MaaS platform from Qiniu Cloud (HKEX: 02567), offering one-stop access to 150+ mainstream models worldwide, compatibility with the protocols of major global model vendors, and full-modality coverage across text, image, audio, video, and file processing — serving over 1.69 million enterprise and developer users. Exclusive benefits: enterprise users can claim 12 million free tokens, and referring friends can earn up to tens of billions of tokens. Register via this link.
Fenno.ai Thanks to Fenno.ai for sponsoring this project! Fenno.ai is a stable, efficient API relay provider currently focused on Codex relay. It is compatible with both the OpenAI and Anthropic protocols and plugs smoothly into mainstream coding tools such as Codex, Claude Code, and OpenCode, reliably sustaining enterprise workloads of hundreds of billions of tokens per day, with corporate (B2B) settlement and invoicing for both domestic and overseas entities. Exclusive benefit for CC-Switch CLI users: register via this link to subscribe to a great-value Coding Plan — ¥9.9 for $150 of credit — and earn up to a 20% reward for referrals; the more you invite, the more you get!
RunAPI Thanks to RunAPI for sponsoring this project! RunAPI is a fast, stable API platform and OpenRouter alternative. One API key gives access to 150+ mainstream models, including OpenAI, Claude, Gemini, DeepSeek, and Grok, with prices as low as 10% of the original cost. It works with tools such as Claude Code and OpenClaw. Exclusive benefit for cc-switch-cli users: register and contact the admin to claim CNY 7 in free credits.
Cubence Thanks to Cubence for sponsoring this project! Cubence is an API relay service provider dedicated to offering stable and efficient services to its customers. Operating since September 2025, it has provided support for various models such as Claude code, Codex, and Gemini. Register via this link and use the CCSCLI discount code when topping up to enjoy a 10% discount.
PackyCode Thanks to PackyCode for sponsoring this project! PackyCode is a reliable and efficient API relay service provider, offering relay services for Claude Code, Codex, Gemini, and more. PackyCode provides special discounts for our software users: register via this link and use promo code cc-switch-cli when recharging to get 10% off.
AICodeMirror Thanks to AICodeMirror for sponsoring this project! AICodeMirror provides official high-stability relay services for Claude Code / Codex / Gemini CLI, with enterprise-grade concurrency, fast invoicing, and 24/7 dedicated technical support. Claude Code / Codex / Gemini official channels at 38% / 2% / 9% of original price, with extra discounts on top-ups! AICodeMirror offers special benefits for cc-switch-cli users: register via this link to enjoy 20% off your first top-up, and enterprise customers can get up to 25% off!
DDS Thanks to DDS for sponsoring this project! DDS Hub is a reliable and high-performance Claude API proxy service. DDS Hub provides cost-effective domestic Claude direct acceleration services for both individual and enterprise users. We offer stable and low-latency Claude Max number pools, with full support for Claude Haiku, Opus, Sonnet and other flagship models. Invoices are available for recharges of 1000 RMB or more. Enterprise customers can also enjoy customized grouping and dedicated technical support services. Exclusive benefit for CC-Switch CLI users: register via this link and enjoy an extra 10% credit on your first recharge (please contact the group admin to claim after recharging)!

📸 Screenshots

Home

Home

Switch Settings
Switch Settings

🚀 Quick Start

TUI Mode (Recommended)

cc-switch

Use the full-screen interface to switch providers, manage accounts, review sessions, and inspect proxy status.

Command-Line Mode

cc-switch provider list              # List providers
cc-switch provider switch <id>       # Switch provider
cc-switch use <id>                   # Switch provider (shortcut)
cc-switch provider export <id>       # Export a Claude provider to a standalone settings file
cc-switch provider stream-check <id> # Check provider stream health
cc-switch start <claude|codex> <id> --dry-run # Preview launch
cc-switch auth list                  # List managed ChatGPT/Codex OAuth accounts
cc-switch sessions list --all        # Review saved assistant sessions
cc-switch sessions sync-usage --all  # Import local session token/cost usage
cc-switch config webdav show         # Inspect WebDAV sync settings
cc-switch env tools                  # Check local CLI tools
cc-switch mcp sync                   # Sync MCP servers
cc-switch proxy show                 # Inspect proxy routes and status

# Use the global `--app` flag to target specific applications:
cc-switch --app claude provider list    # Manage Claude providers
cc-switch --app codex mcp sync          # Sync Codex MCP servers
cc-switch --app gemini prompts list     # List Gemini prompts
cc-switch --app hermes provider list    # Manage Hermes providers
cc-switch --app openclaw provider list  # Manage OpenClaw providers

# Supported apps: `claude` (default), `codex`, `gemini`, `opencode`, `hermes`, `openclaw`

See the "Features" section for full command list.


📥 Installation

Method 1: Quick Install (macOS / Linux)

Windows users: see Manual Installation below.

curl -fsSL https://github.com/SaladDay/cc-switch-cli/releases/latest/download/install.sh | bash

This installs cc-switch to ~/.local/bin. Set CC_SWITCH_INSTALL_DIR to change the target directory.

  • If the target already exists, the installer prompts in TTY and refuses to overwrite in non-interactive shells unless CC_SWITCH_FORCE=1 is set.
  • On Linux, set CC_SWITCH_LINUX_LIBC=glibc if you need the glibc build.

Manual Installation

macOS

# Download Universal Binary (recommended, supports Apple Silicon + Intel)
curl -LO https://github.com/saladday/cc-switch-cli/releases/latest/download/cc-switch-cli-darwin-universal.tar.gz

# Extract
tar -xzf cc-switch-cli-darwin-universal.tar.gz

# Add execute permission
chmod +x cc-switch

# Move to PATH
sudo mv cc-switch /usr/local/bin/

# If you encounter "cannot be verified" warning
xattr -cr /usr/local/bin/cc-switch

Linux (x64)

# Download
curl -LO https://github.com/saladday/cc-switch-cli/releases/latest/download/cc-switch-cli-linux-x64-musl.tar.gz

# Extract
tar -xzf cc-switch-cli-linux-x64-musl.tar.gz

# Add execute permission
chmod +x cc-switch

# Move to PATH
sudo mv cc-switch /usr/local/bin/

Linux (ARM64)

# For Raspberry Pi or ARM servers
curl -LO https://github.com/saladday/cc-switch-cli/releases/latest/download/cc-switch-cli-linux-arm64-musl.tar.gz
tar -xzf cc-switch-cli-linux-arm64-musl.tar.gz
chmod +x cc-switch
sudo mv cc-switch /usr/local/bin/

Windows

# Download the zip file
# https://github.com/saladday/cc-switch-cli/releases/latest/download/cc-switch-cli-windows-x64.zip

# After extracting, move cc-switch.exe to a PATH directory, e.g.:
move cc-switch.exe C:\Windows\System32\

# Or run directly
.\cc-switch.exe

Method 2: Install via Homebrew

If you are using Homebrew on your machine, you can use Homebrew to install cc-switch.

brew install cc-switch-cli

Update:

brew upgrade cc-switch-cli

If you installed cc-switch via Homebrew, please use Homebrew to upgrade cc-switch, instead of the built-in update feature, as this breaks Homebrew formulae’s own upgrade functionality.

Method 3: Build from Source

Prerequisites: - Rust 1.85+ (install via rustup)

Build:

git clone https://github.com/saladday/cc-switch-cli.git
cd cc-switch-cli/src-tauri
cargo build --release

# Binary location: ./target/release/cc-switch

Install to System:

# macOS/Linux
sudo cp target/release/cc-switch /usr/local/bin/

# Windows
copy target\release\cc-switch.exe C:\Windows\System32\

✨ Features

🔌 Provider Management

Manage API configurations for Claude Code, Codex, Gemini, OpenCode, Hermes, and OpenClaw.

Features: One-click switching, standalone Claude settings export, multi-endpoint support, API key management, remote model discovery, and per-app diagnostics such as speed testing or stream health checks where supported.

```bash cc-switch provider list # List all providers cc-switch provider current # Show current provider cc-switch provider switch # Switch provider cc-switch use # Switch provider (shortcut) cc-switch provider add # Add new provider cc-switch provider edit # Edit existing provider cc-switch provider duplicate # Duplicate a provider cc-switch provider delete # Delete provider cc-switch provider

Extension points exported contracts — how you extend this code

Handler (Interface)
Server-side handler. The supervisor implements this to translate Requests into actions on its internal state (worker chi [2 …
src-tauri/src/daemon/ipc/server.rs
ProviderAdapter (Interface)
(no doc) [3 implementers]
src-tauri/src/proxy/providers/adapter.rs
AppToggleState (Interface)
(no doc) [3 implementers]
src-tauri/src/cli/tui/ui/overlay/pickers.rs
PermissionPrompter (Interface)
(no doc) [2 implementers]
src-tauri/src/config.rs
SessionCommandExt (Interface)
(no doc) [1 implementers]
src-tauri/src/cli/commands/sessions.rs

Core symbols most depended-on inside this repo

get
called by 2712
src-tauri/src/app_config.rs
is_chinese
called by 2367
src-tauri/src/cli/i18n.rs
is_empty
called by 1299
src-tauri/src/app_config.rs
on_key
called by 793
src-tauri/src/cli/tui/app/menu.rs
path
called by 721
src-tauri/src/daemon/pidfile.rs
as_str
called by 420
src-tauri/src/proxy/providers/mod.rs
as_str
called by 332
src-tauri/src/cli/tui/form.rs
push_toast
called by 313
src-tauri/src/cli/tui/app/menu.rs

Shape

Function 9,227
Method 1,977
Class 556
Enum 220
Interface 5

Languages

Rust99%
Python1%

Modules by API surface

src-tauri/src/cli/i18n.rs1,403 symbols
src-tauri/src/cli/tui/app/tests.rs503 symbols
src-tauri/src/cli/tui/ui/tests.rs266 symbols
src-tauri/src/services/proxy.rs240 symbols
src-tauri/src/cli/i18n/texts/core.rs209 symbols
src-tauri/src/cli/tui/data.rs201 symbols
src-tauri/src/cli/i18n/texts/providers.rs186 symbols
src-tauri/src/cli/tui/form/tests.rs167 symbols
src-tauri/src/cli/commands/provider_input.rs142 symbols
src-tauri/src/cli/i18n/texts/config_actions.rs137 symbols
src-tauri/src/cli/i18n/texts/toasts.rs131 symbols
src-tauri/src/cli/i18n/texts/provider_management.rs131 symbols

For agents

$ claude mcp add cc-switch-cli \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact