claude-ccs
v0.13.1
Published
切换Claude Code的Provider配置的CLI工具
Maintainers
Readme
CCS - Claude Config Switcher
English | 简体中文
快速切换 Claude Code 项目的 AI Provider 配置,告别手动编辑配置文件。
安装
npm install -g claude-ccs要求:Claude Code >= v2.0.1(用
claude --version检查)
快速开始
首次运行自动初始化:
- 创建默认配置
- 从 shell 环境变量导入配置
- 安装 Tab 补全
编辑配置添加你的 Provider:
ccs config配置示例:
{
"profiles": {
"anthropic": {
"ANTHROPIC_BASE_URL": "https://api.anthropic.com",
"ANTHROPIC_AUTH_TOKEN": "sk-ant-xxx"
},
"custom-gateway": {
"ANTHROPIC_BASE_URL": "https://your-gateway.example.com/v1",
"ANTHROPIC_AUTH_TOKEN": "your-token-here",
"ANTHROPIC_MODEL": "claude-sonnet-4-6"
}
}
}在项目目录切换 Provider:
ccs常用命令
| 命令 | 说明 |
|------|------|
| ccs | 切换 Provider |
| ccs config | 编辑配置 |
| ccs config sync-env | 从 shell 环境变量同步 |
| ccs status | 查看当前配置 |
| ccs status --shell | 查看 Shell 集成状态 |
| ccs setup | 设置 Shell 集成(自动在 claude 命令前运行 ccs) |
| ccs teardown | 移除 Shell 集成 |
| ccs -v, --version | 查看版本号 |
| ccs project list | 列出已注册项目 |
| ccs completion install | 安装 Shell 补全 |
注意:
ccs install和ccs uninstall已废弃,请使用ccs setup和ccs teardown代替。旧命令在 v1.0.0 版本将被移除。
配置文件
位于 ~/.ccs/ 目录:
config.json— Provider 配置projects.json— 已注册项目(自动管理)
Shell 环境变量
CCS 支持从 ~/.zshrc 或 ~/.bashrc 自动导入:
export ANTHROPIC_BASE_URL="https://api.anthropic.com"
export ANTHROPIC_AUTH_TOKEN="sk-ant-xxx"
export ANTHROPIC_MODEL="claude-sonnet-4-6"工作原理
CCS 修改项目的 .claude/settings.local.json,优先级高于 shell 环境变量。切换后需重启 Claude Code 或 VS Code / Cursor 中的 Claude Code 插件 后生效。
Shell 集成(推荐)
通过 Shell 集成,可以在启动 Claude Code 前自动运行 ccs 选择 Provider,无需手动切换。
设置 Shell 集成
ccs setup设置后,在项目目录中输入 claude 命令时会自动提示选择 Provider:
cd /path/to/your/project
claude
# 🔧 检测到项目,选择 Provider 配置...
# ? 选择 Provider 配置: (Use arrow keys)
# ❯ anthropic
# custom-gateway工作原理
Shell 集成会在你的 shell 配置文件(~/.zshrc 或 ~/.bashrc)中添加一个 claude 函数:
- 在项目目录中:自动运行
ccs选择 Provider,然后启动 Claude Code - 在非项目目录中:直接启动 Claude Code
移除 Shell 集成
ccs teardown查看集成状态
ccs status --shellLicense
MIT
CCS - Claude Config Switcher (English)
Quickly switch the AI Provider configuration for Claude Code projects — no more manual config editing.
Install
npm install -g claude-ccsRequires: Claude Code >= v2.0.1 (check with
claude --version)
Quick Start
Run ccs for the first time and it auto-initializes:
- Creates the default config
- Imports settings from your shell environment variables
- Installs Tab completion
Edit the config to add your providers:
ccs configConfig example:
{
"profiles": {
"anthropic": {
"ANTHROPIC_BASE_URL": "https://api.anthropic.com",
"ANTHROPIC_AUTH_TOKEN": "sk-ant-xxx"
},
"custom-gateway": {
"ANTHROPIC_BASE_URL": "https://your-gateway.example.com/v1",
"ANTHROPIC_AUTH_TOKEN": "your-token-here",
"ANTHROPIC_MODEL": "claude-sonnet-4-6"
}
}
}Switch provider in a project directory:
ccsCommands
| Command | Description |
|---------|-------------|
| ccs | Switch provider |
| ccs config | Edit config |
| ccs config sync-env | Sync from shell environment variables |
| ccs status | Show current config |
| ccs status --shell | Show shell integration status |
| ccs setup | Set up shell integration (runs ccs before claude) |
| ccs teardown | Remove shell integration |
| ccs -v, --version | Show version |
| ccs project list | List registered projects |
| ccs completion install | Install shell completion |
Note:
ccs installandccs uninstallare deprecated; useccs setupandccs teardowninstead. The old commands will be removed in v1.0.0.
Config Files
Located in ~/.ccs/:
config.json— provider profilesprojects.json— registered projects (auto-managed)
Shell Environment Variables
CCS can import from ~/.zshrc or ~/.bashrc:
export ANTHROPIC_BASE_URL="https://api.anthropic.com"
export ANTHROPIC_AUTH_TOKEN="sk-ant-xxx"
export ANTHROPIC_MODEL="claude-sonnet-4-6"How It Works
CCS modifies the project's .claude/settings.local.json, which takes precedence over shell environment variables. After switching, restart Claude Code (or the Claude Code extension in VS Code / Cursor) for it to take effect.
Shell Integration (Recommended)
With shell integration, ccs runs automatically before Claude Code starts, prompting you to pick a provider — no manual switching needed.
Set up
ccs setupAfter setup, typing claude inside a project directory prompts you to pick a provider:
cd /path/to/your/project
claude
# 🔧 Project detected, pick a provider config...
# ? Select provider config: (Use arrow keys)
# ❯ anthropic
# custom-gatewayHow it works
Shell integration adds a claude function to your shell config (~/.zshrc or ~/.bashrc):
- Inside a project directory: runs
ccsto pick a provider, then launches Claude Code - Outside a project directory: launches Claude Code directly
Remove
ccs teardownCheck status
ccs status --shellLicense (English)
MIT
