CC Switch CLI Tool
When you work on remote Linux servers, SSH devboxes, Docker containers, CI runners, or WSL2 without a graphical desktop, you can manage RKAPI provider profiles straight from the terminal using the cc-switch command-line utility.
When to Use the CLI
- Headless Linux servers & SSH sessions: Switch Claude Code or Codex providers over SSH without manually editing
~/.claude/settings.jsonor~/.codex/config.toml. - WSL2 environments: Manage Linux-side coding tools independently from Windows desktop installations.
- Repeatable workstation setup: Import a saved RKAPI profile bundle on a new dev machine in seconds.
- Automated workflows: Script profile changes before running batch coding tasks or benchmark suites.
Installation
Install the cc-switch CLI matching your platform from the official CC Switch CLI release channel:
Prebuilt Binary (Linux / macOS / WSL)
- Download the archive for your OS and architecture (
linux-x86_64,linux-aarch64,darwin-arm64, ordarwin-x86_64) from the official releases page. - Extract the binary into a directory on your
PATH(for example,~/.local/binor/usr/local/bin):
chmod +x cc-switch
mkdir -p ~/.local/bin
mv cc-switch ~/.local/bin/cc-switch- Verify the installation:
cc-switch --version
cc-switch --helpCargo / Package Managers
If you maintain a Rust toolchain or use a supported package manager (such as Homebrew on macOS/Linux):
# Example via Homebrew (when tap/formula is enabled)
brew install cc-switch
# Or inspect available subcommands immediately after install
cc-switch --helpSubcommand Names Across Versions
CLI flags can evolve slightly between CC Switch CLI releases. Run cc-switch --help and cc-switch <subcommand> --help to confirm the exact flag names on your installed version.
Core CLI Workflows with RKAPI
1. List Available Profiles
Inspect saved providers for each supported client:
# List Claude Code profiles
cc-switch list --app claude
# List Codex CLI profiles
cc-switch list --app codex2. Add RKAPI Profiles
Register profiles with the exact RKAPI Base URL for each client protocol:
- Claude Code (Anthropic Messages — no
/v1):- Base URL:
https://api.zwwbai.com - Auth Token:
sk-your-api-key
- Base URL:
- Codex CLI (OpenAI Responses — must include
/v1):- Base URL:
https://api.zwwbai.com/v1 - API Key:
sk-your-api-key - Wire API:
responses
- Base URL:
# Interactive add wizard (recommended so your API key is not saved in shell history)
cc-switch add --app claude
cc-switch add --app codexKeep API Keys Out of Shell History
Prefer interactive prompts or file import over passing raw sk-... keys as command-line arguments. If you ever pass a key on the command line in Bash/Zsh, prefix the line with a leading space (when HISTCONTROL=ignorespace is active) or clear the history entry afterward.
3. Switch the Active Provider
Activate a saved profile by name (<profile-name>):
# Activate RKAPI for Claude Code
cc-switch use --app claude "<profile-name>"
# Activate RKAPI for Codex CLI
cc-switch use --app codex "<profile-name>"4. Inspect Active Configuration
Confirm which profile is active and verify the rendered native config files:
# Show current active providers
cc-switch status
# Inspect generated client files directly
cat ~/.claude/settings.json
cat ~/.codex/config.toml5. Export & Import Profiles Across Machines
Export your curated RKAPI profiles on your main laptop and import them onto a remote server or WSL environment:
# On your source machine: export profiles to a JSON bundle
cc-switch export -o cc-switch-profiles.json
# Transfer securely over SSH
scp cc-switch-profiles.json <user>@<remote-host>:~/
# On the remote server: restrict permissions, import, then delete the transfer file
chmod 600 ~/cc-switch-profiles.json
cc-switch import ~/cc-switch-profiles.json
rm -f ~/cc-switch-profiles.jsonAlso ensure the resulting credential files stay readable only by your user account:
chmod 600 ~/.claude/settings.json ~/.codex/auth.json 2>/dev/null || trueChecking for Shell Environment Variable Conflicts
Remote servers, Docker images, tmux sessions, and VS Code Remote containers frequently inherit exported ANTHROPIC_* or OPENAI_* variables from dotfiles or container build args. Because environment variables override config files written by cc-switch, always run this quick check if switching profiles seems to have no effect:
env | grep -E '^(ANTHROPIC|OPENAI|GEMINI|CLAUDE)_'If any variables appear:
Search where they are defined:
bashgrep -rnE '(ANTHROPIC|OPENAI|GEMINI)_(BASE_URL|API_KEY|AUTH_TOKEN)' \ ~/.bashrc ~/.zshrc ~/.profile ~/.bash_profile /etc/environment 2>/dev/nullRemove or comment out the conflicting lines.
For the current session, clear them immediately with
unset:bashunset ANTHROPIC_BASE_URL ANTHROPIC_AUTH_TOKEN ANTHROPIC_API_KEY unset OPENAI_BASE_URL OPENAI_API_KEYIf you work inside
tmuxorscreen, remember that existing panes retain old environment variables until you open a fresh session or update thetmuxglobal environment.
Verifying Connectivity from Headless Hosts
After activating your RKAPI profile via cc-switch:
# Quick network check against the RKAPI API gateway
curl -I https://api.zwwbai.com
# Test Claude Code or Codex CLI
claude --version
codex --versionThen run a short prompt and confirm the call shows up in https://s2pbxm0xv5y.adtyai-fz.top/usage-logs.
Related Guides
- Common Configuration — URL conventions, proxy settings, and multi-profile hygiene.
- Claude Code Setup — Detailed Claude Code
settings.jsonlayout. - Codex CLI Setup — Detailed Codex
config.tomlandauth.jsonlayout. - Usage & Balance Query — Checking remaining quota via API and console.