Keeps getting 401 issue when using Azure instance even everything is being passed correctly
What version of Codex is running?
0.1.2505172129
Which model were you using?
gpt-4.1
What platform is your computer?
macos
What steps can reproduce the bug?
codex --provider azure --model gpt-4.1 "explain the code to me"
● OpenAI Codex (research preview) v0.1.2505172129 │
╰──────────────────────────────────────────────────────────────╯
╭──────────────────────────────────────────────────────────────╮
│ localhost session: ac4797c9e1fa44398e7035723217d606 │
│ ↳ workdir: ~/Work/loa-parser │
│ ↳ model: gpt-4.1 │
│ ↳ provider: azure │
│ ↳ approval: suggest │
╰──────────────────────────────────────────────────────────────╯
user
explain the code to me
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.
export AZURE_OPENAI_API_KEY="***"
export AZURE_OPENAI_API_VERSION=2025-01-01-preview
export AZURE_BASE_URL=https://xxxx.openai.azure.com/openai
What is the expected behavior?
_No response_
What do you see instead?
_No response_
Additional information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗