Skip to content

Latest commit

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

CCS - Claude Code Switcher

A CLI tool for managing multiple Claude Code API providers.

一个用于管理多个 Claude Code API 商家配置的命令行工具。

Installation / 安装

npm install -g @claude-cli/ccs

Features / 特性

  • Auto-import current Claude Code config on first run / 首次运行自动导入当前 Claude Code 配置
  • Backup before switching / 切换前自动备份
  • Bilingual support (English/Chinese) / 中英双语支持
  • Quota tracking and display / 额度用量跟踪与显示
  • Beautiful table display with borders / 美观的带边框表格显示

Commands / 命令

CommandAliasDescription (EN)描述 (中文)
ccs-Interactive switch交互式切换商家
ccs listccs lsList all providers列出所有商家
ccs addccs aAdd a new provider添加新商家
ccs edit [name]ccs e [name]Edit a provider编辑商家配置
ccs use [name]ccs u [name]Switch to a provider快速切换商家
ccs remove [name]ccs rm [name]Remove a provider删除商家
ccs currentccs cShow current config显示当前配置
ccs refresh [name]ccs r [name]Refresh quota info刷新额度信息
ccs lang-Switch language切换语言(中/英)
ccs --versionccs -vShow version显示版本号
ccs --helpccs -hShow help显示帮助信息

Screenshots / 截图

2025-12-01-17-26-05

Quota Configuration / 额度配置

When adding or editing a provider, you can optionally configure quota display:

添加或编辑商家时,可以选择配置额度显示:

  1. User ID - Found in provider's settings page / 在商家设置页面查看
  2. Access Token - Found in Settings → Security Settings / 在设置-安全设置中获取

Once configured, run ccs refresh to update quota info, or it will auto-fetch when adding/editing.

配置完成后,运行 ccs refresh 刷新额度信息,或在添加/编辑时自动获取。

Configuration / 配置

Config File / 配置文件

~/.ccs.json

{
"lang": "zh",
"current": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"providers": [
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "OpenRouter",
"description": "Main provider, cheap",
"baseURL": "https://openrouter.ai/api/v1",
"apiKey": "sk-or-xxx",
"balanceConfig": {
"enabled": true,
"userId": "12345",
"accessToken": "your-access-token"
},
"usedBalance": 12.5,
"totalBalance": 100
},
{
"id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"name": "OneAPI",
"description": "Company internal API",
"baseURL": "https://api.example.com/v1",
"apiKey": "sk-xxx"
}
]
}

Provider Fields / 商家字段

FieldRequiredDescription (EN)描述 (中文)
idYesUUID identifierUUID 标识符
nameYesProvider name商家名称
descriptionNoDescription/notes描述/备注
baseURLYesAPI base URLAPI 地址
apiKeyYesAPI keyAPI 密钥
balanceConfigNoQuota config object额度配置对象
balanceConfig.enabledNoEnable quota display启用额度显示
balanceConfig.userIdNoUser ID for API用户 ID
balanceConfig.accessTokenNoAccess token for API访问令牌
usedBalanceNoUsed quota (USD)已用额度 (美元)
totalBalanceNoTotal quota (USD)总额度 (美元)

Switch Mechanism / 切换机制

When switching providers / 切换商家时:

  1. Backup ~/.claude/settings.json~/.claude/settings.json.backup
  2. Write ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN to ~/.claude/settings.json

Tech Stack / 技术栈

License

MIT

Releases

Packages

Contributors

Languages