Skip to content

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

Closed as duplicate

Description

@wbdb

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:

#2992
#3551
#2478

Related bug in this use case:

#3942

Activity

  1. added
    bug
    on Sep 22, 2025
  2. added
    windows-os
    on Sep 25, 2025
  3. breadtk commented on Oct 9, 2025

    @breadtk

    This duplicates #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.. 🤷

  4. paulpv commented on Oct 9, 2025

    @paulpv

    +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
    }
    
  5. paulpv commented on Oct 9, 2025

    @paulpv

    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! :(

    Image

    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.

  6. etraut-openai commented on Nov 2, 2025

    @etraut-openai
    Contributor

    Closing in favor of #2992, which is tracking this feature request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugwindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions