Switching to API profile after hitting codex limit not possible (codex resume --profile api fails)
What version of Codex is running?
0.39.0
Which model were you using?
gpt-5 or gpt-5-codex
What platform is your computer?
Windows 11 Pro / WSL2 / Ubuntu 24.04 LTS
What steps can reproduce the bug?
When I hit my gpt-5-codex usage limit in codex-cli 0.39.0, continuing work is unnecessarily painful. I expected to be able to switch to a different profile (e.g. one configured for API key auth) using the resume command, but that does not work.
Command tried:
codex resume --profile api
This fails. I had already defined profiles in my config:
profile = "team"
[profiles.team]
preferred_auth_method = "chatgpt"
[profiles.api]
preferred_auth_method = "apikey"
My intention is simple:
- I reached the
gpt-5-codexlimit. - I have API credits available (expiring after one year).
- I want to continue my work seamlessly by switching to the
apiprofile. - No other expiring “credit pot” with business credits when using API credits.
However, this flow is not supported. Instead, the CLI seems to push you towards topping up ChatGPT credits, which I won’t do since I already have API balance.
Expected behavior:
- Allow resuming a session with a different profile (e.g. API-based) when the current one is exhausted.
- If necessary, fallback to
gpt-5instead ofgpt-5-codex(sincegpt-5-codexis not available via API).
Actual behavior:
codex resume --profile apidoes not switch profiles.- No way to continue smoothly without manually starting a new session and losing context.
Environment:
- codex-cli 0.39.0
- Profiles as shown above
- GPT-5-codex limit reached
Why this matters:
For users with API credits but no interest in topping up ChatGPT balance, the current UX creates friction and blocks progress unnecessarily 🚧.
What is the expected behavior?
Enable the use of a different billing profile with resume. Fallback model to gpt-5 as long as gpt-5-codex is not available at API.
What do you see instead?
_No response_
Additional information
Better general solution - automatic API fallback:
https://github.com/openai/codex/issues/2992
https://github.com/openai/codex/issues/3551
https://github.com/openai/codex/issues/2478
Related bug in this use case:
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗