Skip to content

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

Closed

Description

@botingw

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

Activity

  1. added
    bug
    on Aug 31, 2025
  2. Manouchehri commented on Sep 1, 2025

    @Manouchehri

    Getting this with a ChatGPT Pro account today too.

  3. pandac55 commented on Sep 2, 2025

    @pandac55

    me too awful

  4. MantraMedia commented on Sep 4, 2025

    @MantraMedia

    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

  5. TudorCB commented on Sep 8, 2025

    @TudorCB

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

  6. ascot31 commented on Sep 9, 2025

    @ascot31

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

  7. ascot31 commented on Sep 9, 2025

    @ascot31

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

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

  8. hamed-cta commented on Sep 12, 2025

    @hamed-cta

    Same issue here with ChatGPT Enterprise.

  9. fengqiangzhao commented on Sep 12, 2025

    @fengqiangzhao

    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.

  10. makaixindalao commented on Sep 15, 2025

    @makaixindalao

    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.

  11. HillPhelmuth commented on Sep 16, 2025

    @HillPhelmuth

    Same using ChatGPT account. Infuriating.

    Image
  12. rr- commented on Sep 16, 2025

    @rr-

    Solution that worked for me: #1243 (comment)

  13. lnnujxxy commented on Sep 17, 2025

    @lnnujxxy

    Solution that worked for me: #1243 (comment)

    how to fix it?

  14. makaixindalao commented on Sep 17, 2025

    @makaixindalao

    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

  15. passingby000 commented on Sep 18, 2025

    @passingby000

    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

  16. added
    auth
    on Nov 16, 2025
  17. etraut-openai commented on Nov 21, 2025

    @etraut-openai
    Contributor

    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.

  18. faketrader commented on Jan 16, 2026

    @faketrader

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

  19. etraut-openai commented on Jan 16, 2026

    @etraut-openai
    Contributor

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

  20. locked as resolved and limited conversation to collaborators on Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    authbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions