CodexCli having trouble with Azure OpenAI environment variables

Resolved 💬 1 comment Opened Oct 23, 2025 by utkarsh-arataai Closed Dec 23, 2025

What version of Codex is running?

codex-cli 0.47.0

What subscription do you have?

Azure

Which model were you using?

gpt-5-codex

What platform is your computer?

Darwin 24.6.0 arm64 arm

What issue are you seeing?

My .toml file looks like this

# Set the default model and provider
model = "gpt-5-codex"
model_provider = "azure"
preferred_auth_method = "apikey"
model_reasoning_effort = "medium"

# Configure the Azure provider
[model_providers.azure]
name = "Azure"
# Make sure you set the appropriate subdomain for this URL.
base_url = "https://<my-project-name>-resource.cognitiveservices.azure.com/openai/responses?api-version=2025-04-01-preview"
env_key = "<my_api_key>"
query_params = { api-version = "2025-04-01-preview" }
wire_api = "responses"

When I run code I get this error:
Missing environment variable: <env_key environment variable>

it prints my env_key character for character

What steps can reproduce the bug?

  • Setup the toml as above
  • put your information
  • run codex

What is the expected behavior?

it should run

Additional information

_No response_

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗