codex doesn't recognize OPENAI_API_KEY after setting it

Resolved 💬 2 comments Opened Apr 16, 2025 by fschlz Closed Apr 16, 2025

My API key is available in the environment after running source .env, but I'm still getting

Missing OpenAI API key.

Set the environment variable OPENAI_API_KEY and re-run this command.
You can create a key here: https://platform.openai.com/account/api-keys

Does it need to be a special one, or is any OpenAI API Key accepted? (i.e. keys that are assigned to a project vs. default vs. personal)

View original on GitHub ↗

2 Comments

wirewalker · 1 year ago

i used
export OPENAI_API_KEY="YOUR KEY"
codex

fschlz · 1 year ago

after generating a new key, and running the export command directly in the terminal it seems to work