Codex API key automatically modified leading to model xxx not found - CC Switch
Quick fix
Upgrade to v3.19.2+ to fix incorrect API Key convergence caused by reading auth.json when multiple suppliers share the same address.
Symptom
Section titled “Symptom”model xxx not foundWhen configuring multiple Codex suppliers with the same API request address but different keys in cc-switch, the system often converges the keys into a single one. This causes calls to unauthorized models and results in the "model xxx not found" error.
The root cause is that `~/.codex/auth.json` is a single-slot shared file without supplier identity, always retaining only the most recently activated key. Although each supplier's actual key is stored in the `experimental_bearer_token` field of `config.toml`, the program prioritizes reading `auth.json` when loading live configuration in the edit dialog. This causes the interface to display another (or official login) key, which is then written back to the current supplier's record upon saving, resulting in repeated key overwrites.
Upgrade cc-switch to version v3.19.2 or higher. This version corrects the logic for loading Codex configuration to prioritize promoting `experimental_bearer_token` as the supplier's key, ensuring that displayed and saved keys are correct and independent.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 24 real issues
- #1332codex启用本地代理的时候,请求的模型不是故障转移队列中供应商指定的模型
- #1531如何清空 Codex 配置的供应商?
- #1862开了clash for windows 后,使用ccswitch 全局出站代理或者单独供应商代理都无效
- #2048在代理总开关打开后把packyapi的gpt模型接入cc会遇到两个问题
- #2358Enable full URL mode for OpenClaw and OpenCode providers
- #2384使用统计会被双倍计算的bug
- #2857codex APP,cc设置代理模式,切换供应商模型不会随着切换
- #3363使用Codex代理,问一个问题,会出现多次请求
- #3432codex启用代理后,多工具并行调用失效
- #3608开启路由代理时codex无法处理生成图片的请求,对话会直接停止不报错
- #36613.16.1 路由代理不稳定
- #3746Codex增强功能无法使用第三方API中转服务,cli中报We're currently experiencing high demand, which may cause temporary error,codex客户端报429too many requests
- #3878切换路由状态失败: {{detail}}
- #4005模型不支持text/event-stream
- #4111当响应接口转对话补全接口路由至第三方服务商时,Codex 系统工具因工具名缺失调用失败
- #4170切换路由状态失败: Codex 当前供应商不存在,无法接管 Live 配置
- #4416codex无法为提交生成说明
- #4762codex 要保留官方的插件和网页搜索能力,是不是要配置全局出站代理。
- #5162代理模型后codex没法显示总结后的标题
- #5970Codex Bailian提供商经常出现连接不上或者出现输出中断的问题
- #5985cc-switch cli 开关代理或者切换第三方账号会让官方登录过期
- #6217Codex使用路由方式接管以后使用报错
- #6414同一个 API 请求地址 ,按照不同key 配置不同的供应商。经常会自动修改apikey 改成和其他一样的
- #6674Codex 软件部分设置会在重启后覆盖
- Why did my API key suddenly change to another supplier's after enabling local proxy?
- This is because in older versions, `auth.json` was a single-slot shared file, and loading configuration prioritized it over the independent keys in `config.toml`. After upgrading to v3.19.2+, the program correctly identifies and preserves the independent `experimental_bearer_token` for each supplier.
- How do I completely clear Codex configuration?
- You can add a preset supplier (such as OpenAI Official) in the top right corner of cc-switch and enable it to invalidate old third-party configurations. Alternatively, disable the Codex takeover feature in settings.
Related problems
Section titled “Related problems”This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.