Codex desktop shows "Custom" or 401 Unauthorized - cc-switch
Quick fix
Enable "Keep official login when switching to third party" in cc-switch settings and ensure Codex is logged into the official ChatGPT account, or start a new…
Symptom
Section titled “Symptom”unexpected status 401 Unauthorized: Incorrect API key provided: ark-ee1b**********************************93eb. You can find your API key at https://platform.openai.com/account/api-keys., url: https://api.openai.com/v1/responses, cf-ray: a2e67f46795d1e19-YVR, request id: req_2dbb31e84df94ce1b1d7759febf558ef 还是不行为什么unexpected status 401 Unauthorized: Incorrect API key provided: ark-ee1b**********************************93eb. You can find your API key at https://platform.openai.com/account/api-keys., url: https://api.openai.com/v1/responses, cf-ray: a2e67f46795d1e19-YVR, request id: req_2dbb31e84df94ce1b1d7759febf558ef Still not working, why
The Codex desktop and CLI model selector determines whether to display third-party custom models based on whether the official ChatGPT identity is logged in. Without the official login state, the desktop client forcibly falls back to the official default model, causing the model selector to only show "Custom" or the default model. cc-switch cannot directly rewrite this internal logic in Codex. Additionally, if the official login state was previously used in an old conversation, after switching to a third-party provider, the old conversation will still attempt to use the old official credentials to send requests, causing the request to be routed to `api.openai.com` and triggering a 401 Unauthorized error. In v3.17.0, cc-switch introduced the "Codex official ChatGPT session local routing takeover" feature, making switching between third-party providers a "hot switch" that no longer requires restarting Codex and does not touch `auth.json`, thereby preventing the loss of the login state. However, since old conversations are already bound to a specific session state, a new conversation must be started to apply the new routing configuration.
Ensure you have logged into the official ChatGPT account at least once in the Codex desktop client to guarantee that the official login credentials exist in `~/.codex/auth.json`.
Open cc-switch settings, find the "Codex app enhancements" or "Routing" settings, enable "Keep official login when switching to third party" and the local routing master switch, and enable takeover for Codex.
Add the third-party provider you are using to the routing takeover targets. From then on, switching between third-party providers is a hot switch, requiring no Codex restart, and the official login will always be retained.
If you encounter a 401 Unauthorized error in an old conversation, abandon the old conversation and start a new conversation window to use the configured third-party provider normally.
If you need to manually specify a model (e.g., GPT-5.6), you can modify the `~/.codex/config.toml` file, change `model` to `gpt-5.6-sol`. After restarting Codex, even if it displays as Custom, the actual request will execute with the specified model.
~/.codex/config.toml model = "gpt-5.5"model = "gpt-5.6-sol"
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 9 real issues
- #3655codex桌面端使用cc无法接入minimax模型,按照步骤操作后在codex上模型显示自定义。
- #4257仅添加DeepSeek,codex切换模型处显示自定义
- #4467Codex 切换到provider后 Subagent 无法spawn
- #5170gpt5.6无法显示
- #5180关于 ChatGPT Codex Free登录+请求走三方key 切换优化释义
- #5286[Bug] Codex 增强模式保留官方登录时,GPT-5.4/5.5 提示该分组下的模型不存在
- #5752怎么卸载便携版,用chatGPt账号登录,现在我把软件删了还是没有原本官方的登录页面
- #5837chatGPT官方/第三方供应商的model_provider定义
- #6677unexpected status 401 Unauthorized: Incorrect API key provided: ark-ee1b**********************************93eb. You can find your API key at https://platform.openai.com/account/api-keys., url: https://api.openai.com/v1/re
- Why does the Codex desktop model selector only show "Custom" after I configured a third-party provider in cc-switch?
- This is a limitation of the Codex desktop client itself. Its model selector determines whether to display third-party models based on whether the official ChatGPT identity is logged in. Please enable "Keep official login when switching to third party" in cc-switch settings, ensure you are logged into the official ChatGPT account, and then completely quit and restart the Codex desktop client.
- Why does the previous conversation report a 401 Unauthorized error after switching third-party providers?
- The old conversation is already bound to the previous official login state. After switching providers, the old conversation will still attempt to use the old credentials to request `api.openai.com`, resulting in a 401. Start a new conversation window to use the new third-party provider normally.
- How do I use the GPT-5.6 model?
- Update Codex CLI to v0.144.0 or above, or update the Codex desktop client to the latest version (the software name will change to ChatGPT). If it still does not appear on the desktop client, you can manually modify `~/.codex/config.toml`, change `model` to `gpt-5.6-sol`. After restarting, even if it displays as Custom, it can actually call this model.
- How do I restore Codex's original official login after uninstalling cc-switch?
- Delete the relevant custom fields in `~/.codex/config.toml` (such as `model_catalog_json`, etc.), and clear `~/.codex/auth.json`, then restart Codex to see the original official login page.
- What should I do if Subagent cannot spawn after switching providers?
- This is usually because after switching to a custom provider, the current session lacks the spawn tool exposure. It is recommended to check whether the provider's configuration is complete, or try starting a new conversation. This issue remains open in some versions, and the official team is still investigating.
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.