Cannot use Azure as a Provider post #1324 fix

Resolved 💬 4 comments Opened Jun 23, 2025 by kingdomseed Closed Aug 7, 2025

What version of Codex is running?

v0.1.2505172129

Which model were you using?

o3

What platform is your computer?

Darwin 24.5.0 arm64 arm

What steps can reproduce the bug?

  1. Setup config in ~./.codex/config.json as follows:
{
  "model": "o3",
  "provider": "azure",
  "providers": {
    "azure": {
      "name": "AzureOpenAI",
      "baseURL": "https://jhd-codex-rg.openai.azure.com/openai",
      "envKey": "AZURE_OPENAI_API_KEY"
    }
  },
  "history": {
    "maxSize": 1000,
    "saveHistory": true,
    "sensitivePatterns": []
  }
}
  1. Export the api key in terminal with: export AZURE_OPENAI_API_KEY="KEY IS HERE"
  2. Run `codex --provider azure "hello"

What is the expected behavior?

Expect message to connect to Azure as the provider, send a message, and receive a response.

What do you see instead?

Instead I receive a message to sign in to ChatGPT:

Sign in with ChatGPT to generate an API key or paste one you already have.
[use arrows to move, enter to select]

❯ Sign in with ChatGPT
  Paste an API key (or set as OPENAI_API_KEY)"`

Additional information

Once I sign in to OpenAI, codex correctly uses Azure as its provider but fails with a new error and no help screen is provided as described in this merged PR: 1324

New error:

│ ● OpenAI Codex (research preview) v0.1.2505172129            │
╰──────────────────────────────────────────────────────────────╯
╭──────────────────────────────────────────────────────────────╮
│ localhost session: 4a8c9bdc618845069dea764b67a6418e          │
│ ↳ workdir: ~/development/mythicgme2e                         │
│ ↳ model: o3                                                  │
│ ↳ provider: azure                                            │
│ ↳ approval: suggest                                          │
╰──────────────────────────────────────────────────────────────╯
user
hello

    system
    ⚠️  OpenAI rejected the request. Error details: Status: 401, Code: 401, Type: unknown, Message: 401 Access denied due to invalid
    subscription key or wrong API endpoint. Make sure to provide a valid key for an active subscription and use a correct regional API
    endpoint for your resource.. Please verify your settings and try again.

Happy to share more details as requested. Would be great to have azure finally working with codex.

View original on GitHub ↗

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