Skip to content

config.toml and auth.json still hold the previous third-party API - Codex / CC Switch

Quick fix

Upgrade CC Switch to v3.16.1+, restart, and switch Codex provider again. If official OAuth broke, run codex logout then codex login --device-auth.

Error output
config.toml 和auth.json的内容仍然是之前第三方的api的。
English translation

config.toml and auth.json still hold the content of the previous third-party API.

At the core of this: CC Switch treats the provider snapshot in its database as the single source of truth, rebuilding `~/.codex/config.toml` and possibly writing back `~/.codex/auth.json` when you switch Codex provider. In v3.16.0, switching between providers such as DeepSeek and MiMo with local routing on did not overwrite the live `config.toml` / `auth.json` in step, so the Codex CLI/Desktop kept using the old provider. A maintainer confirmed this was fixed in v3.16.1. A close variant: after switching from a third-party provider back to OpenAI Official, the old OAuth snapshot overwrites the live credentials and the refresh token state stops updating, requiring a fresh login — also marked fixed in v3.16.1.

Later versions still argue about "the switch works but non-provider fields are overwritten from the old snapshot": #3700 and #6400 report live UI settings such as `personality` and `[desktop]` (`mac-menu-bar-enabled = false`, for example) being reset, while maintainers explain in #5770 and #4332 that fully rebuilding `config.toml` is deliberate and hand edits get overwritten, so anything you need kept belongs in a shared config fragment. Separately, #4258 (the model being overwritten by the first row of the mapping table) was fixed in v3.17.0, and #4289 (empty unified session history) relates to `sqlite_home` pointing at `~/.codex/sqlite` without being migrated — another variant still open.

  1. Back up `~/.codex/config.toml` and `~/.codex/auth.json` first, so you do not lose your existing login state or custom config while troubleshooting.

  2. Upgrade CC Switch to v3.16.1 or newer (the latest release is preferable), then fully restart CC Switch and the Codex CLI/Desktop, and save and switch the target Codex provider once more in CC Switch. A maintainer confirmed the v3.16.0 "config.toml / auth.json not switched in step" problem was fixed in v3.16.1.

  3. If Codex cannot reach the official endpoint after switching back to OpenAI Official, or the OAuth state is stuck, sign in again: `codex logout`, then `codex login --device-auth`, then restart Codex and the host app. This workaround is confirmed in both Windows and macOS comments, and maintainers say the related OAuth overwrite was fixed in v3.16.1.

  4. If what you lost is a non-provider field such as `personality`, a `[desktop]` theme, or `[mcp_servers]`, do not edit the live `config.toml` by hand — it gets rebuilt over. In CC Switch, open 编辑供应商 → 共享配置面板 → 从当前供应商提取 (Edit provider > Shared config panel > Extract from current provider), put what you need across providers into the shared config fragment, and confirm the target provider has Common Config enabled. Note #6400 shows `[desktop]` may still not apply when a provider has `commonConfigEnabled` false or unset; that issue is still open.

  5. If changing `model` to `deepseek-v4-pro` in the DeepSeek preset reverts to `deepseek-v4-flash` on save, upgrade to v3.17.0+ and fill in a separate default model field explicitly on the provider form. From v3.17.0, the first row of the mapping table is only used to backfill when that field is empty. On older versions, the stopgap is to delete the flash model sitting above it in the mapping table.

  6. If unified Codex session history is on but the list is empty while the `.jsonl` session files are still there, check whether the real Codex state store sits at `~/.codex/sqlite/state_5.sqlite`. If so, write `sqlite_home` into both the live `config.toml` and the Codex provider template / shared config stored in CC Switch — otherwise switching provider overwrites it again — then run the history migration once more.

    C:\Users\<USER>\.codex\config.toml
    sqlite_home = 'C:\Users\<USER>\.codex\sqlite'
ToolCodex
Version3.16.0 存在 config.toml/auth.json 未同步问题,v3.16.1 修复;v3.16.3 的默认模型被映射表覆盖问题在 v3.17.0 修复;同类 live 字段丢失在 3.16.1-3.19.2 仍有未关闭变种
PlatformsWindowsmacOSLinux
Do I still have to write config.toml by hand to switch API? Was cc-switch not meant to be one-click?
Normally you do not. The v3.16.0 out-of-step problem was fixed in v3.16.1. But CC Switch still rebuilds `config.toml` with its database as the source of truth, so change the provider config or shared config fragment inside CC Switch rather than editing the live file long-term.
After upgrading to 3.16.1, switching back to OpenAI Official still does not use official OAuth. What now?
Run `codex logout`, then `codex login --device-auth`, then restart Codex/Desktop. If it still reproduces, the issue asks for your CC Switch version, OS, Codex version, and reproduction steps before reopening.
Why does wire_api revert to "responses" after I set it to "chat"?
A maintainer explained `config.toml` is rebuilt wholesale by CC Switch and hand edits being overwritten is by design. MiMo moved to the native `openai_responses` preset in v3.16.4, where `wire_api = "responses"` is the expected config.
Hooks need trusting again after switching provider — bug or by design?
A maintainer closed #5770 as by design: `config.toml` is fully rebuilt from the provider snapshot on a switch. Anything you need kept belongs in a shared config fragment. Whether Codex/desktop state such as `[hooks.state]` and `[desktop]` should be preserved unconditionally is still argued in #3700 and #6400.
My MCP config has Windows paths and Codex errors after syncing to Ubuntu. What now?
#4891 is still open. The known risk is that a Windows local path inside `[mcp_servers.*]` travels along with the sync to Ubuntu. The issue asks for cross-platform shared config to be split from platform-specific MCP/Skill config; for now, do not keep MCP entries containing machine-local absolute paths in a shared fragment.

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.