CC Switch 是一个原生 macOS 菜单栏应用程序,让您可以轻松切换不同的 Claude Code API 配置。无论您使用的是 GAC Code、Kimi、Anyrouter 还是自定义端点,CC Switch 都能让环境管理变得简单直观。
- 🔄 一键切换:从菜单栏即时切换 API 配置
- ⚙️ 多服务商支持:内置支持 GAC Code、Kimi、Anyrouter 和自定义端点
- 🔐 安全存储:所有配置都本地存储在您的设备上
- 🎯 智能 Shell 集成:自动更新您的 shell 配置文件(.zshrc、.bashrc)
- ⌨️ 键盘快捷键:全局热键支持(Shift+Cmd+C)
- 🎨 原生设计:使用 SwiftUI 构建,遵循 Apple 人机界面指南
- 🌙 系统集成:支持亮色和暗色模式
- 📱 菜单栏便利:快速访问,不占用程序坞空间
- macOS 13.0 或更高版本
- 已安装 Claude Code CLI
- 从 GitHub Releases 下载最新版本的
CCSwitch-x.x.x.dmg - 双击挂载 DMG 文件
- 将
CCSwitch.app拖拽到Applications文件夹 - 首次运行:
- 在 Applications 文件夹中,按住
Control键并点击CCSwitch.app - 选择"打开",然后在安全对话框中再次点击"打开"
- 或者在
系统偏好设置>安全性与隐私>通用中点击"仍要打开"
- 在 Applications 文件夹中,按住
📖 详细安装指南:请查看 INSTALL.md 获取完整的安装说明和故障排除方法。
# 克隆仓库
git clone https://github.com/hamguy/CCSwitch.git
cd CCSwitch
# 在 Xcode 中打开
open ccswitch-mac/ccswitch.xcodeproj
# 使用 Xcode 构建和运行- 启动 CC Switch:在菜单栏中找到 CC Switch 图标
- 添加配置:点击菜单栏图标 → "添加配置..."
- 配置 API:输入您的 API 端点和令牌
- 切换环境:点击任何配置即可立即切换
- 点击 CC Switch 菜单栏图标
- 选择"添加配置..."
- 选择配置类型:
- GAC Code:GAC Code API 预配置
- Kimi:Kimi API 预配置
- Anyrouter:Anyrouter API 预配置
- 自定义:您自己的 API 端点
- 输入您的 API 令牌并保存
- 通过菜单栏:点击 CC Switch 图标并选择所需配置
- 通过热键:按
Shift+Cmd+C打开快速切换器
CC Switch 会自动更新您的 shell 配置文件以设置相应的环境变量:
export ANTHROPIC_API_KEY="your-api-key"
export ANTHROPIC_BASE_URL="your-api-endpoint"支持的 shell 配置文件:
~/.zshrc(默认)~/.bashrc- 自定义配置文件(可在设置中配置)
| 类型 | 描述 | 默认 URL |
|---|---|---|
| 官方 | Claude 官方 API | https://api.anthropic.com |
| GAC Code | GAC Code 服务 | https://api.gaccode.com |
| Kimi | 月之暗面 Kimi 服务 | https://api.moonshot.cn |
| Anyrouter | Anyrouter 服务 | https://api.anyrouter.cc |
| 自定义 | 您自己的端点 | 用户定义 |
通过菜单栏图标 → "设置..." 或按 Cmd+, 访问设置:
- 开机启动:登录时自动启动 CC Switch
- 自定义配置文件:使用自定义 shell 配置文件
- 通知:启用/禁用切换通知
CC Switch 需要以下权限才能正常运行:
- 文件和文件夹访问:读取和修改您的 shell 配置文件
- 通知(可选):显示配置切换通知
CC Switch 还包含一个跨平台命令行工具,用于快速环境切换:
# macOS/Linux/WSL
curl -fsSL https://raw.githubusercontent.com/hamguy/CCSwitch/main/shell/install.sh | bash
# Windows PowerShell
irm https://raw.githubusercontent.com/hamguy/CCSwitch/main/shell/install.ps1 | iex# 切换到 GAC Code
ccswitch --type gaccode --token sk-xxx
# 切换到 Kimi
ccswitch --type kimi --token sk-xxx
# 交互模式
ccswitch
# 重置为默认
ccswitch --reset如果 CCSwitch 对您有帮助,欢迎支持开源项目的发展!您的支持将帮助我们:
- 🛠 持续改进和修复 bug
- ✨ 开发更多实用功能
- 🔐 购买 Apple 开发者证书提供签名版本
- 📚 完善文档和用户指南
本项目采用 MIT 许可证 - 查看 LICENSE 文件了解详情。
- 受 Claude Code 社区启发
- 使用 Apple 原生技术用心构建
- 感谢所有贡献者和测试用户
- 错误报告:GitHub Issues
- 功能请求:GitHub Discussions
- 文档:项目 Wiki
CC Switch is a native macOS menu bar application that allows you to effortlessly switch between different Claude Code API configurations. Whether you're using GAC Code, Kimi, Anyrouter, or custom endpoints, CC Switch makes environment management simple and intuitive.
- 🔄 One-Click Switching: Switch between API configurations instantly from your menu bar
- ⚙️ Multiple Providers: Built-in support for GAC Code, Kimi, Anyrouter, and custom endpoints
- 🔐 Secure Storage: All configurations are stored locally on your device
- 🎯 Smart Shell Integration: Automatically updates your shell configuration files (.zshrc, .bashrc)
- ⌨️ Keyboard Shortcuts: Global hotkey support (Shift+Cmd+C)
- 🎨 Native Design: Built with SwiftUI following Apple's Human Interface Guidelines
- 🌙 System Integration: Supports both light and dark modes
- 📱 Menu Bar Convenience: Quick access without cluttering your dock
- macOS 13.0 or later
- Claude Code CLI installed
- Download the latest
CCSwitch-x.x.x.dmgfrom GitHub Releases - Double-click to mount the DMG file
- Drag
CCSwitch.appto yourApplicationsfolder - First launch:
- In Applications folder, hold
Controland clickCCSwitch.app - Select "Open", then click "Open" again in the security dialog
- Or go to
System Preferences>Security & Privacy>Generaland click "Open Anyway"
- In Applications folder, hold
📖 Detailed Installation Guide: See INSTALL.md for complete installation instructions and troubleshooting.
# Clone the repository
git clone https://github.com/hamguy/CCSwitch.git
cd CCSwitch
# Open in Xcode
open ccswitch-mac/ccswitch.xcodeproj
# Build and run using Xcode- Launch CC Switch: Find the CC Switch icon in your menu bar
- Add Configuration: Click the menu bar icon → "Add Configuration..."
- Configure API: Enter your API endpoint and token
- Switch Environments: Click on any configuration to switch instantly
- Click the CC Switch menu bar icon
- Select "Add Configuration..."
- Choose configuration type:
- GAC Code: Pre-configured for GAC Code API
- Kimi: Pre-configured for Kimi API
- Anyrouter: Pre-configured for Anyrouter API
- Custom: Your own API endpoint
- Enter your API token and save
- Via Menu Bar: Click the CC Switch icon and select your desired configuration
- Via Hotkey: Press
Shift+Cmd+Cto open the quick switcher
CC Switch automatically updates your shell configuration files to set the appropriate environment variables:
export ANTHROPIC_API_KEY="your-api-key"
export ANTHROPIC_BASE_URL="your-api-endpoint"Supported shell configuration files:
~/.zshrc(default)~/.bashrc- Custom configuration files (configurable in Settings)
| Type | Description | Default URL |
|---|---|---|
| Official | Claude's official API | https://api.anthropic.com |
| GAC Code | GAC Code service | https://api.gaccode.com |
| Kimi | Moonshot AI Kimi service | https://api.moonshot.cn |
| Anyrouter | Anyrouter service | https://api.anyrouter.cc |
| Custom | Your own endpoint | User-defined |
Access settings through the menu bar icon → "Settings..." or press Cmd+,:
- Launch at Login: Start CC Switch automatically when you log in
- Custom Config File: Use a custom shell configuration file
- Notifications: Enable/disable switch notifications
CC Switch requires the following permissions to function properly:
- Files and Folders Access: To read and modify your shell configuration files
- Notifications (Optional): To show configuration switch notifications
CC Switch also includes a cross-platform command-line tool for quick environment switching:
# macOS/Linux/WSL
curl -fsSL https://raw.githubusercontent.com/hamguy/CCSwitch/main/shell/install.sh | bash
# Windows PowerShell
irm https://raw.githubusercontent.com/hamguy/CCSwitch/main/shell/install.ps1 | iex# Switch to GAC Code
ccswitch --type gaccode --token sk-xxx
# Switch to Kimi
ccswitch --type kimi --token sk-xxx
# Interactive mode
ccswitch
# Reset to default
ccswitch --resetIf CCSwitch has been helpful to you, consider supporting the development of this open-source project! Your support helps us:
- 🛠 Continue improving and fixing bugs
- ✨ Develop more useful features
- 🔐 Purchase Apple Developer Certificate for signed versions
- 📚 Improve documentation and user guides
CC Switch is built with modern Swift technologies:
- SwiftUI: Native user interface
- Combine: Reactive programming
- Core Data: Configuration persistence
- UserNotifications: System notifications
- Carbon: Global hotkey support
We welcome contributions! Please see our Contributing Guide for details.
- Clone the repository
- Open
ccswitch-mac/ccswitch.xcodeprojin Xcode - Build and run the project
# Run unit tests
xcodebuild test -project ccswitch-mac/ccswitch.xcodeproj -scheme ccswitch
# Run UI tests
xcodebuild test -project ccswitch-mac/ccswitch.xcodeproj -scheme ccswitch -testPlan UITestsThis project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by the Claude Code community
- Built with love using Apple's native technologies
- Thanks to all contributors and beta testers
- Bug Reports: GitHub Issues
- Feature Requests: GitHub Discussions
- Documentation: Project Wiki
Made with ❤️ for the Claude Code community
💖 如果觉得有用,请考虑 支持一下开发者 ☕
⭐ Don't forget to star this repo if you find it helpful!
