简报·YT
← 返回 GitHub 动态
farion1231/cc-switch · ⭐ 已Star 已完成

farion1231/cc-switch v3.20.1

2026-08-28 00:43 · ⭐ 13万 · GitHub Release 原文 ↗
#Codex适配 #账号安全 #性能优化

farion1231/cc-switch v3.20.1

本版核心是适配 Codex CLI 0.149 的第三方切换硬账:切换改为 config-only 模式,密钥随供应商表走,根治 401「Missing API key」;同时修复同一 ChatGPT Team workspace 下多个账号互相覆盖的问题。

新增能力

修复问题

性能优化

破坏性变更 / 升级提醒

▸ Release Notes 英文原文(16957 字符)
# CC Switch v3.20.1 > 这一版围绕 Codex 补两笔硬账:**适配 Codex CLI 0.149**——第三方切换 401「Missing API key」的根治:切换改为 config-only,密钥随供应商表走、不再进 `auth.json`,一族让 0.149 拒绝启动的历史配置形态也在每次切换时自动修复;**同一 ChatGPT Team workspace 的多个账号不再互相覆盖**——存量托管账号需逐个重新登录一次(见升级提醒)。数据可靠性另有三条硬修复:供应商编辑必达 live 配置、Codex 编辑框不再串染别张卡的密钥、恢复备份不再清空手写的 prompt 文件。用量侧新增「自动扫描会话记录」开关,大会话文件的扫描从秒级降到毫秒级。本版**包含数据库迁移(v17 → v18)**,升级前自动备份,降级需还原备份。 **[English →](https://github.com/farion1231/cc-switch/blob/v3.20.1/docs/release-notes/v3.20.1-en.md) | [日本語版 →](https://github.com/farion1231/cc-switch/blob/v3.20.1/docs/release-notes/v3.20.1-ja.md)** --- ## 重点内容:你现在可以 - **在 Codex CLI ≥ 0.149 上正常切换第三方供应商**([#6744](https://github.com/farion1231/cc-switch/issues/6744)):0.149 起自定义 provider 不再从 `auth.json` 继承环境凭据,以旧默认方式(密钥只写 `auth.json`)完成的第三方切换一律 401。切换现已整体改为 config-only——密钥写进供应商自己的 `[model_providers.*]` 表(`experimental_bearer_token`,Codex 0.48 起支持),`auth.json` 回归纯粹的官方 ChatGPT 登录文件。 - **让同一 Team workspace 的多个 ChatGPT 账号安全共存**([#6780](https://github.com/farion1231/cc-switch/pull/6780),修复 [#2245](https://github.com/farion1231/cc-switch/issues/2245)):此前账号以 workspace ID 为主键,同一 Team 两名成员会合并成一条记录、后登录者静默覆盖前者的令牌。现在同 workspace 登录并存为独立账号行,接管下的请求还会校验账号一致性——绝不把账单记到另一名成员头上。 - **相信「保存成功」四个字**([#6779](https://github.com/farion1231/cc-switch/pull/6779)):崩溃残留的接管备份行曾让活跃供应商的编辑只更新数据库、真正的配置文件纹丝不动。所有权判定已重建,编辑必达 live 配置。 - **在编辑框里看到这张卡自己的密钥**([#6534](https://github.com/farion1231/cc-switch/pull/6534),修复 [#6414](https://github.com/farion1231/cc-switch/issues/6414)):共享的 `auth.json` 没有供应商身份,编辑活跃 Codex 供应商可能显示——保存后固化——另一张卡遗留的 key,同 base URL 的卡密钥互相趋同、报「model not found」。表单现在从 `config.toml` 里该卡自己的 bearer token 重建密钥。 - **放心恢复备份**([#6810](https://github.com/farion1231/cc-switch/pull/6810),修复 [#6778](https://github.com/farion1231/cc-switch/issues/6778)):云端快照没有任何已启用 prompt 时,WebDAV/S3 下载或备份导入不再把本地手写的 `CLAUDE.md` / `AGENTS.md` / `GEMINI.md` / `SOUL.md` 清成空文件。 - **关掉后台会话扫描**:用量页新增「自动扫描会话记录」开关,关闭即手动模式——仅在点击「立即同步」时扫描本地会话记录;代理接管的请求记账实时落库、与会话文件无关,照常记录。 - **看到 OpenCode Go 的订阅额度**:用量脚本的 Token Plan 查询现在识别 OpenCode Go,5 小时 / 周 / 月三个窗口的用量百分比与重置时间进入用量卡与托盘。 - **在 macOS 上把终端设为 Otty**([#6620](https://github.com/farion1231/cc-switch/pull/6620)):会话恢复、供应商终端与工具命令三处入口都可选。 - **让大会话文件的扫描从秒级降到毫秒级**:Claude 会话日志改为字节游标增量扫描,12 MB 活跃会话文件从整读 6.04 秒降到增量 9.3 毫秒。 --- ## 使用攻略 - **[添加供应商](https://github.com/farion1231/cc-switch/blob/v3.20.1/docs/user-manual/zh/2-providers/2.1-add.md)**:Codex config-only 切换后的供应商管理入口。 - **[用量统计](https://github.com/farion1231/cc-switch/blob/v3.20.1/docs/user-manual/zh/4-proxy/4.4-usage.md)**:会话扫描开关与 Token Plan 额度查询的口径。 --- > [!WARNING] > > ## 唯一官方渠道声明(请务必阅读) > > CC Switch 是**完全免费、开源**的桌面应用,**不会向用户收取任何费用**。请仅通过下列官方渠道获取本软件: > > | 类别 | 唯一官方 | > | -------- | ------------------------------------------------------------------------------ | > | 官网 | **[ccswitch.io](https://ccswitch.io)** | > | 源码 | **[github.com/farion1231/cc-switch](https://github.com/farion1231/cc-switch)** | > | 下载 | **[GitHub Releases](https://github.com/farion1231/cc-switch/releases)** | > | 作者 | **[@farion1231](https://github.com/farion1231)** | > | 举报山寨 | **[GitHub Issues](https://github.com/farion1231/cc-switch/issues)** | > > **任何向你收费、要求充值、或索取登录凭据的"CC Switch"网站或客户端均为假冒**。如果你被诱导支付了费用,请立即停止操作并通过 GitHub Issues 反馈。 --- ## 概览 这一版的主线在 Codex,起点是一次上游的兼容性断裂:Codex CLI 0.149 收紧了凭据继承,自定义 provider 不再读取 `auth.json` 里的环境凭据,以旧默认方式写入的第三方切换全部 401。CC Switch 的应对不是打补丁,而是把第三方切换整个改成 config-only——密钥随供应商自己的配置表走,`auth.json` 回归纯粹的官方 ChatGPT 登录文件;同时一族让 0.149 拒绝加载的历史配置形态(占用保留 id 的旧表、缺 `name` 的表、顶层 `openai_base_url` 旧式路由)在每次切换与接管投影时自动修复,并新增写前预检——0.149 无法加载的组合会被点名拒绝,而不是「切换成功」之后 Codex 起不来。 第二条主线是账号与数据安全:同一 ChatGPT Team workspace 的成员在认证中心不再互相覆盖(存量托管账号需重登一次);供应商编辑保证必达 live 配置;Codex 编辑框不再串染别张卡的密钥;恢复备份不再清空手写的 prompt 文件。用量侧,会话扫描获得自动/手动开关与字节游标增量扫描(6.04 秒 → 9.3 毫秒),并顺手修掉三个 Claude 会话记账的正确性缺陷——这也是本版唯一数据库迁移(v17 → v18)的由来。 **发布日期**:2026-08-28 **更新规模**:26 commits | 66 files changed | +7,474 / -1,000 lines --- ## 新功能 ### 会话记录扫描:自动/手动模式 用量页新增「自动扫描会话记录」卡片与开关(默认开启,升级后行为不变)。关闭后停止一切后台会话扫描——包括启动时的首轮——并出现「立即同步」按钮作为手动入口,完成后以提示显示导入条数、扫描文件数与错误计数。代理接管的请求记账是实时落库、从不读会话文件,无论开关如何都照常记录;启动时的成本回填只修数据库既有行,手动模式下也照常执行。 ### OpenCode Go 订阅用量 用量脚本的 Token Plan 查询现在识别 OpenCode Go,在用量卡与托盘显示 5 小时 / 周 / 月三个窗口的用量百分比与重置时间,复用既有的配额层级展示。该端点只认 Bearer 认证(与推理侧只认 `x-api-key` 恰好相反);密钥有效但未订阅 Go 计划时显示明确的提示(HTTP 403)而不是笼统的认证失败,零用量窗口会丢弃上游的占位重置时间,无法识别的响应形状报错而不是空卡。在 Claude Code、Claude Desktop、Codex、OpenCode 与 Pi 新添加的 OpenCode Go 供应商自动启用查询;OpenCode Zen 按量付费刻意不覆盖——该计划上游没有用量 API。 ### Otty 终端支持(macOS) 「Otty」加入 macOS 终端选择器,覆盖会话恢复、供应商终端与工具命令三处入口。启动时先尝试经 Otty CLI 在既有窗口开新标签页,再退到新开 Otty 窗口;供应商终端与工具命令在失败时进一步回退到 Terminal.app,而会话恢复失败则直接报错——Otty CLI 缺失时附明确的安装提示——并把命令复制到剪贴板。CLI 探测覆盖应用包(系统与用户级)、Homebrew 路径与 PATH。用户手册的 macOS 终端表格也顺带修正——Kaku 与 Warp 早已支持却漏在表外。([#6620](https://github.com/farion1231/cc-switch/pull/6620)) --- ## 变更 ### Codex 第三方切换改为 config-only 切换到第三方 Codex 供应商时,密钥现在写进该供应商自己的 `[model_providers.*]` 表(`experimental_bearer_token` 字段,Codex 0.48 起支持),**不再写进 `auth.json`**——它回归纯粹的官方 ChatGPT 登录文件。背景是 Codex 0.149 停止让自定义 provider 从 `auth.json` 继承环境凭据,以旧默认方式(密钥只写 `auth.json`)完成的第三方切换从此 401。 「非接管切换时保留官方登录」开关随之只剩一个含义:开启时官方 ChatGPT 登录在第三方切换中完全不被触碰;关闭时**删除** `auth.json` 而不是用 API 密钥覆盖它(删除失败会弹出警告,提示官方登录仍留在 Codex 配置目录中)。两道安全闸现在在**每次第三方切换**都执行、不再只限保留模式:有密钥却没有任何 provider 表可以承载,或没有密钥却会回退到官方登录(`requires_openai_auth = true` 且无自有凭据,或裸的顶层 `openai_base_url` 路由),都会被点名拒绝——包括配置为空的第三方卡,它们此前一直静默搭乘 `auth.json`。活跃的带密钥第三方表上的 `requires_openai_auth` 会在每次直接切换时按保留开关重新戳记,让 Codex 的登录界面与磁盘上的实际状态一致。([#6744](https://github.com/farion1231/cc-switch/issues/6744)、[#6746](https://github.com/farion1231/cc-switch/pull/6746)) ### TeamoRouter 预设迁至 teamorouter.cn 八个应用的预设全部指向 `api.teamorouter.cn`,旧 `.com` 端点在 Claude Code、Claude Desktop、Codex 与 Grok Build 上注册为可选择、可测速的后备端点。已保存的存量 TeamoRouter 供应商保持各自原有的 Base URL 不变。 --- ## 修复 ### 同一 workspace 的 ChatGPT 账号不再在认证中心合并 托管的 Codex OAuth 账号此前以 `chatgpt_account_id` 为主键——它标识的是 ChatGPT workspace 而不是人:同一 Team workspace 的两名成员会坍缩成一条记录,后登录者静默覆盖前者的令牌,供应商绑定跟着指向最后登录的人。账号现在以本地身份建键、保留 OIDC subject 作为用户身份凭证,同 workspace 登录并存为独立账号行。经接管路由的请求会额外对照绑定账号的 live 令牌校验:仍持有另一名成员登录态的 Codex 会话得到「请重启 Codex」的明确报错,而不是以错误身份被转发;外发的 workspace 请求头一律来自账号绑定而不是客户端自报。收养 CLI 轮转过的刷新令牌、以及移除账号时删除 `auth.json`,现在都要求可证明的所有权——CC Switch 不再可能收养或删除同 workspace 另一名成员的登录。每条账号行提供就地「重新登录」(绑定保留);取消或被取代的设备登录会在 CC Switch 内部丢弃等待中的流程——被放弃的浏览器授权无法在几分钟后被提交、悄悄覆盖账号。不是合法 JWT 形状的 id_token 不再产生任何身份——畸形或截断的令牌永远无法冒充用户。([#6780](https://github.com/farion1231/cc-switch/pull/6780)、[#6831](https://github.com/farion1231/cc-switch/pull/6831),修复 [#2245](https://github.com/farion1231/cc-switch/issues/2245)) ### Codex 0.149 兼容修复族:存量配置不再让 Codex 拒绝启动 一族让 Codex 0.149 拒绝加载的配置形态——用户侧表现为「CC Switch 显示切换成功,Codex 却起不来」——现在在每次供应商切换与接管投影时自动修复。具体包括:早期接管投影写下的 `[model_providers.openai]` / `.ollama` / `.lmstudio` 遗留表(覆盖保留 id 会导致校验失败)被无损改名为 CC Switch 自有 id 并归一为可加载形状;没有 `name` 的 provider 表被回填(0.149 会因任何一张缺名表拒绝整份配置——Bedrock 表刻意保持无名,命名会破坏其内置合并);携带可用密钥的旧式顶层 `openai_base_url` 路由被迁移成正规的自定义 provider 表(无密钥的这类路由会被切换时的安全闸拒绝);新的写前预检对 0.149 无法加载的字段组合点名拒绝,而不是写出去当作「切换成功」。接管路由指向内置 `openai` provider 的卡改用官方支持的顶层字段而不是制造保留表,指向 `ollama` / `lmstudio` 的卡接管时显式报错。保留 id 清单与上游完全一致(大小写敏感;补入 `amazon-bedrock-runtime`,旧的 `oss` / `ollama-chat` 按普通自定义 provider 对待——它们的密钥终于能到达自己的表),内联的 `model_providers` 表也能接到注入的令牌,而不是留下一个死的顶层字段。 ### 被拒绝的切换不再腐坏被拒的那张卡 live 写入校验现在作为预检、在当前供应商指针移动之前执行。此前写入层的拒绝发生在 `current` 已提交之后——下一次切换会把旧的 live 配置回填进这张被拒供应商的已存设置。 ### 供应商编辑必达 live 配置文件 崩溃或恢复失败残留的接管备份行,会让活跃供应商的保存(Claude Desktop 除外)走上接管路径——只更新数据库与备份行,真正的配置文件无限期保持旧端点旧密钥。所有权现在由单一谓词裁定,要求接管的实际证据(live 文件中有占位符,或代理已启用且运行中且有备份行,或切换过程持有 per-app 锁且有备份行);过期的备份行被刷新为与所编辑供应商一致,而不是劫持写入。统一供应商保存现在还会把每个生成的子配置重新投影到以它为活跃供应商的应用的 live 配置,逐应用报出失败名称而不是一律报成功。([#6779](https://github.com/farion1231/cc-switch/pull/6779)) ### Codex 编辑框不再显示另一张卡的密钥 开启官方登录保留时,`auth.json` 是一个没有供应商身份的共享槽位,而编辑框播种表单时曾优先读它——编辑活跃的 Codex 供应商可能显示、并在保存时固化另一张卡遗留的密钥,让共享同一 Base URL 的卡密钥互相趋同(表现为「model not found」)。编辑框现在从 `config.toml` 里该供应商自己的 bearer token 重建密钥;官方类与纯 OAuth 供应商不受影响,而 `config.toml` 里没有自有 bearer token 的卡——旧版或手工维护的形态,本版起每次第三方切换都会写入——保持原有行为、继续读取 live `auth.json`(含手工修改)。([#6534](https://github.com/farion1231/cc-switch/pull/6534),修复 [#6414](https://github.com/farion1231/cc-switch/issues/6414)) ### 恢复不再清空非受管的 prompt 文件 WebDAV/S3 下载或备份导入时,若快照里某应用没有任何已启用的 prompt,该应用的 live prompt 文件(`CLAUDE.md` / `AGENTS.md` / `GEMINI.md` / `SOUL.md`)会被截断为空——摧毁从未进入同步载荷的本地手写内容。这样的恢复现在完全不碰该文件;从提示词面板里禁用最后一条 prompt 仍会照旧清空它。([#6810](https://github.com/farion1231/cc-switch/pull/6810),修复 [#6778](https://github.com/farion1231/cc-switch/issues/6778)) ### 恢复界面的退出按钮真的能退出了 `process:allow-exit` 权限缺失,v3.20.0 上「数据库版本过新」恢复界面的退出按钮、以及配置加载失败后的退出调用都被 IPC 层静默拒绝:退出按钮毫无反应(关闭窗口仍可退出),配置加载失败后应用径直进入正常界面而不是按设计退出。该问题由 @SaladDay 在 [#6567](https://github.com/farion1231/cc-switch/pull/6567) 更早独立发现并率先修复。 ### Claude 会话记账正确性三修 随增量扫描器落地的三个数据准确性修复,均针对 Claude 会话日志路径。写到一半的日志行曾被旧的行号游标永久跳过(未完成的尾部推进了游标,补全后的消息再也不会被导入)——字节游标只在完整行之后提交,该消息下一轮即被拾取。被外部截断或改写的会话文件**从不重放**:重新导入明细行已被 30 天汇总清理的条目会让总数永久虚高,因此游标钉在新的文件末尾,被跳过的范围报告进同步结果的错误列表而不是静默丢弃(截断由游标越界发现,同尺寸改写由游标前字节的指纹发现)。文件中途的读取错误现在保留已提交的进度、下一轮从原处续读并上报,而不是返回一次干净的成功;游标预取失败会中止本轮,而不是表现得像首次扫描、把历史重复导入一遍。 --- ## 性能 ### Claude 会话日志:字节游标增量扫描 每轮扫描现在直接定位到上次提交的字节偏移、只读新追加的部分,而不是把变更过的文件从头读到尾——按改动自带的基准测试,12 MB 的活跃会话文件从整读解析 6.04 秒降到增量读取 9.3 毫秒。Claude、Gemini、OpenCode、Grok Build 与 Pi 的逐文件游标改为每个导入器每轮一次整表预取,而不是逐文件查询;Claude 路径上每个文件的导入与游标推进在同一事务中提交。1,017 个会话文件(409 MB)的冻结快照回放产出与旧扫描器逐位一致的汇总。需要一次 schema 迁移(v17 → v18),新增两个可空列——字节游标与尾部指纹;既有的行号游标在首轮扫描时就地转换,不重复导入任何内容。 ### Pi 会话去重走上身份索引 合并的去重查询(跨两个身份列的 OR)只能约束数据源前缀,每条解析记录都要扫过账本里整个 Pi 区段——Pi 导入随用量历史增长越来越慢。现拆分为可走索引的点查询、结果完全一致,导入耗时不再随历史规模退化。([#6667](https://github.com/farion1231/cc-switch/pull/6667)) --- ## 升级提醒 ### 本版包含数据库迁移,降级需还原备份 schema 从 v17 迁移到 v18(会话扫描游标表新增字节游标与尾部指纹两列),迁移前自动创建备份。本版运行过一次后,旧版 CC Switch 会拒绝打开数据库——降级需还原该备份。旧的半行缺陷已漏掉的用量条目不做追溯找回——重放它们与重复导入已汇总的历史无法区分。 ### Codex OAuth 存量账号需要重新登录一次 本版之前添加的每个托管 ChatGPT(Codex OAuth)账号都处于隔离状态,直到你在认证中心该账号行上点击「重新登录」——老记录以 ChatGPT workspace ID 为账号主键、没有单独记录的用户身份,普通的令牌刷新无法证明老记录属于哪个用户。供应商绑定会被保留,重新登录就地更新账号。请务必用账号行上的「重新登录」按钮:通过「添加账号」再登一次只会新建第二条记录(登录不再按 workspace 合并),老记录——以及绑定它的供应商——依然处于隔离状态。([#6780](https://github.com/farion1231/cc-switch/pull/6780)) ### Codex 0.48 以前的版本失去第三方鉴权 config-only 切换写入的 provider 表令牌字段,0.48 以前的 Codex 从不读取。还在用旧版 Codex 的用户请升级 Codex。 ### 保留开关关闭时,切换第三方会删除 auth.json 「非接管切换时保留官方登录」开关**关闭(默认)**时,切换到第三方 Codex 供应商现在会**删除** `auth.json`,而不是用 API 密钥覆盖它。要找回 ChatGPT 登录:切换到绑定了认证中心账号的官方供应商即可(登录会从托管账号完整写回);跟随 Codex CLI 自身登录的未绑定官方卡则需要跑一次 `codex login`。想让官方登录跨第三方切换存活,把开关打开即可。 ### 部分以前「能用」的 Codex 卡现在会在切换时被拒绝 配置为空的第三方卡(没有表可以承载密钥),以及依赖 `requires_openai_auth = true` 或裸 `openai_base_url` 路由去借用官方登录的无密钥卡,现在都会被点名拒绝。给这类卡补上正规的 `[model_providers.<id>]` 条目或 API 密钥即可。 ### 存量 Codex 配置会在下次写入 live 时按 0.149 需要被重写 带可用密钥的旧式 `openai_base_url` 路由变成 `[model_providers.cc-switch]` 表、占用保留 id 的遗留表改名为 CC Switch 自有 id、缺失的 `name` 字段被回填;活跃带密钥第三方表上的 `requires_openai_auth` 在每次切换时按保留开关覆盖——你在该表上手工设置的值不会在切换后存活。 ### 截断或被外部改写的 Claude 会话日志将被永久跳过(设计使然) 被改写的范围不重放(重放会与已清理的汇总重复计数),跳过的情况会报告在同步结果的错误列表里。 ### #6534 修复前已经串染的密钥不会自动修复 如果共享同一 Base URL 的 Codex 供应商已经趋同到同一个 key,请在每张受影响的卡上重新填一次正确的密钥。 ### 恢复行为变化(#6810) 恢复一份某应用没有任何已启用 prompt 的快照,现在会保留该应用的 live prompt 文件——客户端继续加载旧内容,即使提示词面板显示全部禁用。想清空它,在面板里启用再禁用一条 prompt(或自行编辑文件)。 ### 统一供应商保存现在可能明确报错 若某应用的活跃供应商是生成的子配置、而其 live 配置文件写入失败,保存会报出该应用名称;数据库记录仍已保存——重试同步或重新切换一次该应用的供应商即可。 ### TeamoRouter 存量供应商保持 `api.teamorouter.com` 从预设重新添加、或手动修改 Base URL,即可迁到 `.cn`。 ### OpenCode Go 用量查询只对本版之后新增的供应商自动启用 存量卡请打开其用量脚本设置,选择 Token Plan 模板 → OpenCode Go 一次。 --- ## 风险提示 ### 沿用的提示 **xAI Grok OAuth 登录**:复用官方 Grok CLI 的公开 OAuth 客户端身份,使用可能导致账号被限制或封禁——详见 [v3.18.0 release notes](https://github.com/farion1231/cc-switch/blob/v3.20.1/docs/release-notes/v3.18.0-zh.md#风险提示)。 **Codex OAuth 反向代理**:使用 ChatGPT 订阅的 Codex OAuth 反代可能违反 OpenAI 服务条款,详情见 [v3.13.0 release notes](https://github.com/farion1231/cc-switch/blob/v3.20.1/docs/release-notes/v3.13.0-zh.md#️-风险提示)。 **SuperGrok 配额查询**:供应商卡片的配额展示依赖 grok.com 的非公开计费端点,xAI 调整接口后可能失效——详见 [v3.19.0 release notes](https://github.com/farion1231/cc-switch/blob/v3.20.1/docs/release-notes/v3.19.0-zh.md#风险提示)。 **第三方供应商路由**:通过 CC Switch 本地代理把 Codex、Claude Desktop 或 Grok Build 的请求转换并转发到第三方供应商时,各供应商对计费、合规与数据留存的约束不同,请在使用前阅读目标供应商的服务条款。 用户启用上述功能即表示自行承担相关风险。CC Switch 不对因使用这些功能而导致的任何账号限制、警告或服务暂停承担责任。 --- ## 致谢 本版 26 个提交里有 8 个来自 5 位外部贡献者。 ### 代码贡献 - 感谢 @SaladDay:workspace 账号隔离整条主线([#6780](https://github.com/farion1231/cc-switch/pull/6780))、JWT 身份解析对齐([#6831](https://github.com/farion1231/cc-switch/pull/6831))与 Pi 会话去重索引([#6667](https://github.com/farion1231/cc-switch/pull/6667));退出按钮的权限缺失也是他在 [#6567](https://github.com/farion1231/cc-switch/pull/6567) 更早独立发现并率先修复的。 - 感谢 @YUZHEthefool:供应商编辑必达 live 配置([#6779](https://github.com/farion1231/cc-switch/pull/6779),与 @BingZi-233 协作)与 Codex 编辑框密钥串染修复([#6534](https://github.com/farion1231/cc-switch/pull/6534))——「修复」章节里两条数据正确性硬修复尽出于此。 - 感谢 @SailingLoong:恢复不再清空非受管 prompt 文件([#6810](https://github.com/farion1231/cc-switch/pull/6810))。 - 感谢 @yovinchen:Otty 终端支持([#6620](https://github.com/farion1231/cc-switch/pull/6620))。 - 感谢 @ISuuuu:WSL2 契约测试改走预编译产物([#6472](https://github.com/farion1231/cc-switch/pull/6472))。 ### 问题反馈 - 感谢 @hlwhl 在 [#6744](https://github.com/farion1231/cc-switch/issues/6744) 对 Codex 0.149 凭据继承变化的精确报告——直接框定了本版最大主线的方向,并率先提出了修复 PR([#6746](https://github.com/farion1231/cc-switch/pull/6746))。 - 感谢 Team workspace 账号互覆问题的各位报告者:@cp7553479([#2245](https://github.com/farion1231/cc-switch/issues/2245))、@Smilenize([#5885](https://github.com/farion1231/cc-switch/issues/5885))、@yingjiezhao0820([#6688](https://github.com/farion1231/cc-switch/issues/6688))与 @buqi759([#6738](https://github.com/farion1231/cc-switch/issues/6738))。 - 感谢密钥串染家族的报告者:@Joaging([#6414](https://github.com/farion1231/cc-switch/issues/6414))、@KawaiiSh1zuku([#6594](https://github.com/farion1231/cc-switch/issues/6594))与 @Michael-py001([#6827](https://github.com/farion1231/cc-switch/issues/6827))。 - 感谢 @gyzerocc 报告 WebDAV 恢复清空 AGENTS.md([#6778](https://github.com/farion1231/cc-switch/issues/6778))——精确指出了触发条件。 --- ## 下载与安装 访问 [Releases](https://github.com/farion1231/cc-switch/releases/latest) 下载对应版本,或从官网 [ccswitch.io](https://ccswitch.io) 获取(下载经 Cloudflare 边缘节点分发,不依赖 GitHub 可达)。 ### 系统要求 | 系统 | 最低版本 | 架构 | | ------- | -------------------------- | ----------------------------------- | | Windows | Windows 10 及以上 | x64 / ARM64 | | macOS | macOS 12 (Monterey) 及以上 | Intel (x64) / Apple Silicon (arm64) | | Linux | 见下表 | x64 / ARM64 | ### Windows | 文件 | 说明 | | ---------------------------------------- | ----------------------------------- | | `CC-Switch-v3.20.1-Windows.msi` | **推荐** - MSI 安装包,支持自动更新 | | `CC-Switch-v3.20.1-Windows-Portable.zip` | 便携版,解压即用,不写入注册表 | Windows ARM64 设备请选择文件名中带 `arm64` 标识的对应制品。 ### macOS | 文件 | 说明 | | -------------------------------- | --------------------------------------------- | | `CC-Switch-v3.20.1-macOS.dmg` | **推荐** - DMG 安装包,拖入 Applications 即可 | | `CC-Switch-v3.20.1-macOS.zip` | 解压后拖入 Applications,Universal Binary | | `CC-Switch-v3.20.1-macOS.tar.gz` | 用于 Homebrew 安装和自动更新 | Homebrew 安装: ```bash brew install --cask cc-switch ``` 更新: ```bash brew upgrade --cask cc-switch ``` ### Linux Linux 资产同时提供 **x86_64** 和 **ARM64**(`aarch64`)两种架构。资产文件名中包含架构标识,请按你机器的 `uname -m` 输出选择对应版本: - `CC-Switch-v3.20.1-Linux-x86_64.AppImage` / `.deb` / `.rpm` - `CC-Switch-v3.20.1-Linux-arm64.AppImage` / `.deb` / `.rpm` | 发行版 | 推荐格式 | 安装方式 | | --------------------------------------- | ----------- | ---------------------------------------------------------------------- | | Ubuntu / Debian / Linux Mint / Pop!\_OS | `.deb` | `sudo dpkg -i CC-Switch-*.deb` 或 `sudo apt install ./CC-Switch-*.deb` | | Fedora / RHEL / CentOS / Rocky Linux | `.rpm` | `sudo rpm -i CC-Switch-*.rpm` 或 `sudo dnf install ./CC-Switch-*.rpm` | | openSUSE | `.rpm` | `sudo zypper install ./CC-Switch-*.rpm` | | Arch Linux / Manjaro | `.AppImage` | 添加执行权限后直接运行,或使用 AUR | | 其他发行版 / 不确定 | `.AppImage` | `chmod +x CC-Switch-*.AppImage && ./CC-Switch-*.AppImage` |
▸ 主项目介绍 · farion1231/cc-switch
▸ README 原文(同步于 2026-07-20 03:47)
<div align="center"> # CC Switch ### The All-in-One Manager for Claude Code, Claude Desktop, Codex, Gemini CLI, Grok Build, OpenCode, OpenClaw & Hermes Agent [![Version](https://img.shields.io/github/v/release/farion1231/cc-switch?color=blue&label=version)](https://github.com/farion1231/cc-switch/releases) [![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20macOS%20%7C%20Linux-lightgrey.svg)](https://github.com/farion1231/cc-switch/releases) [![Built with Tauri](https://img.shields.io/badge/built%20with-Tauri%202-orange.svg)](https://tauri.app/) [![Downloads](https://img.shields.io/github/downloads/farion1231/cc-switch/total)](https://github.com/farion1231/cc-switch/releases/latest) <a href="https://trendshift.io/repositories/15372" target="_blank"><img src="https://trendshift.io/api/badge/repositories/15372" alt="farion1231%2Fcc-switch | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a> <a href="https://www.star-history.com/#farion1231/cc-switch&Date"><picture><source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/badge?repo=farion1231/cc-switch&theme=dark" /><img alt="Star History Rank" src="https://api.star-history.com/badge?repo=farion1231/cc-switch" width="196" height="55" /></picture></a> ### 🌐 The Only Official Website: **[ccswitch.io](https://ccswitch.io)** English | [中文](README_ZH.md) | [日本語](README_JA.md) | [Deutsch](README_DE.md) | [Changelog](CHANGELOG.md) </div> ## ❤️Sponsor > [Want to appear here?](mailto:farion1231@gmail.com) <details open> <summary>Click to collapse</summary> [![Kimi K2.7 Code](assets/partners/banners/kimi-banner-en.png)](https://platform.kimi.ai?aff=cc-switch) Kimi K2.7 Code is an open-source, coding-focused agentic model developed by Moonshot AI. It delivers stronger coding and agent performance, with substantial improvements in real-world long-horizon coding tasks. These gains translate into higher end-to-end task success rates across complex software engineering workflows. K2.7 Code also improves reasoning efficiency, reducing thinking-token usage by approximately 30% compared with K2.6. **[Click here to start using Kimi](https://platform.kimi.ai?aff=cc-switch)** Doing mostly coding work? Try the **[Kimi For Coding plan](https://www.kimi.com/code/?aff=cc-switch)** — a subscription service built for coding! --- <table> <tr> <td width="180"><a href="https://www.packyapi.com/register?aff=cc-switch"><img src="assets/partners/logos/packycode.png" alt="PackyCode" width="150"></a></td> <td>Thanks to PackyCode for sponsoring this project! PackyCode is a reliable and efficient API relay service provider, offering relay services for Claude Code, Codex, Gemini, and more. PackyCode provides special discounts for our software users: register using <a href="https://www.packyapi.com/register?aff=cc-switch">this link</a> and enter the "cc-switch" promo code during first recharge to get 10% off.</td> </tr> <tr> <td width="180"><a href="https://aigocode.com/invite/CC-SWITCH"><img src="assets/partners/logos/aigocode.png" alt="AIGoCode" width="150"></a></td> <td>Thanks to AIGoCode for sponsoring this project! AIGoCode is an all-in-one platform that integrates Claude Code, Codex, and the latest Gemini models, providing you with stable, efficient, and highly cost-effective AI coding services. The platform offers flexible subscription plans, zero risk of account suspension, direct access with no VPN required, and lightning-fast responses. AIGoCode has prepared a special benefit for CC Switch users: if you register via <a href="https://aigocode.com/invite/CC-SWITCH">this link</a>, you'll receive an extra 10% bonus credit on your first top-up!</td> </tr> <tr> <td width="180"><a href="https://www.aicodemirror.com/register?invitecode=9915W3"><img src="assets/partners/logos/aicodemirror.jpg" alt="AICodeMirror" width="150"></a></td> <td>Thanks to AICodeMirror for sponsoring this project! AICodeMirror provides official high-stability relay services for Claude Code / Codex / Gemini CLI, with enterprise-grade concurrency, fast invoicing, and 24/7 dedicated technical support. Claude Code / Codex / Gemini official channels at 38% / 2% / 9% of original price, with extra discounts on top-ups! AICodeMirror offers special benefits for CC Switch users: register via <a href="https://www.aicodemirror.com/register?invitecode=9915W3">this link</a> to enjoy 20% off your first top-up, and enterprise customers can get up to 25% off!</td> </tr> <tr> <td width="180"><a href="https://www.shengsuanyun.com/?from=CH_4HHXMRYF"><img src="assets/partners/logos/shengsuanyun.png" alt="Shengsuanyun" width="150"></a></td> <td>Thanks to Shengsuanyun for sponsoring this project! Shengsuanyun is a super factory serving AI Native Teams — an industrial-grade AI task parallel execution platform. Its model marketplace aggregates Claude, ChatGPT, Gemini, and other domestic and international LLM and multimedia model capabilities with direct supply. Absolutely no reverse engineering or dilution — platform-wide model SLA availability reaches 99.7%, with <a href="https://watch.shengsuanyun.com/status/shengsuanyun">monitoring dashboards</a> showing green across the board. It also offers enterprise-grade custom gateways for fine-grained team cost and permission management, smart routing, security protection, and BYOK (Bring Your Own Key) hosting. The platform charges on a pay-per-use and tokens plan (coming soon) basis, with invoicing available. Register via <a href="https://www.shengsuanyun.com/?from=CH_4HHXMRYF">this link</a> as a new user to receive ¥10 in credits plus a 10% bonus on your first top-up.</td> </tr> <tr> <td width="180"><a href="https://pateway.ai/?ch=etzpm8&aff=WB6M6F67#/"><img src="assets/partners/logos/pateway.png" alt="PatewayAI" width="150"></a></td> <td>Thanks to PatewayAI for sponsoring this project! PatewayAI is an API relay service provider built for heavy AI developers, focused on directly relaying official high-quality model APIs. It offers the full Claude lineup and the Codex series, 100% sourced from official channels — no dilution, no fakes, verification welcome. Billing is transparent and every token-level invoice can be audited line by line. It also supports enterprise-grade concurrency and provides a dedicated management platform for enterprise customers — formal contracts and invoicing are available; visit the official website for contact details. Register now via <a href="https://pateway.ai/?ch=etzpm8&aff=WB6M6F67#/">this link</a> to receive $3 in trial credit. Top-ups go as low as 60% of the original price, with a two-way referral bonus of up to $150!</td> </tr> <tr> <td width="180"><a href="https://teamorouter.com/?utm_source=cc_switch&utm_medium=referral&utm_campaign=ai_directory"><img src="assets/partners/logos/TeamoRouter-banner.png" alt="TeamoRouter" width="150"></a></td> <td>Thanks to TeamoRouter for sponsoring this project! TeamoRouter is an enterprise-grade Agentic LLM gateway built for developers, AI teams, and businesses. Without requiring any subscriptions, it lets you access Claude Code, Codex, Gemini CLI, OpenAI Codex, and other popular AI agents through a single unified API, while offering API pricing at discounts of up to 90%. Unlike typical API relay services, TeamoRouter aggregates hundreds of official model providers and trusted infrastructure partners, including OpenAI, Anthropic, Vertex, Azure, and AWS bedrock. Every provider is verified for 100% Agent protocol compatibility, cache performance, and request traceability, ensuring stable quality instead of reverse-engineered or diluted endpoints. The platform delivers near-official TTFT, 99.6% SLA, enterprise-scale throughput up to 5,000 QPM, and industry-leading cache hit rates that dramatically reduce token costs for long-running agent workflows. TeamoRouter also offers enterprise features including centralized billing, team management, BYOK, smart routing, usage analytics, dynamic provider optimization, and dedicated support. For an even simpler experience, Teamo Desktop lets you use Claude Code, Codex, Gemini CLI, and other popular AI agents with one-click setup—no API key management or manual gateway configuration required. Register via <a href="https://teamorouter.com/?utm_source=cc_switch&utm_medium=referral&utm_campaign=ai_directory">this link</a> as a new user to receive 10% off your first top-up.</td> </tr> <tr> <td width="180"><a href="https://zetaapi.ai/go/ccs"><img src="assets/partners/logos/zetaapi-banner.png" alt="ZetaAPI" width="150"></a></td> <td>Thanks to ZetaAPI for sponsoring this project! ZetaAPI focuses on real model fidelity, no watered-down responses, no quality degradation, and pricing as low as 35% of official rates. The platform does not mix traffic, secretly replace models with lower-quality alternatives, or use fake model routing. It supports Claude Code, Codex, Gemini, ChatGPT, and other mainstream AI models, helping users significantly reduce API costs while maintaining reliable model quality. At the same time, ZetaAPI provides enterprise-grade SLA-backed stability, standard API compatibility, one API key for multiple models, fast integration, and pay-as-you-go billing, making it suitable for AI products, coding agents, internal business tools, customer service systems, content generation, and automation workflows. If any model is verified to be inconsistent with its stated quality, ZetaAPI backs it with a 10x compensation guarantee, giving users a more stable, transparent, and trustworthy experience. Register via <a href="https://zetaapi.ai/go/ccs">this link</a> and use the promo code CC-SWITCH during your first recharge to enjoy an exclusive 10% discount on your first top-up, just for CC Switch users!</td> </tr> <tr> <td width="180"><a href="https://www.byteplus.com/en/product/modelark?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch"><img src="assets/partners/logos/byteplus.png" alt="BytePlus" width="150"></a></td> <td>Thanks to Dola seed for sponsoring this project! Dola Seed 2.0 is a full‑modal general large model independently developed by ByteDance for the global market. Built on a unified multimodal architecture, it supports joint understanding and generation of text, images, audio, and video. It natively enables agent collaboration, with strong reasoning, long‑task execution, tool integration, and coding capabilities. It is widely applicable to smart cockpits, personal assistants, education, customer support, marketing, retail, and other scenarios. It excels in multimodal perception, end‑to‑end complex task delivery, stable interaction, and data security, and is readily accessible and deployable via the ModelArk platform.Register via <a href="https://www.byteplus.com/en/product/modelark?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch">this link</a> to get 500,000 tokens of free inference quota per model.<a href="https://www.volcengine.com/activity/ai618?utm_campaign=hw&utm_content=hw&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch"> >>中国大陆地区的开发者请点击这里</a></td> </tr> <tr> <td width="180"><a href="https://cloud.siliconflow.cn/i/YflgU2Ve"><img src="assets/partners/logos/silicon_en.jpg" alt="SiliconFlow" width="150"></a></td> <td>Thanks to SiliconFlow for sponsoring this project! SiliconFlow is a high-performance AI infrastructure and model API platform, providing fast and reliable access to language, speech, image, and video models in one place. With pay-as-you-go billing, broad multimodal model support, high-speed inference, and enterprise-grade stability, SiliconFlow helps developers and teams build and scale AI applications more efficiently. Register via <a href="https://cloud.siliconflow.cn/i/YflgU2Ve">this link</a> and complete real-name verification to receive ¥16 in bonus credit, usable across models on the platform. SiliconFlow is also now compatible with OpenClaw, allowing users to connect a SiliconFlow API key and call major AI models for free.</td> </tr> <tr> <td width="180"><a href="https://cubence.com/signup?code=CCSWITCH&source=ccs"><img src="assets/partners/logos/cubence.png" alt="Cubence" width="150"></a></td> <td>Thanks to Cubence for sponsoring this project! Cubence is a reliable and efficient API relay service provider, offering relay services for Claude Code, Codex, Gemini, and more with flexible billing options including pay-as-you-go and monthly plans. Cubence provides special discounts for CC Switch users: register using <a href="https://cubence.com/signup?code=CCSWITCH&source=ccs">this link</a> and enter the "CCSWITCH" promo code during recharge to get 10% off every top-up!</td> </tr> <tr> <td width="180"><a href="https://www.dmxapi.cn/register?aff=bUHu"><img src="assets/partners/logos/dmx-en.jpg" alt="DMXAPI" width="150"></a></td> <td>Thanks to DMXAPI for sponsoring this project! DMXAPI provides global large model API services to 200+ enterprise users. One API key for all global models. Features include: instant invoicing, unlimited concurrency, starting from $0.15, 24/7 technical support. GPT/Claude/Gemini all at 32% off, domestic models 20-50% off, Claude Code exclusive models at 66% off! <a href="https://www.dmxapi.cn/register?aff=bUHu">Register here</a></td> </tr> <tr> <td width="180"><a href="https://www.compshare.cn/coding-plan?ytag=GPU_YY_YX_git_cc-switch"><img src="assets/partners/logos/ucloud.png" alt="Compshare" width="150"></a></td> <td>Thanks to Compshare for sponsoring this project! Compshare is UCloud's AI cloud platform, providing stable and comprehensive domestic and international model APIs with just one key. Featuring cost-effective monthly and per-use domestic-model Coding Plan packages, alongside stable officially-relayed overseas models. Supports Claude Code, Codex, and API access. Enterprise-grade high concurrency, 24/7 technical support, and self-service invoicing. Users who register via <a href="https://www.compshare.cn/coding-plan?ytag=GPU_YY_YX_git_cc-switch">this link</a> will receive a free 5 CNY platform trial credit!</td> </tr> <tr> <td width="180"><a href="https://crazyrouter.com/register?aff=OZcm&ref=cc-switch"><img src="assets/partners/logos/crazyrouter.png" alt="Crazyrouter" width="150"></a></td> <td>Thanks to Crazyrouter for sponsoring this project! Crazyrouter is a high-performance AI API aggregation platform — one API key for 300+ models including Claude Code, Codex, Gemini CLI, and more. All models at 55% of official pricing with auto-failover, smart routing, and unlimited concurrency. Crazyrouter offers an exclusive deal for CC Switch users: register via <a href="https://crazyrouter.com/register?aff=OZcm&ref=cc-switch">this link</a> and contact customer support to claim <strong>$2 free credit</strong>, plus enter promo code `CCSWITCH` on your first top-up for an extra <strong>30% bonus credit</strong>! </td> </tr> <tr> <td width="180"><a href="https://www.right.codes/register?aff=CCSWITCH"><img src="assets/partners/logos/rightcode.jpg" alt="RightCode" width="150"></a></td> <td>Thank you to Right Code for sponsoring this project! Right Code reliably provides routing services for models such as Claude Code, Codex, and Gemini, with both pay-as-you-go and monthly subscription billing options available. Invoices are available upon top-up, and enterprise and team users can receive dedicated one-on-one support. Right Code also offers an exclusive discount for CC Switch users: register via <a href="https://www.right.codes/register?aff=CCSWITCH">this link</a>, and with every top-up you will receive pay-as-you-go credit equivalent to 5% of the amount paid.</td> </tr> <tr> <td width="180"><a href="https://www.sssaicode.com/register?ref=DCP0SM"><img src="assets/partners/logos/sssaicode.png" alt="SSSAiCode" width="150"></a></td> <td>Thanks to SSSAiCode for sponsoring this project! SSSAiCode is a stable and reliable API relay service, dedicated to providing stable, reliable, and affordable Claude and Codex model services, with same-day fast invoicing. SSSAiCode offers a special deal for CC Switch users: register via <a href="https://www.sssaicode.com/register?ref=DCP0SM">this link</a> to enjoy $10 extra credit on every top-up!</td> </tr> <tr> <td width="180"><a href="https://www.micuapi.ai/register?aff=aOYQ"><img src="assets/partners/logos/mikubanner.svg" alt="Micu" width="150"></a></td> <td>Thanks to Micu API for sponsoring this project! Micu API is a global LLM relay service provider dedicated to delivering the best cost-performance ratio with high stability. Backed by a registered enterprise for core assurance, eliminating any risk of service discontinuation, with fast official invoicing support! We champion "zero cost to try": top up from as low as ¥1 with no minimum, and get fee-free refunds anytime! Micu API offers an exclusive deal for CC Switch users: register via <a href="https://www.micuapi.ai/register?aff=aOYQ">this link</a> and enter promo code "ccswitch" when topping up to enjoy a <strong>10% discount</strong>!</td> </tr> <tr> <td width="180"><a href="https://etok.ai"><img src="assets/partners/logos/etok.png" alt="ETok" width="150"></a></td> <td>Thanks to ETok.ai for sponsoring this project! ETok.ai is dedicated to building a one-stop AI programming tool service platform. We offer professional Claude Code packages and technical community services, with support for Google Gemini and OpenAI Codex. Through carefully designed plans and a professional tech community, we provide developers with reliable service guarantees and continuous technical support, making AI-assisted programming a true productivity tool. Click <a href="https://etok.ai">here</a> to register!</td> </tr> <tr> <td width="180"><a href="https://console.claudeapi.com/register?aff=pCLD"><img src="assets/partners/logos/claudeapi.png" alt="ClaudeAPI" width="150"></a></td> <td>This project is sponsored by <a href="https://console.claudeapi.com/register?aff=pCLD">Claude API</a>. Direct Claude API access — connect Claude Code and Agent apps in 3 minutes. New users can claim a free trial credit.Powered by official Anthropic API keys + AWS Bedrock official channels. No reverse engineering, no model degradation. Full support for Opus / Sonnet / Haiku model lineup, with official capabilities preserved including Tool Use, 1M context window, and more. Built for Claude Code power users, Agent engineers, and enterprise engineering teams. Invoicing and dedicated team support available. Click <a href="https://console.claudeapi.com/register?aff=pCLD">here</a> to register!</td> </tr> <tr> <td width="180"><a href="https://code0.ai/agent/register/B2XHxGjGmRvqgznY"><img src="assets/partners/logos/code0.png" alt="code0.ai" width="150"></a></td> <td>Thanks to <a href="https://code0.ai/agent/register/B2XHxGjGmRvqgznY">code0.ai</a> for sponsoring this project! code0.ai is an AI coding service platform built for developers, supporting Claude Code, Codex, Gemini, and other mainstream AI coding capabilities. It helps individual developers and teams use AI Agents more stably and efficiently for coding, debugging, refactoring, and automation workflows. ccswitch users can contact customer support via the <a href="https://code0.ai/agent/register/B2XHxGjGmRvqgznY">code0.ai website</a> to claim test credits and experience a reliable AI coding service.</td> </tr> <tr> <td width="180"><a href="https://claudecn.top"><img src="assets/partners/logos/claudecn.jpg" alt="ClaudeCN" width="150"></a></td> <td>Thanks to ClaudeCN for sponsoring this project! ClaudeCN is an enterprise-grade AI gateway platform operated by a registered company. It delivers high-availability commercial API access to popular models including Claude, GPT, and DeepSeek, and is built around formal enterprise procurement workflows — corporate bank transfers, signed contracts, and full compliance. Register via <a href="https://claudecn.top">this link</a>!</td> </tr> <tr> <td width="180"><a href="https://runapi.co"><img src="assets/partners/logos/runapi.jpg" alt="RunAPI" width="150"></a></td> <td>Thanks to RunAPI for sponsoring this project! RunAPI is a high-performance and reliable AI model API gateway — one API key gives you access to 150+ mainstream models including OpenAI, Claude, Gemini, DeepSeek, and Grok, with prices as low as 10% of the official rate and excellent stability. It works seamlessly with Claude Code, OpenClaw, and other tools. Exclusive benefit for CC Switch users: register and contact customer support to claim a free ¥14 credit. Register via <a href="https://runapi.co">this link</a>!</td> </tr> <tr> <td width="180"><a href="https://apikey.fun/register?aff=CCSwitch"><img src="assets/partners/logos/apikey_banner.png" alt="APIKEY.FUN" width="150"></a></td> <td>Thanks to APIKEY.FUN for sponsoring this project! APIKEY.FUN is a professional enterprise-grade AI relay platform dedicated to providing stable, efficient, and low-cost AI model API access for enterprises and individual developers. The platform supports popular mainstream models such as Claude, OpenAI, and Gemini, with prices as low as 7% of official rates. Register through this project's <a href="https://apikey.fun/register?aff=CCSwitch">exclusive link</a> to enjoy an exclusive offer of up to <strong>permanent 5% off top-ups</strong>.</td> </tr> <tr> <td width="180"><a href="https://apinebula.com/02rw5X"><img src="assets/partners/logos/apinebula_banner.png" alt="APINebula" width="150"></a></td> <td>Thanks to APINEBULA for sponsoring this project! APINEBULA, an enterprise-grade AI aggregation platform under Galaxy Video Bureau, leverages extensive platform resources to provide developers, teams, and enterprises with stable, cost-effective access to large language model APIs. The platform integrates leading, full-powered models like Claude, GPT, and Gemini, allowing you to connect to the world's top AI models through a single API, with prices starting as low as 10% of the original cost. Designed for AI programming, Agent development, and business system integration, APINEBULA supports enterprise-grade high concurrency, formal contracts, corporate bank transfers, and invoicing services. APINEBULA provides special discounts for our software users: register using <a href="https://apinebula.com/02rw5X">this link</a> and enter the <strong>"ccswitch"</strong> promo code during your first recharge to get <strong>10% off</strong>.</td> </tr> <tr> <td width="180"><a href="https://www.atlascloud.ai/coding-plan?utm_source=github&utm_campaign=cc-switch"><img src="assets/partners/logos/atlascloud_banner.png" alt="Atlas Cloud" width="150"></a></td> <td>Atlas Cloud is a full-modal AI inference platform that gives developers a single AI API to access video generation, image generation, and LLM APIs. Instead of managing multiple vendor integrations, you connect once and get unified access to 300+ curated models across all modalities. Check out Atlas Cloud's new <a href="https://www.atlascloud.ai/coding-plan?utm_source=github&utm_campaign=cc-switch">coding plan</a> promotion for more budget-friendly API access!</td> </tr> <tr> <td width="180"><a href="https://www.ccsub.net/register?ref=Y6Z8DXEA"><img src="assets/partners/logos/ccsub.svg" alt="CCSub" width="150"></a></td> <td>Thanks to CCSub for sponsoring this project! CCSub is a stable, affordable AI API relay platform — your drop-in replacement for a Claude.ai subscription. One API key gives you access to Claude Opus 4.8, Sonnet, Haiku, GPT-5, Gemini, and DeepSeek at roughly 30% of direct API cost, with no VPN required from anywhere in the world. Compatible with Claude Code, Codex, Cursor, Cline, Continue, Windsurf, and all major AI coding tools. Register via <a href="https://www.ccsub.net/register?ref=Y6Z8DXEA">this link</a> and get $5 free credit on sign-up.</td> </tr> <tr> <td width="180"><a href="https://unity2.ai/register?source=ccs"><img src="assets/partners/logos/unity2.jpg" alt="Unity2.ai" width="150"></a></td> <td>Thanks to Unity2.ai for sponsoring this project! Unity2.ai is a high-performance AI model API relay platform for individual developers, teams, and enterprises. Long trusted by leading companies in China, it serves over 30 billion tokens per day and supports high concurrency at the 5,000 RPM level. It offers balance-based billing, first top-up bonuses, bundle subscriptions, corporate invoicing, and dedicated support. Register via <a href="https://unity2.ai/register?source=ccs">this link</a> to get $2 in credits, plus another $10 for joining the official group — up to $12 in free credits!</td> </tr> <tr> <td width="180"><a href="https://api.fenno.ai/register?redirect=/purchase?tab=subscription%26group=16&aff=P9MR3D3PLCNL"><img src="assets/partners/logos/fenno-banner.png" alt="Fenno.ai" width="150"></a></td> <td>Thanks to Fenno.ai for sponsoring this project! Fenno.ai is a stable and efficient API relay service provider, currently focused on Codex relay. It is compatible with the OpenAI and Anthropic protocols and can be flexibly used from Codex, Claude Code, OpenCode, and other mainstream coding tools. It reliably supports enterprise-grade workloads of hundreds of billions of tokens per day, with corporate (B2B) settlement and invoicing for both domestic and overseas entities. Fenno.ai offers an exclusive benefit for CC Switch users: subscribe via <a href="https://api.fenno.ai/register?redirect=/purchase?tab=subscription%26group=16&aff=P9MR3D3PLCNL">this link</a> to the incredible ¥9.9 Coding Plan worth $150 in credits, and earn up to 20% in referral rewards — invite more, earn more!</td> </tr> <tr> <td width="180"><a href="https://nekocode.ai?aff=CCSWITCH"><img src="assets/partners/logos/nekocode-banner.png" alt="NekoCode" width="150"></a></td> <td>Thanks to <a href="https://nekocode.ai?aff=CCSWITCH">NekoCode</a> for sponsoring this project! NekoCode provides developers with a stable, efficient, and reliable API relay service for Claude, Codex, and other AI models. With transparent pricing and flexible pay-as-you-go billing, it offers a simple and cost-effective way to access AI models. CC Switch users can enjoy an exclusive 10% discount: register via <a href="https://nekocode.ai?aff=CCSWITCH">this link</a> and enter promo code <code>cc-switch</code> during recharge to receive 10% off your top-up!</td> </tr> <tr> <td width="180"><a href="https://www.newapi.ai/"><img src="assets/partners/logos/newapi-banner.png" alt="new-api" width="150"></a></td> <td>Thanks to the open-source AI infrastructure project <a href="https://www.newapi.ai/">new-api</a> for its strong support of this project! new-api is an open-source AI infrastructure project from QuantumNous and one of the leading unified LLM access-and-distribution projects by activity and adoption, focused on helping developers, teams, and enterprises build manageable, scalable AI service platforms at lower cost. As a fellow project rooted in the open-source ecosystem, new-api hopes to sponsor and support the continued growth of more outstanding open-source projects. 🌟 Star new-api to show your support: <a href="https://github.com/QuantumNous/new-api">https://github.com/QuantumNous/new-api</a>. Website: <a href="https://www.newapi.ai/">https://www.newapi.ai/</a>.</td> </tr> <tr> <td width="180"><a href="https://subrouter.ai/register?aff=l3ri"><img src="assets/partners/logos/subrouter-banner.png" alt="SubRouter" width="150"></a></td> <td>Thanks to SubRouter for sponsoring this project! SubRouter is a marketplace and smart routing platform for AI service operators. Merchants can launch operating sites, publish packages, manage users, models, and pricing, while users discover services and access reliable AI models through one unified API. Register via <a href="https://subrouter.ai/register?aff=l3ri">this link</a>!</td> </tr> </table> </details> ## Why CC Switch? Modern AI-powered coding relies on tools like Claude Code, Claude Desktop, Codex, Gemini CLI, Grok Build, OpenCode, OpenClaw, and Hermes — but each has its own configuration format. Switching API providers means manually editing JSON, TOML, or `.env` files, and there is no unified way to manage MCP and Skills across multiple tools. **CC Switch** gives you a single desktop app to manage all supported AI tools. Instead of editing config files by hand, you get a visual interface to import providers with one click, switch between them instantly, with 50+ built-in provider presets, unified MCP and Skills management, and system tray quick switching — all backed by a reliable SQLite database with atomic writes that protect your configs from corruption. - **One App, Eight Tools** — Manage Claude Code, Claude Desktop, Codex, Gemini CLI, Grok Build, OpenCode, OpenClaw, and Hermes from a single interface - **No More Manual Editing** — 50+ provider presets including AWS Bedrock, NVIDIA NIM, and community relays; just pick and switch - **Unified MCP & Skills Management** — One panel to manage MCP servers and Skills across Claude, Codex, Gemini, Grok Build, OpenCode, and Hermes with bidirectional sync - **System Tray Quick Switch** — Switch providers instantly from the tray menu, no need to open the full app - **Cloud Sync** — Sync provider data across devices via Dropbox, OneDrive, iCloud, or WebDAV servers - **Cross-Platform** — Native desktop app for Windows, macOS, and Linux, built with Tauri 2 - **Built-in Utilities** — Includes various utilities for first-launch login confirmation, signature bypass, plugin extension sync, and more ## Screenshots | Main Interface | Add Provider | | :-----------------------------------------------: | :--------------------------------------------: | | ![Main Interface](assets/screenshots/main-en.png) | ![Add Provider](assets/screenshots/add-en.png) | ## Features [Full Changelog](CHANGELOG.md) | [Release Notes](docs/release-notes/v3.16.1-en.md) ### Provider Management - **8 supported tools, 50+ presets** — Claude Code, Claude Desktop, Codex, Gemini CLI, Grok Build, OpenCode, OpenClaw, Hermes; copy your key and import with one click - **Universal providers** — One config syncs to Claude Code, Codex, and Gemini CLI - One-click switching, system tray quick access, drag-and-drop sorting, import/export ### Proxy & Failover - **Local proxy with hot-switching** — Format conversion, auto-failover, circuit breaker, provider health monitoring, and request rectifier - **App-level takeover** — Independently proxy Claude, Codex, Gemini, or Grok Build, down to individual providers ### MCP, Prompts & Skills - **Unified MCP panel** — Manage MCP servers across Claude, Codex, Gemini, Grok Build, OpenCode, and Hermes with bidirectional sync and Deep Link import - **Prompts** — Markdown editor with cross-app sync (CLAUDE.md / AGENTS.md / GEMINI.md) and backfill protection - **Skills** — One-click install from GitHub repos or ZIP files, custom repository management, with symlink and file copy support ### Usage & Cost Tracking - **Usage dashboard** — Track spending, requests, and tokens with trend charts, detailed request logs, and custom per-model pricing ### Session Manager & Workspace - Browse, search, and restore conversation history across supported session sources - **Workspace editor** (OpenClaw) — Edit agent files (AGENTS.md, SOUL.md, etc.) with Markdown preview ### System & Platform - **Cloud sync** — Custom config directory (Dropbox, OneDrive, iCloud, NAS) and WebDAV server sync - **Deep Link** (`ccswitch://`) — Import providers, MCP servers, prompts, and skills via URL - Dark / Light / System theme, auto-launch, auto-updater, atomic writes, auto-backups, i18n (zh/zh-TW/en/ja) ## FAQ <details> <summary><strong>Which AI tools does CC Switch support?</strong></summary> CC Switch supports eight tools: **Claude Code**, **Claude Desktop**, **Codex**, **Gemini CLI**, **Grok Build**, **OpenCode**, **OpenClaw**, and **Hermes**. Each tool has dedicated provider presets and configuration management. </details> <details> <summary><strong>Do I need to restart the terminal after switching providers?</strong></summary> For most tools, yes — restart your terminal or the CLI tool for changes to take effect. The exception is **Claude Code**, which currently supports hot-switching of provider data without a restart. </details> <details> <summary><strong>My plugin configuration disappeared after switching providers — what happened?</strong></summary> CC Switch provides a "Shared Config Snippet" feature to pass common data (beyond API keys and endpoints) between providers. Go to "Edit Provider" → "Shared Config Panel" → click "Extract from Current Provider" to save all common data. When creating a new provider, check "Write Shared Config" (enabled by default) to include plugin data in the new provider. All your configuration items are preserved in the default provider imported when you first launched the app. </details> <details> <summary><strong>macOS installation</strong></summary> CC Switch for macOS is code-signed and notarized by Apple. You can download and install it directly — no extra steps needed. We recommend using the `.dmg` installer. </details> <details> <summary><strong>Why can't I delete the currently active provider?</strong></summary> CC Switch follows a "minimal intrusion" design principle — even if you uninstall the app, your CLI tools will continue to work normally. The system always keeps one active configuration, because deleting all configurations would make the corresponding CLI tool unusable. If you rarely use a specific CLI tool, you can hide it in Settings. To switch back to official login, see the next question. </details> <details> <summary><strong>How do I switch back to official login?</strong></summary> Add an official provider from the preset list. After switching to it, run the Log out / Log in flow, and then you can freely switch between the official provider and third-party providers. Codex supports switching between different official providers, making it easy to switch between multiple Plus or Team accounts. </details> <details> <summary><strong>Where is my data stored?</strong></summary> - **Database**: `~/.cc-switch/cc-switch.db` (SQLite — providers, MCP, prompts, skills) - **Local settings**: `~/.cc-switch/settings.json` (device-level UI preferences) - **Backups**: `~/.cc-switch/backups/` (auto-rotated, keeps 10 most recent) - **Skills**: `~/.cc-switch/skills/` (symlinked to corresponding apps by default) - **Skill Backups**: `~/.cc-switch/skill-backups/` (created automatically before uninstall, keeps 20 most recent) </details> <details> <summary><strong>Linux (Wayland + NVIDIA): clicks don't register and the window black-screens on resize</strong></summary> The AppImage forces `GDK_BACKEND=x11` (XWayland) to avoid a historical native-Wayland crash. On newer Wayland + NVIDIA setups this can leave the web content area unclickable (the title-bar buttons still work) and black-screen on resize. Launch with the opt-in escape hatch to switch back to native Wayland: ```bash CC_SWITCH_GDK_BACKEND=wayland ./CC-Switch-*.AppImage ``` If you launch from a desktop icon, add it to the `.desktop` `Exec=` line (e.g. `env CC_SWITCH_GDK_BACKEND=wayland /path/to/AppImage`) or set it in your session environment. The variable is generic: on tiling Wayland compositors (sway/Hyprland) where clicks don't register, try `CC_SWITCH_GDK_BACKEND=x11` instead. Leaving it unset keeps the default behavior. </details> ## Documentation For detailed guides on every feature, check out the **[User Manual](docs/user-manual/en/README.md)** — covering provider management, MCP/Prompts/Skills, proxy & failover, and more. ## Quick Start ### Basic Usage 1. **Add Provider**: Click "Add Provider" → Choose a preset or create custom configuration 2. **Switch Provider**: - Main UI: Select provider → Click "Enable" - System Tray: Click provider name directly (instant effect) 3. **Takes Effect**: Restart your terminal or the corresponding CLI tool to apply changes (Claude Code does not require a restart) 4. **Back to Official**: Add an "Official Login" preset, restart the CLI tool, then follow its login/OAuth flow ### MCP, Prompts, Skills & Sessions - **MCP**: Click the "MCP" button → Add servers via templates or custom config → Toggle per-app sync - **Prompts**: Click "Prompts" → Create presets with Markdown editor → Activate to sync to live files - **Skills**: Click "Skills" → Browse GitHub repos → One-click install to supported apps - **Sessions**: Click "Sessions" → Browse, search, and restore conversation history across supported session sources > **Note**: On first launch, you can manually import existing CLI tool configs as the default provider. ## Download & Installation ### System Requirements - **Windows**: Windows 10 and above - **macOS**: macOS 12 (Monterey) and above - **Linux**: Ubuntu 22.04+ / Debian 11+ / Fedora 34+ and other mainstream distributions ### Windows Users Download the latest `CC-Switch-v{version}-Windows.msi` installer or `CC-Switch-v{version}-Windows-Portable.zip` portable version from the [Releases](../../releases) page. ### macOS Users **Method 1: Install via Homebrew (Recommended)** ```bash brew install --cask cc-switch ``` Update: ```bash brew upgrade --cask cc-switch ``` **Method 2: Manual Download** Download `CC-Switch-v{version}-macOS.dmg` (recommended) or `.zip` from the [Releases](../../releases) page. > **Note**: CC Switch for macOS is code-signed and notarized by Apple. You can install and open it directly. ### Arch Linux Users **Install via paru (Recommended)** ```bash paru -S cc-switch-bin ``` ### Linux Users Download the latest Linux build from the [Releases](../../releases) page: - `CC-Switch-v{version}-Linux.deb` (Debian/Ubuntu) - `CC-Switch-v{version}-Linux.rpm` (Fedora/RHEL/openSUSE) - `CC-Switch-v{version}-Linux.AppImage` (Universal) > **Flatpak**: Not included in official releases. You can build it yourself from the `.deb` — see [`flatpak/README.md`](flatpak/README.md) for instructions. <details> <summary><strong>Architecture Overview</strong></summary> ### Design Principles ``` ┌─────────────────────────────────────────────────────────────┐ │ Frontend (React + TS) │ │ ┌─────────────┐ ┌──────────────┐ ┌──────────────────┐ │ │ │ Components │ │ Hooks │ │ TanStack Query │ │ │ │ (UI) │──│ (Bus. Logic) │──│ (Cache/Sync) │ │ │ └─────────────┘ └──────────────┘ └──────────────────┘ │ └────────────────────────┬────────────────────────────────────┘ │ Tauri IPC ┌────────────────────────▼────────────────────────────────────┐ │ Backend (Tauri + Rust) │ │ ┌─────────────┐ ┌──────────────┐ ┌──────────────────┐ │ │ │ Commands │ │ Services │ │ Models/Config │ │ │ │ (API Layer) │──│ (Bus. Layer) │──│ (Data) │ │ │ └─────────────┘ └──────────────┘ └──────────────────┘ │ └─────────────────────────────────────────────────────────────┘ ``` **Core Design Patterns** - **SSOT** (Single Source of Truth): All data stored in `~/.cc-switch/cc-switch.db` (SQLite) - **Dual-layer Storage**: SQLite for syncable data, JSON for device-level settings - **Dual-way Sync**: Write to live files on switch, backfill from live when editing active provider - **Atomic Writes**: Temp file + rename pattern prevents config corruption - **Concurrency Safe**: Mutex-protected database connection avoids race conditions - **Layered Architecture**: Clear separation (Commands → Services → DAO → Database) **Key Components** - **ProviderService**: Provider CRUD, switching, backfill, sorting - **McpService**: MCP server management, import/export, live file sync - **ProxyService**: Local proxy mode with hot-switching and format conversion - **SessionManager**: Conversation history browsing across supported session sources - **ConfigService**: Config import/export, backup rotation - **SpeedtestService**: API endpoint latency measurement </details> <details> <summary><strong>Development Guide</strong></summary> ### Environment Requirements - Node.js 18+ - pnpm 8+ - Rust 1.85+ - Tauri CLI 2.8+ ### Development Commands ```bash # Install dependencies pnpm install # Dev mode (hot reload) pnpm dev # Type check pnpm typecheck # Format code pnpm format # Check code format pnpm format:check # Run frontend unit tests pnpm test:unit # Run tests in watch mode (recommended for development) pnpm test:unit:watch # Build application pnpm build # Build debug version pnpm tauri build --debug ``` ### Rust Backend Development ```bash cd src-tauri # Format Rust code cargo fmt # Run clippy checks cargo clippy # Run backend tests cargo test # Run specific tests cargo test test_name # Run tests with test-hooks feature cargo test --features test-hooks ``` ### Testing Guide **Frontend Testing**: - Uses **vitest** as test framework - Uses **MSW (Mock Service Worker)** to mock Tauri API calls - Uses **@testing-library/react** for component testing **Running Tests**: ```bash # Run all tests pnpm test:unit # Watch mode (auto re-run) pnpm test:unit:watch # With coverage report pnpm test:unit --coverage ``` ### Tech Stack **Frontend**: React 18 · TypeScript · Vite · TailwindCSS 3.4 · TanStack Query v5 · react-i18next · react-hook-form · zod · shadcn/ui · @dnd-kit **Backend**: Tauri 2.8 · Rust · serde · tokio · thiserror · tauri-plugin-updater/process/dialog/store/log **Testing**: vitest · MSW · @testing-library/react </details> <details> <summary><strong>Project Structure</strong></summary> ``` ├── src/ # Frontend (React + TypeScript) │ ├── components/ │ │ ├── providers/ # Provider management │ │ ├── mcp/ # MCP panel │ │ ├── prompts/ # Prompts management │ │ ├── skills/ # Skills management │ │ ├── sessions/ # Session Manager │ │ ├── proxy/ # Proxy mode panel │ │ ├── openclaw/ # OpenClaw config panels │ │ ├── settings/ # Settings (Terminal/Backup/About) │ │ ├── deeplink/ # Deep Link import │ │ ├── env/ # Environment variable management │ │ ├── universal/ # Cross-app configuration │ │ ├── usage/ # Usage statistics │ │ └── ui/ # shadcn/ui component library │ ├── hooks/ # Custom hooks (business logic) │ ├── lib/ │ │ ├── api/ # Tauri API wrapper (type-safe) │ │ └── query/ # TanStack Query config │ ├── locales/ # Translations (zh/zh-TW/en/ja) │ ├── config/ # Presets (providers/mcp) │ └── types/ # TypeScript definitions ├── src-tauri/ # Backend (Rust) │ └── src/ │ ├── commands/ # Tauri command layer (by domain) │ ├── services/ # Business logic layer │ ├── database/ # SQLite DAO layer │ ├── proxy/ # Proxy module │ ├── session_manager/ # Session management │ ├── deeplink/ # Deep Link handling │ └── mcp/ # MCP sync module ├── tests/ # Frontend tests └── assets/ # Screenshots & partner resources ``` </details> ## Contributing Issues and suggestions are welcome! Before submitting PRs, please ensure: - Pass type check: `pnpm typecheck` - Pass format check: `pnpm format:check` - Pass unit tests: `pnpm test:unit` For new features, please open an issue for discussion before submitting a PR. PRs for features that are not a good fit for the project may be closed. ## Star History [![Star History Chart](https://api.star-history.com/svg?repos=farion1231/cc-switch&type=Date)](https://www.star-history.com/#farion1231/cc-switch&Date) ## License MIT © Jason Young