use account with ChatGPT plus subscription to login Codex CLI get 401 Unauthorized

Resolved 💬 17 comments Opened Aug 31, 2025 by botingw Closed Nov 21, 2025
💡 Likely answer: A maintainer (etraut-openai, contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

codex-cli 0.27.0

Which model were you using?

gpt-5

What platform is your computer?

Darwin 24.4.0 x86_64 i386

What steps can reproduce the bug?

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

📊 Token Usage
• Session ID: 856285e8-9cc8-486c-9bd2-1ce0e95b5b42
• Input: 0
• Output: 0
• Total: 0"

type "hello, summarize what do README.md say"

"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).

What do you see instead?

as in reproduce bug, retry 5 times and fail

Additional information

_No response_

View original on GitHub ↗

17 Comments

Manouchehri · 10 months ago

Getting this with a ChatGPT Pro account today too.

pandac55 · 10 months ago

me too awful

MantraMedia · 10 months ago

I also have this on Pro:

  • 2 projects in the same subnet work
  • 2 projects in other subnets don't and get the error from OP

It was working fine a few days ago

TudorCB · 10 months ago

same error. cannot use it since days ago. Please fix this issue.

ascot31 · 10 months ago

Same error ! exceeded retry limit, last status: 401 Unauthorized

ascot31 · 10 months ago
Same error ! exceeded retry limit, last status: 401 Unauthorized

I tried logging out and then logging back in, and that worked for me.

hamed-cta · 10 months ago

Same issue here with ChatGPT Enterprise.

fengqiangzhao · 10 months ago

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 · 10 months ago

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 · 10 months ago

Same using ChatGPT account. Infuriating.

<img width="397" height="122" alt="Image" src="https://github.com/user-attachments/assets/ae6cc764-03cd-47c3-8969-1e12db3702d4" />

rr- · 10 months ago
lnnujxxy · 10 months ago
Solution that worked for me: #1243 (comment)

how to fix it?

makaixindalao · 10 months ago
> Solution that worked for me: #1243 (comment) how to fix it?

I deleted the OPENAI_BASE_URL and OPENAI_API_KEY in environment variables, then rebooted the system and finally got back to normal

passingby000 · 10 months ago
> > Solution that worked for me: #1243 (comment) > > > how to fix it? I deleted the OPENAI_BASE_URL and OPENAI_API_KEY in environment variables, then rebooted the system and finally got back to normal

worked for me. Thank you hugely

etraut-openai contributor · 8 months ago

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 · 6 months ago

still having this 401 issue. OPENAI_API_KEY environment variable is needed for other apps and i must keep it.

etraut-openai contributor · 6 months ago

@FakeTrader, if you're seeing a behavior you believe to be a bug, please use the /feedback slash command to open a new issue.