Codex OAuth switch to API Key ineffective - CC Switch
Quick fix
Upgrade to v3.17.0+ and disable the 'Keep Official Plugin' option in settings.
Symptom
Section titled “Symptom”切了oauth登录之后,apikey的形式就切换不过去了,必须手动去~/.codex/auth.json里面做修改才行After switching to OAuth login, it cannot be switched back to API Key format; manual modification of ~/.codex/auth.json is required.
In cc-switch v3.16.x, switching between Codex OAuth (official login) and API Key mode causes configuration write conflicts. Specifically, after switching from OAuth to API Key, the interface or underlying configuration retains the OAuth state, preventing the API Key from taking effect. According to Issue #5345, this is a side effect of 'Keep Official Plugin' capabilities in the Codex app enhancement features. Although Issue #3620 mentions an old key display issue after saving (fixed in v3.16.1), the core problem of OAuth/API hybrid switching requires logic adjustments in higher versions.
Upgrade cc-switch to v3.17.0 or higher; this version adds takeover of the Codex official login and improves switching logic.
If the issue persists after upgrading, go to cc-switch settings, find the 'Codex App Enhancement' section, disable 'Keep Official Plugin' and related options, then retry switching.
在 cc-switch 设置界面操作 # 路径: 设置 -> Codex 应用增强# 操作: 关闭 '保留官方插件' (Keep Official Plugins)
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 6 real issues
- #1416JsonEditor 在长行横向滚动时会出现正文与行号列重叠
- #3620修改API key保存后重新进入依旧显示为旧的sk-xxxxxxxxxxxxxxxxx
- #4071你用 cc-switch 切换模型时,实际上是修改了 config.toml 里的 model_provider 和 model 字段(比如从 openai / gpt-5.5 切到 custom / qwen3.7-max)。Codex 客户端重启后,侧边栏只展示与当前 model_provider 匹配的线程,所以你之前用 GPT 创建的对话就被"隐藏"了——数据还在磁盘上,只是界面上看不到了。
- #5345codex的oauth和api的切换不能用
- #5891重启ccswitch后启动codex,里面插件技能状态被重置
- #5910Issue: web_search = "disabled" 配置被意外删除,导致依赖该配置的功能失效
- Why does switching back to OAuth revert?
- This is known behavior in v3.16.x; the OAuth and API Key switch states fail to persist correctly under interference from the app enhancement features. Upgrading to v3.17.0 and adjusting app enhancement settings resolves it.
- Is the API Key not saving mentioned in Issue #3620 the same problem?
- Related but not identical. #3620 was a write path bug fixed in v3.16.1; the OAuth/API switch failure is a deeper state management conflict affecting v3.16.5 and earlier, requiring upgrade to v3.17.0+.
- Do I have to manually modify auth.json?
- No. This is a temporary workaround. By upgrading the software and disabling conflicting app enhancement options, you can switch normally via the UI.
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.