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.
Symptom
Section titled “Symptom”config.toml 和auth.json的内容仍然是之前第三方的api的。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.
Back up `~/.codex/config.toml` and `~/.codex/auth.json` first, so you do not lose your existing login state or custom config while troubleshooting.
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.
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.
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.
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.
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'
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 11 real issues
- #2538Codex OpenAI Official OAuth auth.json may become stale after switching from local route / third-party provider
- #3480codex 切换开启本地路由的供应商(deepseek->xiaomi),config.toml 和 auth.json 未同步切换
- #3695Codex provider 写回会重置 live UI settings from config.toml
- #3700Codex provider 写回会重置 live UI settings from config.toml
- #4258[Codex] 配置deepseek model 修改为 deepseek-v4-pro, 保存后codex配置文件中还是 flash
- #4289Codex unified session history can show empty history when active state DB is under ~/.codex/sqlite
- #4332mimo模型适配问题,peizhi
- #4891MCP配置包含windows路径,不能跨平台同步
- #5770Codex config.toml is fully overwritten when switching providers, causing hooks.state trust data to be lost
- #6400bug(codex): provider switch drops [desktop] mac-menu-bar-enabled = false
- #6457bug(grokbuild): deeplink import collapses multi-model config to one profile
- 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.
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.