Quick answer
Run `codex login status` to see which account is active. If it reports no session, run `codex login` and complete the browser flow. If it reports a valid session but requests still fail, the problem is usually the network, a proxy, or a usage window rather than authentication.
Tell the errors apart
| Message | Likely cause | First action |
|---|---|---|
| Not logged in | No token or expired token | `codex login` |
| Invalid API key | Wrong key in env | Unset the key or replace it |
| 403 or 429 | Access or rate limit | Check plan and usage window |
| Network error | Proxy, VPN, DNS | Test with a direct connection |
Reset the login cleanly
- Run
codex login statusand note the account. - Run
codex logoutif the account is wrong. - Run
codex loginand finish in the browser. - Restart the terminal so the new token is loaded.
- Check
CODEX_API_KEYor a proxy env var that may override the login.
codex login status
codex logout
codex loginIf login is fine but usage looks wrong
Authentication and usage are separate. A valid session can still be blocked by a window. Check the usage panel before changing credentials again.
If a tracker shows nothing after a successful login, the cause is file access, not auth. See Codex usage not showing.
Separate an auth failure from a usage block
| Message | Cause | Fix |
|---|---|---|
| Not signed in | Expired session | Run the login command again |
| Token expired | Refresh failed | Sign out, then sign in |
| Forbidden | Plan or region restriction | Check plan and account |
| Rate limited | Usage window or rate | Wait or switch account |
Re-authenticating does not restore usage, and waiting does not fix an expired token. Read the exact error before trying either. If the CLI works but a tracker does not, the problem is file access rather than login, which Codex usage not showing covers.
Questions, answered
What does codex login status show?
It reports whether a session is active and which account it belongs to. Exact wording varies by version.
Why does Codex say I am not logged in after it worked yesterday?
The token expired or was revoked. Log in again; if it repeats, check for a proxy or clock skew.
Does logging out delete my usage history?
No. Session files stay on disk. Logging out only clears credentials.