Switching to API profile after hitting codex limit not possible (codex resume --profile api fails)

Resolved 💬 4 comments Opened Sep 22, 2025 by wbdb Closed Nov 2, 2025
💡 Likely answer: A maintainer (etraut-openai, contributor) responded on this thread — see the highlighted reply below.

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-codex limit.
  • I have API credits available (expiring after one year).
  • I want to continue my work seamlessly by switching to the api profile.
  • 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-5 instead of gpt-5-codex (since gpt-5-codex is not available via API).

Actual behavior:

  • codex resume --profile api does 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:

https://github.com/openai/codex/issues/3942

View original on GitHub ↗

4 Comments

breadtk · 10 months ago

This duplicates https://github.com/openai/codex/issues/2478 somewhat, and personally I don't have a preference between the two.

I think both issues show that there's a common problem of running into ChatGPT plan limits and then wanting to resume/continue on with per usage billing. This means OpenAI is leaving money on the table.. 🤷

paulpv · 10 months ago

+100 !

Seems like someone at OpenAI should use Codex to implement a simple failover to resume a "chatgpt" auth session using "apikey" auth.

I tried and just get the following error:

■ unexpected status 400 Bad Request: {
  "error": {
    "message": "The encrypted content gAAA...lA== could not be verified.",
    "type": "invalid_request_error",
    "param": null,
    "code": null
}
paulpv · 10 months ago

Very poor usability: There is no way to know which one of these sessions are "chatgpt" auth and which ones are "apikey" so that they can be easily successfully resumed! :(

<img width="432" height="749" alt="Image" src="https://github.com/user-attachments/assets/7ef6f40b-845e-4897-af38-e0db97bf3541" />

A person would have to try one auth and have a 50/50 chance they got it right the first time... or then try the other.

etraut-openai contributor · 9 months ago

Closing in favor of https://github.com/openai/codex/issues/2992, which is tracking this feature request.