Skip to content

Codex CLI Switching to API key does not work as long as ChatGPT Teams subscription login is active #2733

@wbdb

Description

@wbdb

What version of Codex is running?

0.24

Which model were you using?

gpt-5

What platform is your computer?

Linux 5.15.167.4-microsoft-standard-WSL2 x86_64 x86_64

What steps can reproduce the bug?

Currently, it is difficult in Codex CLI to automatically switch to the API when you reach your limits. Ideally, OpenAI will integrate a fallback here that kicks in automatically so that you don't have to stop in the middle of your work.

  1. I start codex with: codex --config preferred_auth_method="apikey"
  2. I select option 2: "Provide your own API key"
  3. When I hit enter here, I am back at step 2

To use Codex with the OpenAI API, set OPENAI_API_KEY in your environment

Press Enter to return

The OpenAI key is set as ENV: OPENAI_API_KEY.

Error exists in the following versions: 0.23 and 0.24

What is the expected behavior?

Use of the API key.

What do you see instead?

Endless loop, you keep coming back to step 2

You are currently using ChatGPT, while your preferred method is API key.

  1. Continue using ChatGPT
    Included in Plus, Pro, and Team plans
  1. Specify your own API key
    Pay only for actual usage

Additional information

To solve the problem, you have to log out of Codex every time and log back in later. That's just no fun with such low 5-hour limits.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions