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 等命令行工具的供应商配置。装好之后,回到 的「API 密钥」页,找到要用的 key,点一下「导入到 CCS」,端点、key、模型会自动帮你填好——不用抄任何一行配置。 CC Switch is an open-source (MIT) desktop utility that manages provider configs for Claude Code, Codex, Gemini CLI and friends. Once it’s installed, go to the API Keys page on , find the key you want, and click “Import to CCS” — the endpoint, key and model are filled in for you automatically. No config to copy by hand.

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 一键接入(推荐,全程不用复制粘贴)One-click import (recommended, nothing to copy)

先点上面的「下载 CC Switch」装好最新版,然后: First click “Download CC Switch” above and install the latest build, then:

  1. 打开 「API 密钥」页。 Open the API Keys page at .
  2. 找到要用的那把 key,点它右侧操作里的「导入到 CCS」 Find the key you want to use and click “Import to CCS” in its row actions.
  3. 浏览器会跳出去拉起 CC Switch,自动新增一条 provider——端点、key、模型全部帮你填好,Claude Code / Codex / Gemini CLI 用的格式也会自动选对。 Your browser hands off to CC Switch, which adds a new provider automatically — endpoint, key and model are already filled in, and the right format for Claude Code / Codex / Gemini CLI is picked for you.
  4. CC Switch 里点启用就行。Codex 记得开新终端再跑,Claude Code 记得开新会话——旧终端/旧会话里的环境变量不会自己更新。 Hit Enable in CC Switch. Then open a fresh terminal before running codex, or start a new session in Claude Code — an existing shell/session keeps its old environment.
导入按钮打不开 CC Switch?点这里看手动填的值 Import button not opening CC Switch? Click here for the values to fill in by hand
Codex 端点Codex endpoint  Claude Code 端点Claude Code endpoint  协议Wire API  responses (Codex)/ Anthropic Messages(Claude)(Codex) / Anthropic Messages (Claude)

在 CC Switch 里对应应用(Codex / Claude)下手动 + 一条 自定义 provider,端点填上面对应的值,key 填你自己的,其余保持默认——尤其不要打开「需要本地路由映射」。这条路径只是兜底,正常情况用第 3 步的一键导入就够了。 Add a Custom provider under the matching app (Codex / Claude) in CC Switch, use the endpoint above, your own key, and leave the rest at defaults — in particular don’t turn on “requires local routing”. This is only a fallback; step 3’s one-click import is enough in normal use.

02 多把 key 怎么管Managing several keys

这才是用 CC Switch 的主要理由。每把 key 都用一次「导入到 CCS」,一个分组一条 provider,名字默认就是分组名,别拿一条来回改——改来改去很容易把上一条覆盖掉。 This is the main reason to use it. Run “Import to CCS” once per key — one provider per group, named after the group by default. Don’t keep editing a single entry back and forth — that’s how you overwrite the previous one.

03 出问题先看这里Troubleshooting

现象Symptom 原因 / 处理Cause / fix
点「导入到 CCS」没反应“Import to CCS” does nothing CC Switch 没装,或者装的是旧版没注册好协议。先按第 1 步装最新版,装完重新点一次导入按钮(不用刷新页面)。 CC Switch isn’t installed, or an old build didn’t register the protocol handler. Install the latest build from step 1, then click import again — no page refresh needed.
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.

04 关于你的 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.