Powershell does not respect usage of OpenAI key

Resolved 💬 2 comments Opened Oct 16, 2025 by thePostFuturist Closed Nov 15, 2025
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

v0.46.0

What subscription do you have?

API

Which model were you using?

_No response_

What platform is your computer?

Microsoft Windows NT 10.0.26100.0 x64

What issue are you seeing?

starting with codex --config preferred_auth_method=apikey gets auth.json completely wiped and replaces "OPENAI_API_KEY": null and asks to auth with my API account. Basically only sub is supported.

What steps can reproduce the bug?

start from scratch per the instructions above.

What is the expected behavior?

_No response_

Additional information

_No response_

View original on GitHub ↗

2 Comments

github-actions[bot] contributor · 10 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #5230
  • #5212
  • #3367
  • #3286

Powered by Codex Action

etraut-openai contributor · 9 months ago

The behavior you're seeing is by design. Older versions of the CLI implicitly logged in using the API key. This created a bunch of problems given that authentication is shared between the CLI and the IDE extension. We've now simplified it (removing preferred_auth_method in the process). You now need to explicitly log in with either an API key or with ChatGPT. You can use codex login --api-key to log in with an API key.