ERROR: exceeded retry limit, last status: 401 Unauthorized when using OPENAI_API_KEY
Resolved 💬 4 comments Opened Nov 26, 2025 by maver1ck Closed Jan 14, 2026
What version of Codex is running?
OpenAI Codex v0.63.0 (research preview)
What subscription do you have?
OPENAI_API_KEY
Which model were you using?
gpt-5.1-codex-max
What platform is your computer?
MacOS
What issue are you seeing?
❯ OPENAI_API_KEY="sk-xxx" codex exec "2+2=?"
OpenAI Codex v0.63.0 (research preview)
--------
workdir: /Users/maverick/src/xxx/
model: gpt-5.1-codex-max
provider: openai
approval: never
sandbox: workspace-write [workdir, /tmp, $TMPDIR] (network access enabled)
reasoning effort: high
reasoning summaries: auto
session id: 019ac11e-30c6-7fc3-863b-1af947013d9f
--------
user
2+2=?
mcp: chrome starting
mcp: chrome ready
mcp startup: ready: chrome
Reconnecting... 1/5
Reconnecting... 2/5
Reconnecting... 3/5
Reconnecting... 4/5
Reconnecting... 5/5
ERROR: exceeded retry limit, last status: 401 Unauthorized, request id: 9a4af5870a31a58e-WAW
What steps can reproduce the bug?
Run codex exec with OPENAI_API_KEY
What is the expected behavior?
Codex is working with provided API_KEY
Additional information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗