Skip to content

auth.json reuses the previous provider’s key, Codex

Quick fix

Upgrade to cc-switch v4.0.6 or later. Codex switching logic will prevent the new provider from reusing the previous provider’s key.

Error output
在cc switch,codex界面添加新供应商时,添加后切换到新供应商,auth.json会自动复用上一个供应商的,导致添加新的供应商无法使用
English translation

In cc switch, when I add a new provider in the Codex interface and then switch to it, auth.json automatically reuses the previous provider’s entry, preventing the new provider from working.

Older Codex switching logic populated providers from the live file and rewrote the entire auth.json, so a new provider could inherit the previous provider’s key. The issue also occurred in routing mode. The maintainer said that v4.0.0 rewrote the switching logic: third-party provider keys are now written to [model_providers.custom] in config.toml instead of auth.json; official login is temporarily saved and restored during switching, and the population step was removed. Another issue describes content remaining in auth.json after it was cleared in v3.16.1. The maintainer marked it as a duplicate of another issue; this corpus does not include a fix for it.

  1. Upgrade to the latest cc-switch; the maintainer’s fix notes point to the v4.0.6 release.

  2. If the problem persists after upgrading, provide more information and reopen the issue.

ToolCodex
Version3.16.1(受影响版本);修复说明指向 v4.0.6
PlatformsWindows
Can signing out of Codex and signing back in fix this?
User comments differ: one user said signing out and back in was enough, while another said it worked only after disabling “Keep official login when switching to third-party providers.” The maintainer’s solution is to upgrade to v4.0.6 or later.
Can auth.json still reuse the previous provider in routing mode?
A user reported that toggling the routing feature could not prevent reuse. The maintainer said the newer version writes each routing provider separately and no longer reuses the old auth.json.

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.