VS Code extension keeps switching from ChatGPT Plus auth to API key / Codex mode
Open 💬 3 comments Opened Apr 9, 2026 by apoapostolov
💡 Likely answer: A maintainer (github-actions[bot], contributor)
responded on this thread — see the highlighted reply below.
Problem
For the last 2-3 days, the VS Code Codex extension has started forgetting my ChatGPT Plus subscription state and switching me to API-key/Codex auth. It then repeatedly asks me to relogin before it will use the ChatGPT Plus subscription again.
What I expected
- Stay on my ChatGPT Plus subscription session
- Keep using subscription-backed auth unless I explicitly switch providers
- Not require constant relogin to get back to the subscription mode
What actually happens
- Extension silently flips to API key / Codex mode
- It forgets the ChatGPT Plus subscription state
- I have to relogin over and over to return to using the subscription
Environment
- VS Code Codex extension
- ChatGPT Plus subscription
- Started happening recently, around the last 2-3 days
Impact
This makes the extension unreliable because the auth state is not sticky and the extension does not preserve the subscription-backed session between launches or during normal use.
Notes
This is different from a simple 401 or one-off login failure. The issue is that the extension keeps reverting away from my ChatGPT Plus session and into API-key/Codex behavior without me asking for that.
3 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
I'm familiar with the auth code in the extension, and I can't think of any way that it could "switch you to API-key" without some action on your part. Is there any chance you have a script (or an agent) that's modifying the
~/.codex/auth.jsonfile on disk?This is also the first time we've received any report of this, so I don't think this is a widespread issue.
I checked my local auth file and here is the sanitized diagnostic information from it.
I am not posting any raw tokens publicly, but I can provide more details privately if needed.
Local auth file
C:\Users\theap\.codex\auth.json2026-02-15 06:09:51Safe fields from
auth.jsonauth_mode:chatgptOPENAI_API_KEY:nullaccount_idsuffix:...45e405Safe decoded token metadata
From the currently persisted tokens (decoded locally, not verified, and only non-secret fields listed):
id_token.auth_provider:passwordid_token.email_verified:trueid_token.chatgpt_plan_type:plusaccess_token.chatgpt_plan_type:plusaccess_token.chatgpt_compute_residency:no_constraintaccess_token.session_idsuffix:...oqIRLt6CReproduction / behavior details
I probably did not explain the issue clearly the first time. The problem started after updating to VS Code 1.115.
Before that update, I was already logged in with my ChatGPT Plus subscription. The model selector showed my last used model normally, and prompts returned responses as expected.
After the update, the last used model now appears as
Custom, andGPT-5.4-Miniis no longer shown there. When I try to prompt, I get 5Reconnectingsystem messages, followed bystream disconnected.In Settings, I now see two account-related options:
In practice, both paths lead to the same result: the same 5
Reconnectingmessages, and the prompt never completes.The only temporary workaround I have found is to log out and then log back in with my ChatGPT account via the browser OAuth flow. After that, the session works again, but only until I close the VS Code window. Once I open another window or start a new session, the same problem returns.
Important clarification
The problem itself started about 2 days ago after updating to VS Code 1.115.
About external modification
You asked whether a script or agent might be modifying
~/.codex/auth.json.I do not intentionally have anything that should be rewriting it, and I searched my current workspace for references to
.codex/auth.json/auth.jsonand found no matches.If useful, I can also capture: