### Usage After Install - ccm and ccc examples Source: https://github.com/foreveryh/claude-code-switch/blob/main/docs/PLAN_B_IMPLEMENTATION_COMPLETE.md Demonstrates the two primary methods of using the tool after installation: using `ccm` for environment management followed by manual launch, and using `ccc` for a one-step switch and launch. ```bash # Method 1: Use ccm to switch, then manually launch ccm deepseek claude # Method 2: Use ccc to switch and launch in one step (recommended) ccc deepseek # With Claude Code options ccc opus --dangerously-skip-permissions ``` -------------------------------- ### Development Setup for Claude Code Switch Source: https://github.com/foreveryh/claude-code-switch/blob/main/README.md Instructions for cloning the repository and testing the CCM script locally without installation. Use `./ccm.sh help` to see available commands. ```bash git clone https://github.com/foreveryh/claude-code-switch.git cd claude-code-switch ./ccm.sh help # Test locally without installing ``` -------------------------------- ### Installation and Shell Configuration Source: https://github.com/foreveryh/claude-code-switch/blob/main/CLAUDE.md Installs the CCM tool and sources the shell configuration to enable installed functions. ```bash ./install.sh source ~/.zshrc ``` -------------------------------- ### Local Install CCM from Repository Source: https://context7.com/foreveryh/claude-code-switch/llms.txt Installs CCM by cloning the repository and running the local installation script. Remember to reload your shell afterwards. ```bash # Clone and install locally git clone https://github.com/foreveryh/claude-code-switch.git cd claude-code-switch ./install.sh # Reload shell source ~/.zshrc ``` -------------------------------- ### CCM Configuration File Example Source: https://github.com/foreveryh/claude-code-switch/blob/main/README.md Example of the `~/.ccm_config` file, showing settings for language, API keys, and model ID overrides for various providers. ```bash # Language (en or zh) CCM_LANGUAGE=en # API Keys (required for each provider) DEEPSEEK_API_KEY=sk-... KIMI_API_KEY=... GLM_API_KEY=... QWEN_API_KEY=... MINIMAX_API_KEY=... ARK_API_KEY=... OPENROUTER_API_KEY=... CLAUDE_API_KEY=... # Model ID Overrides (optional) DEEPSEEK_MODEL=deepseek-chat KIMI_MODEL=kimi-k2.5 KIMI_CN_MODEL=kimi-k2.5 QWEN_MODEL=qwen3-max-2026-01-23 GLM_MODEL=glm-5 MINIMAX_MODEL=MiniMax-M2.5 SEED_MODEL=ark-code-latest CLAUDE_MODEL=claude-sonnet-4-5-20250929 OPUS_MODEL=claude-opus-4-6 HAIKU_MODEL=claude-haiku-4-5-20251001 ``` -------------------------------- ### Installation Script - Fresh Install Steps Source: https://github.com/foreveryh/claude-code-switch/blob/main/docs/PLAN_B_IMPLEMENTATION_COMPLETE.md These bash commands outline the steps for a fresh installation of the Claude Code Switch tool, including making scripts executable and reloading the shell. ```bash # 1. Clone or download the project cd /Users/peng/Dev/Projects/Claude-Code-Switch # 2. Make scripts executable chmod +x install.sh ccm.sh # 3. Run installer ./install.sh # 4. Reload shell source ~/.zshrc ``` -------------------------------- ### API Key Configuration File Example Source: https://github.com/foreveryh/claude-code-switch/blob/main/README_CN.md This is an example of the `~/.ccm_config` file content. Add your API keys for each provider on a new line, prefixed with the provider name. ```bash # 每个提供商需要对应的 API Key DEEPSEEK_API_KEY=sk-... KIMI_API_KEY=... GLM_API_KEY=... QWEN_API_KEY=... MINIMAX_API_KEY=... ARK_API_KEY=... # 豆包/Seed OPENROUTER_API_KEY=... # OpenRouter CLAUDE_API_KEY=... # 可选,用于 Claude API(非订阅) ``` -------------------------------- ### CCM Install Options Source: https://context7.com/foreveryh/claude-code-switch/llms.txt Provides various options for installing CCM, including user-level, system-level, project-level installs, skipping rc injection, custom bin directories, and cleaning up legacy installations. ```bash # User-level install (default, recommended) ./install.sh --user # System-level install (requires sudo on some systems) ./install.sh --system # Project-level install (creates .ccm/ in current directory) ./install.sh --project # Skip rc injection (use eval manually) ./install.sh --no-rc # Custom bin directory ./install.sh --prefix "$HOME/bin" # Clean up legacy installation ./install.sh --cleanup-legacy ``` -------------------------------- ### README - ccc() command examples Source: https://github.com/foreveryh/claude-code-switch/blob/main/docs/PLAN_B_IMPLEMENTATION_COMPLETE.md Examples demonstrating the usage of the `ccc` command for switching models and launching Claude Code with optional arguments. ```bash ccc deepseek # Switch to DeepSeek and launch ``` ```bash ccc kimi --dangerously-skip-permissions # Launch with Claude options ``` -------------------------------- ### Install CCM via curl Source: https://context7.com/foreveryh/claude-code-switch/llms.txt Installs CCM with default settings by downloading and executing the installation script. Reload your shell to activate the changes. ```bash # Install CCM with default settings (user-level + rc injection) curl -fsSL https://raw.githubusercontent.com/foreveryh/claude-code-switch/main/quick-install.sh | bash # Reload shell to activate source ~/.zshrc # or ~/.bashrc ``` -------------------------------- ### Local Installation of Claude Code Switch Source: https://github.com/foreveryh/claude-code-switch/blob/main/README_CN.md Clone the repository and run the install script for a local installation. Remember to source your shell configuration file afterwards. ```bash git clone https://github.com/foreveryh/claude-code-switch.git cd claude-code-switch ./install.sh source ~/.zshrc ``` -------------------------------- ### ccm Command Usage Examples Source: https://github.com/foreveryh/claude-code-switch/blob/main/docs/CLEANUP_SUMMARY.md Examples demonstrating how to use the 'ccm' command for environment management, including switching models and checking status. ```bash ccm deepseek ccm status ccm config ``` -------------------------------- ### Core Project Files Source: https://github.com/foreveryh/claude-code-switch/blob/main/docs/CLEANUP_SUMMARY.md These are the essential scripts for the project, handling model switching, installation, and uninstallation. ```text ccm.sh install.sh uninstall.sh ``` -------------------------------- ### Migration Notes - Uninstall and Reinstall Source: https://github.com/foreveryh/claude-code-switch/blob/main/docs/PLAN_B_IMPLEMENTATION_COMPLETE.md Instructions for existing users to migrate to the new version, involving uninstalling the old version and installing the new one with `ccc` support. ```bash # 1. Uninstall old version ./uninstall.sh # 2. Install new version with ccc support ./install.sh # 3. Reload shell source ~/.zshrc # 4. Test both commands ccm status ccc deepseek ``` -------------------------------- ### Project Documentation Files Source: https://github.com/foreveryh/claude-code-switch/blob/main/docs/CLEANUP_SUMMARY.md Key documentation files for the project, including main guides and troubleshooting. ```text README.md README_CN.md PLAN_B_IMPLEMENTATION_COMPLETE.md TROUBLESHOOTING.md CHANGELOG.md CLEANUP_SUMMARY.md ``` -------------------------------- ### ccc Command Usage Examples Source: https://github.com/foreveryh/claude-code-switch/blob/main/docs/CLEANUP_SUMMARY.md Examples showing how to use the 'ccc' command for one-command launching of Claude Code, with and without additional parameters. ```bash ccc deepseek ccc kimi --dangerously-skip-permissions ``` -------------------------------- ### Install Options for Claude Code Switch Source: https://github.com/foreveryh/claude-code-switch/blob/main/README.md Provides options during installation, such as skipping shell rc injection or cleaning up legacy installations. ```bash ./install.sh --no-rc # Skip shell rc injection ./install.sh --cleanup-legacy # Remove old installation ./install.sh --help # Show all options ``` -------------------------------- ### Install Claude Code Switch with Options Source: https://github.com/foreveryh/claude-code-switch/blob/main/README_CN.md These commands show additional installation options, such as preventing shell rc injection or cleaning up legacy installations. ```bash ./install.sh --no-rc # 不注入 shell rc ./install.sh --cleanup-legacy # 清理旧版安装 ./install.sh --help # 显示所有选项 ``` -------------------------------- ### Install Modes for Claude Code Switch Source: https://github.com/foreveryh/claude-code-switch/blob/main/README.md Installs ccm in different modes: User (default), System (for shared machines), or Project (for isolated setups). ```bash ./install.sh # User (default) ./install.sh --system # System ./install.sh --project # Project ``` -------------------------------- ### Switch AI Provider and Use Claude Code Source: https://github.com/foreveryh/claude-code-switch/blob/main/README_CN.md These commands allow you to switch to a specific AI provider and then launch Claude Code with that provider. For example, 'ccc glm global' switches to the global GLM provider and starts Claude Code. ```bash ccm glm # 切换到 GLM ccc glm global # 切换 + 启动 Claude Code ``` -------------------------------- ### Install Claude Code Switch Source: https://github.com/foreveryh/claude-code-switch/blob/main/README_CN.md Use this command to quickly install the ccm tool. Remember to reload your shell after installation. ```bash curl -fsSL https://raw.githubusercontent.com/foreveryh/claude-code-switch/main/quick-install.sh | bash source ~/.zshrc # 或 ~/.bashrc ``` -------------------------------- ### Check Environment Precedence Source: https://github.com/foreveryh/claude-code-switch/blob/main/docs/AGENTS.md Verifies the current environment setup and confirms newly added providers are recognized. Useful for debugging. ```bash ./ccm.sh status ``` -------------------------------- ### Switching Providers in Current Shell Source: https://github.com/foreveryh/claude-code-switch/blob/main/CLAUDE.md Examples of switching the active AI provider using the ccm command. ```bash ccm deepseek ccm kimi china ``` -------------------------------- ### ccc() function usage examples Source: https://github.com/foreveryh/claude-code-switch/blob/main/docs/PLAN_B_IMPLEMENTATION_COMPLETE.md Examples demonstrating the usage of the `ccc` function for switching models and launching Claude Code, including shortcuts and supported formats. ```bash ccc [claude-options] # Examples: ccc deepseek ccc kimi --dangerously-skip-permissions ``` ```bash ccc deepseek # Official API ccc ds # Shortcut for deepseek ``` -------------------------------- ### Verification Test Commands Source: https://github.com/foreveryh/claude-code-switch/blob/main/docs/CLEANUP_SUMMARY.md Example commands to test the functionality of 'ccm' and 'ccc' after cleanup, ensuring all model switches and operations are working correctly. ```bash # 1. 测试 ccm ccm status ccm deepseek ccm status ccm status # 3. 测试 ccc(如果 Claude Code 已安装) ccc deepseek # 应该启动 Claude Code ``` -------------------------------- ### Install Local Development Build Source: https://github.com/foreveryh/claude-code-switch/blob/main/docs/AGENTS.md Installs the local development version of the ccm tool and refreshes shell hooks for manual testing. Run this after modifying ccm.sh. ```bash ./install.sh ``` -------------------------------- ### Install Script - Add ccc() function Source: https://github.com/foreveryh/claude-code-switch/blob/main/docs/PLAN_B_IMPLEMENTATION_COMPLETE.md This bash script snippet shows the addition of the `ccc()` function to the installation process. This function enables one-command model switching and Claude Code launch. ```bash ccc() { # Switch model and launch Claude Code ccm "$@" # Check if ccm was successful before launching if [ $? -eq 0 ]; then # Launch Claude Code with provided options exec claude "${@#* }" fi } ``` -------------------------------- ### Get Help with ccm Source: https://github.com/foreveryh/claude-code-switch/blob/main/README.md Displays all available commands for ccm or usage information for the 'ccc' command. ```bash ccm help # Show all commands ``` ```bash ccc # Show ccc usage (no args) ``` -------------------------------- ### Ensure Script Executability Source: https://github.com/foreveryh/claude-code-switch/blob/main/docs/AGENTS.md Before running any scripts, ensure they have execute permissions. This is a one-time setup for new clones. ```bash chmod +x ccm.sh install.sh uninstall.sh ``` -------------------------------- ### Switch AI Provider (Current Shell) Source: https://github.com/foreveryh/claude-code-switch/blob/main/README_CN.md Commands to switch the AI provider for the current shell session. Examples include switching to GLM (global/china), DeepSeek, Kimi, Qwen, MiniMax, Seed, and official Claude. ```bash ccm glm global # GLM 海外(默认) ccm glm china # GLM 国内 ccm deepseek # DeepSeek ccm kimi global # Kimi 海外 ccm kimi china # Kimi 国内 ccm qwen global # Qwen 海外 ccm minimax # MiniMax ccm seed # 豆包/Seed ccm claude # Claude 官方 ``` -------------------------------- ### ccm() function usage examples Source: https://github.com/foreveryh/claude-code-switch/blob/main/docs/PLAN_B_IMPLEMENTATION_COMPLETE.md Examples of using the `ccm` function for environment management, including switching models, checking status, and editing configuration. ```bash ccm deepseek # Switch to DeepSeek ccm status # View current configuration ccm config # Edit configuration file ``` -------------------------------- ### Launch with Specific Account and Model using CCC Source: https://github.com/foreveryh/claude-code-switch/blob/main/README.md The `ccc` command allows switching to a saved account and optionally specifying an AI model before launching. For example, `ccc work` switches to the 'work' account. ```bash ccc work # Switch to 'work' account, then launch ccc claude:personal # Switch to 'personal' account + use Claude ``` -------------------------------- ### Get Help for ccm Commands Source: https://github.com/foreveryh/claude-code-switch/blob/main/README_CN.md Display all available commands for the ccm tool using 'ccm help'. For 'ccc' command usage, run 'ccc' without any arguments. ```bash ccm help # 显示所有命令 ccc # 显示 ccc 用法(无参数) ``` -------------------------------- ### Switch and Launch Claude Code Source: https://github.com/foreveryh/claude-code-switch/blob/main/README_CN.md These commands first switch to the specified AI provider and then launch Claude Code. For instance, 'ccc glm china' switches to the Chinese GLM provider and starts Claude Code. ```bash ccc glm global # 切换到 GLM 海外,然后启动 ccc glm china # 切换到 GLM 国内,然后启动 ccc open glm # 通过 OpenRouter ``` -------------------------------- ### Switch and Launch Claude Code Source: https://github.com/foreveryh/claude-code-switch/blob/main/README.md Switches to the specified AI provider and then launches Claude Code. This is useful for immediately starting a session with a particular provider. ```bash ccc glm global # Switch to GLM global, then launch ccc glm china # Switch to GLM China, then launch ccc open glm # Via OpenRouter ``` -------------------------------- ### Check ccm Status Source: https://github.com/foreveryh/claude-code-switch/blob/main/README.md Displays the current AI provider configuration and API key status. Use 'ccm status' to verify your setup. ```bash ccm status # Check current configuration ``` ```bash ccm status # Show current model and API key status ``` ```bash ccm current-account # Show current Claude Pro account ``` -------------------------------- ### Apply Environment Variables with eval Source: https://context7.com/foreveryh/claude-code-switch/llms.txt If Claude Code was installed with `--no-rc`, use the `eval` command with `ccm` to apply the exported environment variables. Alternatively, use the wrapper scripts directly from the cloned repository. ```bash # If installed with --no-rc, use eval to apply environment eval "$(ccm deepseek)" eval "$(ccm glm china)" eval "$(ccm open kimi)" ``` ```bash # Or use wrapper scripts directly from cloned repo ./ccm glm global # Just prints exports (pipe to eval) ./ccc glm china # Switch + launch in one step ``` -------------------------------- ### Apply Environment Variables with CCM Eval Source: https://github.com/foreveryh/claude-code-switch/blob/main/README.md Use `eval $(ccm ...)` to apply environment variables exported by CCM commands to the current shell session. This is useful when running CCM from a cloned repository without installation. ```bash # Switch model (apply env vars to current shell) eval "$(ccm glm global)" eval "$(./ccm.sh glm china)" # Or use the wrapper scripts directly ./ccm glm global # Just prints exports ./ccc glm china # Switch + launch ``` -------------------------------- ### Using Seed (ARK) Provider Variants Source: https://github.com/foreveryh/claude-code-switch/blob/main/CLAUDE.md Demonstrates switching to different model variants under the Seed (ARK) provider. ```bash ccm seed # ark-code-latest ccm seed kimi # kimi-k2.5 ccm seed deepseek # deepseek-v3.2 ``` -------------------------------- ### Switch to Qwen Provider with Region Selection Source: https://context7.com/foreveryh/claude-code-switch/llms.txt Facilitates switching to the Qwen (Alibaba Coding Plan) AI provider, supporting both global and China endpoints. The command output indicates the selected region and the updated BASE_URL and MODEL. ```bash # Qwen global endpoint ccm qwen global # ✅ Switched to Qwen (global) (official) # BASE_URL: https://coding-intl.dashscope.aliyuncs.com/apps/anthropic # MODEL: qwen3-max-2026-01-23 # Qwen China endpoint ccm qwen china # ✅ Switched to Qwen (china) (official) # BASE_URL: https://coding.dashscope.aliyuncs.com/apps/anthropic # MODEL: qwen3-max-2026-01-23 ``` -------------------------------- ### Switch to Kimi Provider with Region Selection Source: https://context7.com/foreveryh/claude-code-switch/llms.txt Enables switching to the Kimi AI provider, with options for both global and China endpoints. The output confirms the chosen region and the corresponding BASE_URL and MODEL. ```bash # Kimi global endpoint (default) ccm kimi global # ✅ Switched to KIMI (official) # BASE_URL: https://api.moonshot.ai/anthropic # MODEL: kimi-k2.5 # Kimi China endpoint ccm kimi china # ✅ Switched to KIMI CN (official) # BASE_URL: https://api.moonshot.cn/anthropic # MODEL: kimi-k2.5 ``` -------------------------------- ### Use OpenRouter with Different Providers Source: https://github.com/foreveryh/claude-code-switch/blob/main/README_CN.md These commands demonstrate how to use OpenRouter to access various AI providers like GLM, Claude, and DeepSeek. Run 'ccm open' for help. ```bash ccm open # 显示帮助 ccm open glm # 通过 OpenRouter 使用 GLM ccm open claude # 通过 OpenRouter 使用 Claude ccm open deepseek # 通过 OpenRouter 使用 DeepSeek ``` -------------------------------- ### Launch Claude Code with Provider and Options Source: https://context7.com/foreveryh/claude-code-switch/llms.txt The `ccc` command allows launching Claude Code with a specific provider, options, or saved account in a single command. Use `ccc open` for OpenRouter providers. ```bash # Switch to DeepSeek and launch Claude Code ccc deepseek # 🔄 Switching to deepseek... # 🚀 Launching Claude Code... # Model: deepseek-chat # Base URL: https://api.deepseek.com/anthropic ``` ```bash # Switch to GLM China and launch ccc glm china ``` ```bash # Switch via OpenRouter and launch ccc open kimi ``` ```bash # Launch with Claude Code options ccc glm --dangerously-skip-permissions ``` ```bash # Launch with saved account ccc work # Switches to 'work' account, then launches ``` ```bash # Launch with specific model and account ccc claude:work # Switches to 'work' account, uses Claude model ``` -------------------------------- ### Switch to Claude Official Provider Source: https://context7.com/foreveryh/claude-code-switch/llms.txt Switches the environment to use the official Claude provider. This command relies on your Claude Pro subscription or a configured `CLAUDE_API_KEY`. ```bash # Switch to Claude (uses Pro subscription or CLAUDE_API_KEY) ccm claude ``` -------------------------------- ### Configure API Keys for Claude Code Switch Source: https://github.com/foreveryh/claude-code-switch/blob/main/README_CN.md Run this command to open the configuration file where you can add your API keys for different AI providers. Ensure you add the correct key for each provider you intend to use. ```bash ccm config ``` -------------------------------- ### Switch to MiniMax Provider with Region Selection Source: https://context7.com/foreveryh/claude-code-switch/llms.txt Allows switching to the MiniMax AI provider, with options for both global and China endpoints. The output confirms the selected region and the corresponding BASE_URL and MODEL. ```bash # MiniMax global endpoint ccm minimax global # ✅ Switched to MiniMax (global) (official) # BASE_URL: https://api.minimax.io/anthropic # MODEL: MiniMax-M2.5 # MiniMax China endpoint ccm minimax china # ✅ Switched to MiniMax (china) (official) # BASE_URL: https://api.minimaxi.com/anthropic # MODEL: MiniMax-M2.5 ``` -------------------------------- ### Configure API Keys for ccm Source: https://github.com/foreveryh/claude-code-switch/blob/main/README.md Opens the configuration file for adding API keys for various AI providers. Ensure you add the required keys for the providers you intend to use. ```bash ccm config ``` ```bash # Required for each provider you want to use DEEPSEEK_API_KEY=sk-... KIMI_API_KEY=... GLM_API_KEY=... QWEN_API_KEY=... MINIMAX_API_KEY=... ARK_API_KEY=... # For Doubao/Seed OPENROUTER_API_KEY=... # For OpenRouter CLAUDE_API_KEY=... # Optional, for Claude API (vs subscription) ``` -------------------------------- ### Switch to DeepSeek Provider Source: https://context7.com/foreveryh/claude-code-switch/llms.txt Switches the current shell environment to use the DeepSeek AI provider. It displays the new BASE_URL and MODEL, and you can verify the switch using `ccm status`. ```bash # Switch to DeepSeek in current shell ccm deepseek # Expected output: # 🔄 Switching to Deepseek model... # ✅ Switched to Deepseek (official) # BASE_URL: https://api.deepseek.com/anthropic # MODEL: deepseek-chat # Verify the switch ccm status # Shows current model configuration with masked API tokens ``` -------------------------------- ### Set User-Level Provider Configuration Source: https://github.com/foreveryh/claude-code-switch/blob/main/README_CN.md Configure a default AI provider for all projects directly in `~/.claude/settings.json`. This overrides all other settings. ```bash # 设置用户级 provider ccm user glm global # 所有项目使用 GLM 海外 ccm user glm china # 所有项目使用 GLM 国内 ccm user deepseek # 所有项目使用 DeepSeek ccm user claude # 所有项目使用 Claude 官方 ``` -------------------------------- ### Set Dummy API Key for Testing Source: https://github.com/foreveryh/claude-code-switch/blob/main/docs/AGENTS.md Temporarily sets an environment variable with a dummy API key. Used for testing masking logic and fallback behavior. ```bash export DEEPSEEK_API_KEY=dummy ``` -------------------------------- ### Repository Structure Source: https://github.com/foreveryh/claude-code-switch/blob/main/CLAUDE.md Overview of the directory structure for the Claude Code Switch project. ```bash Claude-Code-Switch/ ├── ccm.sh # Core script ├── install.sh # Installer (rc injection optional) ├── uninstall.sh # Uninstaller ├── ccm # Wrapper script (delegates to ccm.sh) ├── ccc # Launcher script (switch + exec claude) ├── lang/ # i18n strings (en.json, zh.json) ├── docs/ # Internal docs └── README.md / README_CN.md / TROUBLESHOOTING.md / CHANGELOG.md ``` -------------------------------- ### Set Project-Level Provider Override Source: https://github.com/foreveryh/claude-code-switch/blob/main/README_CN.md Specify an AI provider to be used only for the current project. This allows for project-specific configurations. ```bash ccm project glm china # 仅此项目使用 GLM ``` -------------------------------- ### Access AI Models via OpenRouter with CCM Source: https://github.com/foreveryh/claude-code-switch/blob/main/README.md Use `ccm open` to access various AI models through OpenRouter. This command shows help if no provider is specified. ```bash ccm open # Show help ccm open claude # Claude via OpenRouter ccm open glm # GLM via OpenRouter ccm open kimi # Kimi via OpenRouter ccm open deepseek # DeepSeek via OpenRouter ccm open qwen # Qwen via OpenRouter ccm open minimax # MiniMax via OpenRouter ccm open stepfun # StepFun via OpenRouter ccm open sf-free # StepFun free tier ``` -------------------------------- ### Switch to a Saved Claude Pro Account Source: https://github.com/foreveryh/claude-code-switch/blob/main/README_CN.md Switch to a previously saved Claude Pro account by its name (e.g., 'work'). ```bash # 切换到已保存的账号 ccm switch-account work ``` -------------------------------- ### Switch to GLM Provider with Region Selection Source: https://context7.com/foreveryh/claude-code-switch/llms.txt Allows switching to the GLM AI provider, supporting both global and China endpoints. The command output confirms the selected region and updated BASE_URL and MODEL. ```bash # GLM global endpoint (default) ccm glm global # ✅ Switched to GLM (global) # BASE_URL: https://api.z.ai/api/anthropic # MODEL: glm-5 # GLM China endpoint ccm glm china # ✅ Switched to GLM (china) # BASE_URL: https://open.bigmodel.cn/api/anthropic # MODEL: glm-5 ``` -------------------------------- ### Configure API Keys with ccm config Source: https://context7.com/foreveryh/claude-code-switch/llms.txt Opens the `~/.ccm_config` file in your default editor to configure API keys and optional model overrides for various AI providers. ```bash # Open configuration file in default editor ccm config ``` ```bash # ~/.ccm_config example CCM_LANGUAGE=en # Provider API Keys DEEPSEEK_API_KEY=sk-your-deepseek-key KIMI_API_KEY=your-kimi-key GLM_API_KEY=your-glm-key QWEN_API_KEY=your-qwen-key MINIMAX_API_KEY=your-minimax-key ARK_API_KEY=your-ark-key # For Doubao/Seed OPENROUTER_API_KEY=your-openrouter-key CLAUDE_API_KEY=your-claude-api-key # Optional, for API access # Optional: Override default model IDs DEEPSEEK_MODEL=deepseek-chat KIMI_MODEL=kimi-k2.5 GLM_MODEL=glm-5 QWEN_MODEL=qwen3-max-2026-01-23 MINIMAX_MODEL=MiniMax-M2.5 SEED_MODEL=ark-code-latest CLAUDE_MODEL=claude-sonnet-4-5-20250929 OPUS_MODEL=claude-opus-4-6 HAIKU_MODEL=claude-haiku-4-5-20251001 ``` -------------------------------- ### Switch to Doubao/Seed Provider with Model Variants Source: https://context7.com/foreveryh/claude-code-switch/llms.txt Switches to the Doubao/Seed AI provider, defaulting to the `ark-code-latest` model. It also supports switching to specific model variants available on the Seed platform. ```bash # Default Seed model (ark-code-latest) ccm seed # ✅ Switched to Seed-Code (official) # BASE_URL: https://ark.cn-beijing.volces.com/api/coding # MODEL: ark-code-latest # Specific model variants via Seed platform ccm seed doubao # doubao-seed-code ccm seed glm # glm-5 ccm seed deepseek # deepseek-v3.2 ccm seed kimi # kimi-k2.5 ``` -------------------------------- ### Manage Multiple Claude Pro Accounts Source: https://github.com/foreveryh/claude-code-switch/blob/main/README_CN.md Save and switch between different Claude Pro accounts. Use 'save-account' to store the current account and 'switch-account' to toggle between them. ```bash ccm save-account work # 保存当前账号 ccm switch-account work # 切换到已保存账号 ``` -------------------------------- ### Set User-Level Default Provider Source: https://github.com/foreveryh/claude-code-switch/blob/main/README_CN.md Configure a default AI provider that will be used across all projects. This setting has the highest priority and overrides other configurations. ```bash ccm user glm global # 设置 GLM 为全局默认 ccm user reset # 恢复环境变量控制 ``` -------------------------------- ### List of Backup Files Source: https://github.com/foreveryh/claude-code-switch/blob/main/docs/CLEANUP_SUMMARY.md A backup file for a previous version of the ccm.sh script. ```text ccm.sh.bak ``` -------------------------------- ### Launching Claude Code with a Specific Provider Source: https://github.com/foreveryh/claude-code-switch/blob/main/CLAUDE.md Launches Claude Code with a specified provider and region using the ccc command. ```bash ccc glm global ccc open kimi ``` -------------------------------- ### Seed Provider Variants Source: https://github.com/foreveryh/claude-code-switch/blob/main/README_CN.md These commands allow you to select different variants of the Seed provider, such as 'ark-code-latest' (default), 'doubao-seed-code', 'glm-5', 'deepseek-v3.2', and 'kimi-k2.5'. ```bash ccm seed # ark-code-latest(默认) ccm seed doubao # doubao-seed-code ccm seed glm # glm-5 ccm seed deepseek # deepseek-v3.2 ccm seed kimi # kimi-k2.5 ``` -------------------------------- ### OpenRouter Provider Export Source: https://github.com/foreveryh/claude-code-switch/blob/main/CLAUDE.md Sets environment variables for using OpenRouter as the provider. Avoids conflicts with direct Anthropic API keys. ```bash export ANTHROPIC_BASE_URL=https://openrouter.ai/api export ANTHROPIC_AUTH_TOKEN=$OPENROUTER_API_KEY export ANTHROPIC_API_KEY="" (avoid conflicts) ``` -------------------------------- ### Switch to Claude via OpenRouter Source: https://context7.com/foreveryh/claude-code-switch/llms.txt Use the `ccm open` command to switch to a specific provider through OpenRouter. This sets the ANTHROPIC_MODEL environment variable. ```bash # Show OpenRouter help ccm open ``` ```bash # Claude via OpenRouter ccm open claude # Sets ANTHROPIC_MODEL to anthropic/claude-sonnet-4.5 ``` ```bash # DeepSeek via OpenRouter ccm open deepseek # Sets ANTHROPIC_MODEL to deepseek/deepseek-v3.2 ``` ```bash # Kimi via OpenRouter ccm open kimi # Sets ANTHROPIC_MODEL to moonshotai/kimi-k2.5 ``` ```bash # GLM via OpenRouter ccm open glm # Sets ANTHROPIC_MODEL to z-ai/glm-5 ``` ```bash # Qwen via OpenRouter ccm open qwen # Sets ANTHROPIC_MODEL to qwen/qwen3-coder-next ``` ```bash # StepFun free tier via OpenRouter ccm open sf-free # Sets ANTHROPIC_MODEL to stepfun/step-3.5-flash:free ``` -------------------------------- ### Configure Project-Level AI Model Settings with CCM Source: https://github.com/foreveryh/claude-code-switch/blob/main/README.md Override AI model settings for a specific project using `ccm project`. This creates/removes `.claude/settings.local.json` in the current directory. ```bash # In your project directory ccm project glm global # Use GLM for this project only ccm project glm china # Use GLM China for this project ccm project reset # Remove project override ``` -------------------------------- ### Advanced ccm Usage: Project-only Override Source: https://github.com/foreveryh/claude-code-switch/blob/main/README.md Sets a specific AI provider for the current project only, overriding global or user settings. ```bash ccm project glm china # GLM for this project only ``` -------------------------------- ### Set User-Level Provider Settings Source: https://context7.com/foreveryh/claude-code-switch/llms.txt Configure default provider settings at the user level using `ccm user`. These settings override environment variables and have the highest priority. Use `ccm user reset` to revert to environment variable control. ```bash # Write GLM settings directly to ~/.claude/settings.json ccm user glm global # ✅ Wrote user-level settings for glm (global) # File: /Users/you/.claude/settings.json # 💡 This overrides environment variables and takes highest priority. ``` ```bash # Set DeepSeek as default for all projects ccm user deepseek ``` ```bash # Set Kimi China as default ccm user kimi china ``` ```bash # Reset to environment variable control ccm user reset # ✅ Removed ccm-managed settings from user settings # 💡 Claude Code will now use environment variables. ``` -------------------------------- ### Project-Specific Provider Override Source: https://github.com/foreveryh/claude-code-switch/blob/main/CLAUDE.md Applies a specific provider (e.g., GLM) only to the current project by writing to `.claude/settings.local.json`. ```bash ccm project glm [global|china] ``` -------------------------------- ### Advanced ccm Usage: User-level Settings Source: https://github.com/foreveryh/claude-code-switch/blob/main/README.md Sets default providers or resets environment variable control at the user level, which has the highest priority. ```bash ccm user glm global # Set GLM as default for all projects ccm user reset # Restore environment variable control ``` -------------------------------- ### File Restoration Command Source: https://github.com/foreveryh/claude-code-switch/blob/main/docs/CLEANUP_SUMMARY.md Command to restore a file from the backup directory. Use this if a file was accidentally deleted and needs to be recovered. ```bash cp .obsolete_backup_20251001/filename.sh ./ ``` -------------------------------- ### Manage Claude Pro Accounts with CCM Source: https://github.com/foreveryh/claude-code-switch/blob/main/README.md Commands for saving, switching, listing, and deleting Claude Pro accounts. Use `ccm save-account` to store the current account. ```bash # Save current logged-in account ccm save-account work # Switch to saved account ccm switch-account work # List all saved accounts ccm list-accounts # Show current account ccm current-account # Delete saved account ccm delete-account work ``` -------------------------------- ### Update Configuration with Latest Model IDs Source: https://github.com/foreveryh/claude-code-switch/blob/main/README_CN.md Run this command to update any outdated model IDs in your configuration to the latest default values. This is useful when new model versions are released. ```bash ccm update-config # 更新过时的模型 ID 到最新默认值 ``` -------------------------------- ### Set Project-Level Provider Settings Source: https://context7.com/foreveryh/claude-code-switch/llms.txt Override user-level settings for a specific project by running `ccm project` within the project directory. These settings are stored in `.claude/settings.local.json` and only apply to that project. Use `ccm project reset` to remove the project-specific override. ```bash # In your project directory, set GLM for this project only cd /path/to/my-project ccm project glm global # ✅ Wrote project settings for glm (global) # File: /path/to/my-project/.claude/settings.local.json # 💡 This overrides user settings for this project only. ``` ```bash # Set other providers at project level ccm project deepseek ``` ```bash ccm project kimi china ``` ```bash ccm project seed ``` ```bash # Remove project override ccm project reset # ✅ Removed project settings # 💡 Claude Code will fall back to user settings. ``` -------------------------------- ### Account Management Commands Source: https://github.com/foreveryh/claude-code-switch/blob/main/CLAUDE.md Commands for managing different Claude Pro accounts, including saving, switching, listing, and deleting. ```bash ccm save-account work ccm switch-account work ccm list-accounts ccm delete-account work ccm current-account ``` -------------------------------- ### Reinstall and Source Shell Configuration Source: https://github.com/foreveryh/claude-code-switch/blob/main/docs/AGENTS.md After modifying ccm.sh, reinstall the tool and source your shell configuration file to apply changes. This ensures the 'ccm' command uses the updated script. ```bash ./install.sh source ~/.zshrc # or source ~/.bashrc ``` -------------------------------- ### Manage Multiple Claude Pro Accounts Source: https://context7.com/foreveryh/claude-code-switch/llms.txt Save, list, switch between, and delete multiple Claude Pro accounts using `ccm save-account`, `ccm list-accounts`, `ccm switch-account`, and `ccm delete-account`. Changes take effect after restarting Claude Code. ```bash # Save current logged-in Claude Pro account ccm save-account work # ✅ Account saved: work # Subscription Type: pro ``` ```bash # Save another account ccm save-account personal # ✅ Account saved: personal ``` ```bash # List all saved accounts ccm list-accounts # 📋 Saved accounts: # - work (pro, expires: 2025-12-31 23:59) ✅ (active) # - personal (pro, expires: 2025-06-30 12:00) ``` ```bash # Switch to a different account ccm switch-account personal # ✅ Account switched: personal # ⚠️ Please restart Claude Code for changes to take effect ``` ```bash # Show current account info ccm current-account # 📊 Current account info: # Account Name: personal # Subscription Type: pro # Token Expires: 2025-06-30 12:00 # Access Token: [set] eyJh...xxxxx ``` ```bash # Delete a saved account ccm delete-account old-account # ✅ Account deleted: old-account ``` ```bash # Switch account and launch in one command ccc work # Switches to 'work' account, launches Claude Code ``` ```bash ccc claude:work # Switches account AND uses Claude model ``` -------------------------------- ### List All Saved Claude Pro Accounts Source: https://github.com/foreveryh/claude-code-switch/blob/main/README_CN.md Display a list of all Claude Pro accounts that have been saved using 'ccm save-account'. ```bash # 列出所有已保存的账号 ccm list-accounts ``` -------------------------------- ### Permanent Backup Deletion Command Source: https://github.com/foreveryh/claude-code-switch/blob/main/docs/CLEANUP_SUMMARY.md Command to permanently delete the backup directory. Use with extreme caution as this action is irreversible. ```bash rm -rf .obsolete_backup_20251001/ ``` -------------------------------- ### Configure User-Level AI Model Settings with CCM Source: https://github.com/foreveryh/claude-code-switch/blob/main/README.md Set AI model defaults at the user level using `ccm user`. This overrides environment variables and is stored in `~/.claude/settings.json`. Use `ccm user reset` to revert to environment variable control. ```bash # Set provider at user level ccm user glm global # GLM global for all projects ccm user glm china # GLM China for all projects ccm user deepseek # DeepSeek for all projects ccm user claude # Claude official for all projects # Reset to environment variable control ccm user reset # Remove ccm settings, use env vars instead ``` -------------------------------- ### List of Outdated Documentation Source: https://github.com/foreveryh/claude-code-switch/blob/main/docs/CLEANUP_SUMMARY.md Documentation files whose content has been merged into the main documentation. ```text 方案B_实施报告.md QUICKSTART_方案B.md MIGRATION_TO_PLAN_B.md ``` -------------------------------- ### View Current Status and Account Source: https://github.com/foreveryh/claude-code-switch/blob/main/README_CN.md Check the current model and API key status using 'ccm status'. Use 'ccm current-account' to see the currently active Claude Pro account. ```bash ccm status # 显示当前模型和 API Key 状态 ccm current-account # 显示当前 Claude Pro 账号 ``` -------------------------------- ### Display Current Claude Pro Account Source: https://github.com/foreveryh/claude-code-switch/blob/main/README_CN.md Show the name of the currently active Claude Pro account. ```bash # 显示当前账号 ccm current-account ``` -------------------------------- ### Environment Variable Exports Source: https://github.com/foreveryh/claude-code-switch/blob/main/CLAUDE.md Exports Anthropic-compatible environment variables for AI provider integration. These are typically eval'd by the caller. ```bash export ANTHROPIC_BASE_URL=... export ANTHROPIC_AUTH_TOKEN=... export ANTHROPIC_MODEL=... export ANTHROPIC_DEFAULT_SONNET_MODEL=... export ANTHROPIC_DEFAULT_OPUS_MODEL=... export ANTHROPIC_DEFAULT_HAIKU_MODEL=... export CLAUDE_CODE_SUBAGENT_MODEL=... ``` -------------------------------- ### List of Obsolete Test Scripts Source: https://github.com/foreveryh/claude-code-switch/blob/main/docs/CLEANUP_SUMMARY.md These are temporary scripts used during development and testing that are no longer needed after the Plan B implementation. ```text test_anthropic_compat.py test_claude_code.py test_effectively_set.sh test_glm.py test_glm2.py test_方案B.sh ``` -------------------------------- ### Seed AI Models with CCM Source: https://github.com/foreveryh/claude-code-switch/blob/main/README.md Use `ccm seed` to select and seed specific AI models. The default is `ark-code-latest`. ```bash ccm seed # ark-code-latest (default) ccm seed doubao # doubao-seed-code ccm seed glm # glm-5 ccm seed deepseek # deepseek-v3.2 ccm seed kimi # kimi-k2.5 ``` -------------------------------- ### Save Current Claude Pro Account Source: https://github.com/foreveryh/claude-code-switch/blob/main/README_CN.md Save the currently logged-in Claude Pro account with a given name (e.g., 'work') for later switching. ```bash # 保存当前登录的账号 ccm save-account work ``` -------------------------------- ### Check Current Configuration Status Source: https://github.com/foreveryh/claude-code-switch/blob/main/README_CN.md Verify the current status of your Claude Code Switch configuration, including the active model and API key status. ```bash ccm status # 查看当前配置状态 ``` -------------------------------- ### Unset API Key for Testing Source: https://github.com/foreveryh/claude-code-switch/blob/main/docs/AGENTS.md Removes the API key environment variable. Used to test fallback behavior when keys are not set. ```bash unset DEEPSEEK_API_KEY ``` -------------------------------- ### Check Claude Code Status and Configuration Source: https://context7.com/foreveryh/claude-code-switch/llms.txt Use `ccm status` to view the current user configuration, active model configuration, and the status of environment variables. `ccm update-config` can update outdated model IDs in your configuration files. ```bash ccm status # Output shows: # 👤 User config (ccm-managed): /Users/you/.claude/settings.json # BASE_URL: https://api.z.ai/api/anthropic # MODEL: glm-5 # AUTH_TOKEN: [set] xxxx...yyyy # # 📊 Current model config: # BASE_URL: https://api.z.ai/api/anthropic # AUTH_TOKEN: [set] xxxx...yyyy # MODEL: glm-5 # SUBAGENT_MODEL: glm-5 # OPUS_MODEL: glm-5 # SONNET_MODEL: glm-5 # HAIKU_MODEL: glm-5 # # 🔧 Env vars status: # GLM_API_KEY: [set] # KIMI_API_KEY: [set] # DEEPSEEK_API_KEY: [not set] # ... ``` ```bash # Update outdated model IDs in config file ccm update-config # 🔄 Checking for outdated model IDs... # ✅ Updated KIMI_MODEL: kimi-for-coding → kimi-k2.5 # ✅ Updated GLM_MODEL: glm-4.7 → glm-5 # ✅ Updated 2 model ID(s) ``` -------------------------------- ### Advanced ccm Usage: Multiple Claude Pro Accounts Source: https://github.com/foreveryh/claude-code-switch/blob/main/README.md Saves and switches between different Claude Pro accounts using custom names. ```bash ccm save-account work # save current account ccm switch-account work # switch to saved account ``` -------------------------------- ### List of Deprecated Scripts Source: https://github.com/foreveryh/claude-code-switch/blob/main/docs/CLEANUP_SUMMARY.md These scripts have been superseded, with their functionality integrated into the main scripts. ```text zshrc_config_new.sh ``` -------------------------------- ### Check Shell Script Syntax Source: https://github.com/foreveryh/claude-code-switch/blob/main/docs/AGENTS.md Performs a syntax-only check on the ccm.sh script to catch regressions early. Does not execute the script. ```bash bash -n ccm.sh ``` -------------------------------- ### Update ccm Configuration Source: https://github.com/foreveryh/claude-code-switch/blob/main/README.md Updates outdated model IDs in your configuration to the latest defaults. Run this command when model IDs might have changed in new versions. ```bash ccm update-config # Update outdated model IDs to latest defaults ``` -------------------------------- ### Switch Claude Code Provider Source: https://github.com/foreveryh/claude-code-switch/blob/main/README.md Switches the active AI provider for Claude Code in the current shell session. Use 'global' or specific region codes as needed. ```bash ccm glm global # GLM global (default) ccm glm china # GLM China ccm deepseek # DeepSeek ccm kimi global # Kimi global ccm kimi china # Kimi China ccm qwen global # Qwen global ccm minimax # MiniMax ccm seed # Doubao/Seed ccm claude # Claude official ``` -------------------------------- ### Lint Shell Scripts Source: https://github.com/foreveryh/claude-code-switch/blob/main/docs/AGENTS.md Checks shell scripts for common errors and style issues using shellcheck. Recommended before committing. ```bash shellcheck ccm.sh install.sh uninstall.sh ``` -------------------------------- ### Delete a Saved Claude Pro Account Source: https://github.com/foreveryh/claude-code-switch/blob/main/README_CN.md Remove a previously saved Claude Pro account from the list using its name (e.g., 'work'). ```bash # 删除已保存的账号 ccm delete-account work ``` -------------------------------- ### Uninstall Claude Code Switch Source: https://github.com/foreveryh/claude-code-switch/blob/main/README_CN.md Use this script to remove the Claude Code Switch tool from your system. ```bash ./uninstall.sh ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.