Skip to content

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.

Error output
切了oauth登录之后,apikey的形式就切换不过去了,必须手动去~/.codex/auth.json里面做修改才行
English translation

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.

  1. Upgrade cc-switch to v3.17.0 or higher; this version adds takeover of the Codex official login and improves switching logic.

  2. 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)
ToolCodex
Version3.16.0 - 3.16.5
PlatformsmacOSWindows
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.

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.