Codex CLI fix: Codex stops mid-task and says the usage limit is reached

Codex CLI hit a usage limit

The line comes from ChatGPT rather than from the CLI on your machine. It names a rolling window, so the only question that matters is which of the two you filled and when that one turns over.

You've hit your usage limit. Upgrade to Pro
Printed by Codex CLI.

Diagnosis

What it actually is

Two rolling windows, not a monthly quota

ChatGPT meters Codex on a 5-hour window and a weekly one. The time in the message is the end of whichever window you filled, which is why the same account is free again within the hour on one day and blocked for days on another.

Nothing on your machine caused it

Codex CLI is relaying what the backend answered. Reinstalling the CLI, clearing $CODEX_HOME or starting a fresh session changes nothing, because the counter lives on the account rather than on the box.

A reset credit may be sitting unused

ChatGPT grants rate-limit reset credits to some accounts. They are separate from the usage windows and from purchased credits, and spending one lifts the current limit at once. The app-server returns them as rateLimitResetCredits beside the windows, so reading only the windows is how a granted credit stays invisible.

The weekly window does not always arrive where you expect

Codex ships the two windows in a primary and a secondary slot, and it now sends the weekly one as primary with secondary empty. Anything that reads the slot rather than the window length can label a weekly block as a 5-hour one, which turns a four-day wait into a promise of forty minutes.

Check

Confirm it before you fix it

Run thisWhat a good answer looks like
codex login statusOne line, Logged in using ChatGPT or the API-key equivalent. Worth ruling out first: the limit is per account, and a machine signed in as an account you did not expect has a different set of windows.
codex doctor --summaryGrouped rows and a count. The auth, network, websocket and reachability rows separate a usage limit from a connectivity failure, which stall in a similar way and are fixed by nothing alike.

Every command here has been run on a real machine. Termdeck answers the same questions for every machine you have connected, without opening a terminal on any of them.

Fix

Cheapest thing first

1. Read which window it was

The reset time in the message is the answer. Under an hour means the 5-hour window and the work continues once it turns over. Days out means the weekly window, and no amount of retrying moves it.

2. Look for a reset credit before paying anything

If the account holds one, spending it lifts the current limit immediately. It is a one-shot grant rather than a plan change, and it is the cheapest lever on the page.

3. Buy credits, or move up a plan, in that order

Credits are consumed as you use them and leave the plan alone. A plan change raises the windows themselves and is the right lever only if you fill them most weeks.

4. Continue on another login

The windows follow the ChatGPT account. A second login carries its own, so signing into it finishes the session instead of waiting out the window.

Not this

What will not help

Reinstalling or updating the CLI

The counter is on the account. A fresh install signs into the same account and meets the same window a second later.

Deleting the session and starting over

Rate limiting has nothing to do with your transcript. Starting again throws away context you then have to rebuild once the window turns over anyway.

FAQ

Codex stops mid-task and says the usage limit is reached, answered

Does the Codex usage limit reset at midnight?

No. Both windows roll, so each one turns over a fixed period after the usage that filled it rather than at a fixed time of day. The message names the exact moment.

Is the 5-hour window the same as the weekly one?

They are separate and either can stop you on its own. An account can be well inside its weekly allowance and still be blocked by the 5-hour window.

Do purchased credits remove the limit?

Credits let work continue past a filled window and are consumed as you go. They do not raise the windows themselves; a plan change does that.

Can I see the limit before I hit it?

Yes. Both windows are readable at any time with a used percentage and a reset time. Termdeck shows them per machine, so the answer arrives before the stall rather than after it.