KEY NOT FOUND ERROR!

Resolved 💬 2 comments Opened Sep 7, 2025 by adhishthite Closed Nov 2, 2025

What version of Codex is running?

codex-cli 0.30.0

Which model were you using?

gpt-5

What platform is your computer?

Darwin 24.6.0 arm64 arm

What steps can reproduce the bug?

In the config.toml, add:

[profiles.gpt-5]
model_provider = "azure"
model = "gpt-5"

[model_providers.azure]
name = "Azure"
base_url = "https://TENANT.openai.azure.com/openai"
env_key = "AZURE_OPENAI_CODEX_KEY"
query_params = { api-version = "2025-04-01-preview" }
wire_api = "responses"

Then, in your project root, create a .env file with:

AZURE_OPENAI_CODEX_KEY="<KEY>"

Run

codex --profile gpt-5

I get this:

🖐  Missing environment variable: `AZURE_OPENAI_CODEX_KEY`.

----

I can confirm that this was not happening till version 0.28.0.

What is the expected behavior?

I should be able to chat !

What do you see instead?

🖐  Missing environment variable: AZURE_OPENAI_CODEX_KEY.

Additional information

_No response_

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗