You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
use account with ChatGPT plus subscription to login Codex CLI get 401 Unauthorized #3002
npm install -g @openai/codex
codex
(in codex): select login, then browser pop up ChatGPT login page, after click to login, terminal into " To get started, describe a task or try one of these commands: ......"
/model > select Minimal
/status > "📂 Workspace
• Path: {my-repo-path}
• Approval Mode: on-request
• Sandbox: workspace-write
• AGENTS files: (none)
👤 Account
• Signed in with ChatGPT
• Login: {my-chatgpt-account-(google-email)}
• Plan: Plus
🧠 Model
• Name: gpt-5
• Provider: OpenAI
• Reasoning Effort: Minimal
• Reasoning Summaries: Auto
"hello, summarize what do README.md say
⚠ stream error: exceeded retry limit, last status: 401 Unauthorized; retrying 1/5 in 214ms…
⚠ stream error: exceeded retry limit, last status: 401 Unauthorized; retrying 2/5 in 430ms…
⚠ stream error: exceeded retry limit, last status: 401 Unauthorized; retrying 3/5 in 789ms…
⚠ stream error: exceeded retry limit, last status: 401 Unauthorized; retrying 4/5 in 1.532s…
⚠ stream error: exceeded retry limit, last status: 401 Unauthorized; retrying 5/5 in 3.336s…
🖐 exceeded retry limit, last status: 401 Unauthorized"
What is the expected behavior?
ChatGPT plus subscription should not out of quota even first time with minimal reasoning effort (I assume 401 is caused by out of quota or system cannot get my credential).
Same issue here with ChatGPT Plus.
I also tried to run /logout, but it didn’t work. The only way I got it working was after clearing the environment variables OPENAI_BASE_URL and OPENAI_API_KEY.
This is very confusing because I chose to sign in with my account (ChatGPT Plus) instead of using an API key.
Activity
Manouchehri commentedon Sep 1, 2025
Getting this with a ChatGPT Pro account today too.
pandac55 commentedon Sep 2, 2025
me too awful
MantraMedia commentedon Sep 4, 2025
I also have this on Pro:
It was working fine a few days ago
TudorCB commentedon Sep 8, 2025
same error. cannot use it since days ago. Please fix this issue.
ascot31 commentedon Sep 9, 2025
Same error ! exceeded retry limit, last status: 401 Unauthorized
ascot31 commentedon Sep 9, 2025
I tried logging out and then logging back in, and that worked for me.
hamed-cta commentedon Sep 12, 2025
Same issue here with ChatGPT Enterprise.
fengqiangzhao commentedon Sep 12, 2025
Same issue here with ChatGPT Plus.
I also tried to run /logout, but it didn’t work. The only way I got it working was after clearing the environment variables OPENAI_BASE_URL and OPENAI_API_KEY.
This is very confusing because I chose to sign in with my account (ChatGPT Plus) instead of using an API key.
makaixindalao commentedon Sep 15, 2025
When I use Codex in WSL2, I can log in successfully but I keep getting 401 errors when using it. It works normally in Windows.
HillPhelmuth commentedon Sep 16, 2025
Same using ChatGPT account. Infuriating.
rr- commentedon Sep 16, 2025
Solution that worked for me: #1243 (comment)
lnnujxxy commentedon Sep 17, 2025
how to fix it?
makaixindalao commentedon Sep 17, 2025
I deleted the OPENAI_BASE_URL and OPENAI_API_KEY in environment variables, then rebooted the system and finally got back to normal
passingby000 commentedon Sep 18, 2025
worked for me. Thank you hugely
etraut-openai commentedon Nov 21, 2025
I think this issue is no longer valid, so I'm closing. If you see similar issues with the latest version of the CLI, please open a new bug report.
faketrader commentedon Jan 16, 2026
still having this 401 issue. OPENAI_API_KEY environment variable is needed for other apps and i must keep it.
etraut-openai commentedon Jan 16, 2026
@faketrader, if you're seeing a behavior you believe to be a bug, please use the
/feedbackslash command to open a new issue.