built-in provider IDs: openai - Codex
Quick fix
Upgrade CC Switch to v3.16.4+, delete the old config and save again. Enable unified Codex session history and use openai_base_url.
Symptom
Section titled “Symptom”invalid configuration: model_providers contains reserved built-in provider IDs: `openai`.
Built-in providers cannot be overridden.
Rename your custom provider (for example, `openai-custom`).CC Switch has a few legacy problems when modifying the Codex config file. First, older versions tried to write a `[model_providers.openai]` section straight into config.toml, but `openai` is a reserved built-in Codex provider ID that cannot be overridden, triggering the `invalid configuration` error. Second, they used `base_url` rather than `openai_base_url` when configuring the default endpoint, or left duplicate stale entries in the file, producing 401 unauthorized errors or requests still going to the official site.
Upgrade CC Switch to v3.16.4 or newer, which fixed the duplicate leftover `base_url` and added official session sharing.
Delete the old Codex config file, then save the provider config again in CC Switch so the new version generates the correct config structure.
C:\Users\Administrator\.codex\config.toml # 错误写法(会导致 401):# base_url = "http://127.0.0.1:15721/v1"# 正确写法(默认 OpenAI):openai_base_url = "http://127.0.0.1:15721/v1"# 正确写法(自定义 provider):# [model_providers.custom]# base_url = "http://127.0.0.1:15721/v1"To share Codex session history between a third-party endpoint and your official account, enable 统一 Codex 会话历史 (unified Codex session history) under 设置 → Codex 应用增强 (Settings > Codex app enhancements) in CC Switch. Never override `[model_providers.openai]` in the config file by hand.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 3 real issues
- I deleted `[model_providers.openai]` from config.toml by hand — why does CC Switch add it back on save?
- Automatic behaviour in older CC Switch when routing is on. Upgrade to v3.16.4+ and use 统一 Codex 会话历史 (unified Codex session history) under 设置 → Codex 应用增强 for sharing, rather than overriding the built-in openai provider by hand.
- I configured `base_url` but requests still go to the official site, or I get a 401. What now?
- There may be duplicate or stale `base_url` entries in the config file, or the field name may be wrong. Upgrade to v3.16.4+, delete the old config, and save again. Make sure the default config uses `openai_base_url`, and that a custom provider `base_url` sits inside its `[model_providers.<name>]` section.
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.