Ainzy · CC Switch
图形界面接入 · 无需运行任何脚本 GUI setup · no scripts to run

CC Switch 接入 Ainzy Connect Ainzy with CC Switch

CC Switch 是一个开源(MIT)的桌面小工具,专门用来管理 Claude Code、Codex、Gemini CLI 等命令行工具的供应商配置:一次把多个供应商都存进去,之后在托盘菜单里点一下就能切换,不用再手动改 config.toml。下面这份配置是给 用的。 CC Switch is an open-source (MIT) desktop utility that manages provider configs for Claude Code, Codex, Gemini CLI and friends. Save several providers once, then switch between them from the tray menu — no more hand-editing config.toml. The values below are for .

00 它解决什么问题What it solves

Claude Code 和 Codex 的供应商设置是写死在配置文件里的(~/.claude/settings.json~/.codex/config.toml)。只用一个供应商时手改一次就完事;一旦手里有多把 key、多个分组,或者还要在几家之间来回切,手改就开始出错。CC Switch 就是替你管这些文件的。 Claude Code and Codex keep their provider settings in config files (~/.claude/settings.json, ~/.codex/config.toml). With a single provider you edit them once and forget it — but once you have several keys, several groups, or you switch between vendors, hand-editing starts going wrong. CC Switch manages those files for you.

01 安装Install

官网 ccswitch.io,或者直接去 GitHub Releases 下最新版。支持 Windows 10+、macOS 12+、Linux。 Grab it from ccswitch.io or the latest GitHub release. Windows 10+, macOS 12+, Linux.

它更新很快,每次都从上面两个地址取最新版,别用别处转发的旧安装包。它是第三方开源软件,不是 Ainzy 的产品,我们只提供接入所需的参数。 It ships fast, so always take the latest build from the links above rather than an installer someone re-shared. It’s third-party open-source software, not an Ainzy product; we only supply the settings needed to connect.

第一次打开时,如果你机器上已经有 Codex / Claude Code 的配置,可以选择「导入为默认供应商」,把现有配置先存成一条,避免丢失。 On first launch, if you already have a Codex / Claude Code config, choose to import it as the default provider so nothing is lost.

02 接 Codex(GPT 系列)Codex (GPT models)

在 CC Switch 里切到 Codex 应用 → 右上角 + → 预设选 自定义,然后按下表填。 Switch to the Codex app in CC Switch → + in the top right → pick the Custom preset, then fill in the table below.

端点Endpoint  协议Wire API  responses 推荐模型Model  gpt-5.5

如果它让你直接编辑 JSON / TOML,粘这两段就行(把 你的KEY 换成实际的 key): If it drops you into the raw JSON / TOML editor, paste these (replace YOUR_KEY):

# ~/.codex/auth.json
{
  "OPENAI_API_KEY": ""
}
# ~/.codex/config.toml
model_provider = "ainzy"
model = "gpt-5.5"
model_reasoning_effort = "high"
disable_response_storage = true

[model_providers.ainzy]
name = "ainzy"
base_url = ""
wire_api = "responses"
requires_openai_auth = true

03 接 Claude CodeClaude Code

切到 Claude 应用 → + → 预设选 自定义 Switch to the Claude app → +Custom preset:

{
  "env": {
    "ANTHROPIC_BASE_URL": "",
    "ANTHROPIC_AUTH_TOKEN": ""
  }
}

04 多把 key 怎么管Managing several keys

这才是用 CC Switch 的主要理由。一个分组建一条 provider,名字直接写分组名,别拿一条来回改——改来改去很容易把上一条覆盖掉。 This is the main reason to use it. One provider per group, named after the group. Don’t keep editing a single entry back and forth — that’s how you overwrite the previous one.

05 出问题先看这里Troubleshooting

现象Symptom 原因 / 处理Cause / fix
401 key 抄错,或者前后带了空格 / 换行。重新复制一遍,别手打。 Wrong key, or stray spaces/newlines around it. Re-copy it; don’t retype.
404 端点填错。Codex 用 (带 /v1);Claude Code 用 不带 /v1)。 Wrong endpoint. Codex uses (with /v1); Claude Code uses (without /v1).
「获取模型」失败Fetch models fails 401 就是 key 的问题;超时先查网络。我们的 /v1/models 是通的。 401 means the key; a timeout means the network. Our /v1/models works.
模型不存在 / 无可用渠道Model not found / no channel 这把 key 所在分组没有那个模型。点「获取模型」看真实清单,别照抄别人的模型名。 That model isn’t in your key’s group. Hit fetch-models for the real list instead of copying someone else’s model name.
改了配置没反应Changes have no effect 十有八九是没重开终端;再不行就是机器上还有别的工具在写同一个配置文件,先把它还原掉。 Nine times out of ten you didn’t open a new terminal; otherwise another tool on the machine is writing the same config file — undo that one first.
桌面应用卡在
「完成 Windows 设置」
Desktop app stuck on
“Finish Windows setup”
跟 CC Switch 和我们都无关,是 ChatGPT 桌面应用自带的 Windows 沙箱组件装不上(OpenAI 侧已知问题)。改用 Codex CLI 就能绕开。 Unrelated to CC Switch or to us — it’s the ChatGPT desktop app’s Windows sandbox component failing to install (a known OpenAI-side issue). Use the Codex CLI instead and it’s bypassed.

06 关于你的 keyAbout your keys

CC Switch 把所有供应商配置(含 key)存在本机 ~/.cc-switch/cc-switch.db,备份在 ~/.cc-switch/backups/,都是明文的本地文件,不上传。所以:这台机器谁能登录,谁就能看到你的 key。共用电脑请用完删掉 provider。 CC Switch keeps every provider config (keys included) in ~/.cc-switch/cc-switch.db locally, with backups in ~/.cc-switch/backups/. Plain local files, never uploaded — which also means anyone who can log into this machine can read your keys. On a shared computer, delete the provider when you’re done.

导出的 .sql 备份里同样含 key,别往群里发。key 泄露了就到控制台重置一把新的。 Exported .sql backups contain the keys too — don’t share them. If a key leaks, rotate it from the console.

另外,它里面有个「用 ChatGPT 账号登录反代 Codex」的功能——那是拿你自己的 ChatGPT 订阅走逆向 OAuth,跟 Ainzy 无关,有封号风险,用不用你自己判断。 It also ships a “log in with ChatGPT to reverse-proxy Codex” feature — that uses your own ChatGPT subscription over a reverse-engineered OAuth flow, has nothing to do with Ainzy, and carries account-ban risk. Your call.