codex icon indicating copy to clipboard operation
codex copied to clipboard

codex doesn't recognize OPENAI_API_KEY after setting it

Open fschlz opened this issue 1 year ago • 2 comments

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)

fschlz avatar Apr 16 '25 18:04 fschlz

i used
export OPENAI_API_KEY="YOUR KEY" codex

wirewalker avatar Apr 16 '25 18:04 wirewalker

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

fschlz avatar Apr 16 '25 18:04 fschlz