-
Notifications
You must be signed in to change notification settings - Fork 10.2k
env variable not found in windows terminal #709
Description
What version of Codex is running?
0.1.2504251709
Which model were you using?
gemini-2.0-flash
What platform is your computer?
Microsoft Windows NT 10.0.26100.0 x64
What steps can reproduce the bug?
I am installing Codex using the npm library, and I want to set up the environment variable for the API key.
In my PowerShell, I run the following command:
setx GEMINI_API_KEY "your_api_key"
This saves the API key in the Windows global environment variables.
I can verify that it was saved correctly by running:
node -e "console.log(process.env.GEMINI_API_KEY)"
This successfully prints my API key.
When I run codex in the terminal, I still get the following error:
` Missing Gemini API key.
Set the environment variable GEMINI_API_KEY and re-run this command.
You can create a GEMINI_API_KEY in the Google AI Studio.
`
Even though the environment variable is set, the error persists.
I also tried setting the environment variable for the current session using:
$env:GEMINI_API_KEY = "your_api_key"
But the problem remains — Codex still does not recognize the API key.
Additionally, I modified the .codex config file located at:
C:\Users\<username>\.codex
In the config file, I manually added the envKey under the Gemini section with my API key.
However, even after these changes, I am still facing the same issue.
What is the expected behavior?
No response
What do you see instead?
Additional information
In windows os how the program see the env variable data. And as I know that when I save the env file in windwos it save on the enviromant variable that you can see by searching the Edit Enviroment Variable and then you see a popup like this
and then in the inside the enviroment variable you have the data. Am I right?

