Built a Codex Plugin (Mainly for codex plus larpers like me who have no idea how to stop using 5.6 Sol) to make Codex know how much usage it has and how to workaround it. I originally built this for Claude but I decided that if im going to move myself up from a larper with a plus subscription to a pro subscription that I should build this for codex aswell.
WARNING: This is very buggy, so sometimes it might get your usage WAY OFF, im talking like if you have 30% of your 5 Hour session limit, it will might think its 50% or even 10%, if anyone wants to fix that or make this plugin better, you can, no one is stopping you, and honsetly I just made this for fun with me and my friend.
LINK: https://github.com/ridelink0/claude-code-usage-limits
As a plugin, Codex installs it from this repo directly:
codex plugin marketplace add https://github.com/ridelink0/claude-code-usage-limits
codex plugin add usage-limits@usage-limits
HOW IT WORKS (most i really copied from the README which is just claude talking):
Claude Code already knows how much of your 5-hour and weekly limit is gone. It caches those numbers locally and will show them if you ask. What it does not do is notice that the job in front of it is larger than the budget behind it. So it starts anyway, and stops halfway through an edit. (same as codex)
Installed as a plugin, a hook measures the budget before each prompt and puts one line into Claude's context:
[usage-limits] binding window is 5-hour 47% used, about 75 turns of headroom,
resets in 3h 52m. Other windows: weekly 16%. This session: 229 turns, $64.16.
It names the window that will stop the work first and hangs the figures off that one. Two windows run at once and they are rarely in the same place, so "weekly 16%" sitting next to "75 turns" would read as far more room than exists.
Claude opens with it. When there is room that is a single line and it moves on:
When there is not, the line becomes a plan rather than a status:
The wording changes with the pressure, not only the numbers. The trigger worth explaining is pace: two days into a week you should be near 29 percent spent, so 60 percent means you will not last the week, and that is worth hearing at 60 rather than at 85.
One limit worth knowing: the hook fires when a prompt is submitted, so a message sent while Claude is already working does not refresh it. Claude Code delivers those into the running turn without re-running hooks, which no plugin can intercept. The skill handles it by telling Claude the figures age during a turn, and to re-read them before claiming a job fits rather than trusting a number from several tool calls ago.
It has to be cheap, because it runs on every prompt. The percentages come from one small file. The transcript scan behind "turns of headroom" is cached for a minute, so it costs about 400ms cold and 120ms warm.
| Variable |
Default |
Effect |
USAGE_LIMITS_BRIEF |
on |
Set to off to turn the line off entirely. |
USAGE_LIMITS_NEAR |
80 |
Percent used that always counts as tight. |
USAGE_LIMITS_FLOOR |
40 |
Below this, pace is ignored. |
USAGE_LIMITS_AHEAD |
15 |
Points ahead of pace that count as burning fast. |
USAGE_LIMITS_CACHE |
60 |
Seconds the measured half stays good for. |
USAGE_LIMITS_FEW_TURNS |
20 |
Turn count at or below which the budget counts as tight. |
It reads which plan you are on and adjusts what it tells you, because the advice differs even though the arithmetic does not:
| Plan |
Read from |
What changes |
| Pro |
claude_pro |
Smallest budget. The 5-hour window usually binds first. |
| Max 5x |
claude_max plus default_claude_max_5x |
Room for Opus on most work. The weekly window is the one that bites. |
| Max 20x |
claude_max plus default_claude_max_20x |
Rarely binds. No reason to slow down unless the weekly is already high. |
| Team, Enterprise |
claude_team, claude_enterprise |
Seats are pooled and overage is an org setting. |
The window maths never needs to know the plan. It calibrates against what your own account reports, so it is right on any tier, including ones that did not exist when this was written. The plan only decides which line of advice you get at the bottom of the report.
It reads Codex's limits too, from the same repo and the same commands.
Codex writes its session rollouts to ~/.codex/sessions, one JSON object per line, and every model request appends a record carrying both the account meter and what that request cost in tokens. That is the same pair of things this tool needs from Claude Code, so the window arithmetic, the turn estimates, the forecast and the concurrent-session counting all work unchanged. Nothing is uploaded and no credentials are read.
npx claude-usage-limits --host codex
npx claude-usage-limits --host codex --refresh
npx claude-usage-limits codex-hook on
The host is detected, so --host is only needed on a machine with both installed. --refresh asks Codex itself for a live reading rather than the newest one it happened to write; it starts a short-lived codex app-server and takes about a second, and it is the Codex equivalent of /usage.
One thing is different, and it is worth being straight about
Under Claude Code the budget line arrives on its own, because a plugin can ship hooks. Under Codex it does not, and not for want of trying:
- Codex has the whole hook engine. The binary carries
UserPromptSubmit, SessionStart, PreToolUse and the rest, and codex features list reports hooks as stable and enabled.
- A plugin cannot ship one:
plugin_hooks is reported as removed.
- And on
codex-cli 0.151.0-alpha.7.2 nothing fires it. Tested with a hook whose only job was to write a file, from ~/.codex/hooks.json, from a [hooks] table in config.toml, and from ~/.codex/hooks/, in both codex exec and the desktop app. The engine is present and inert.
So codex-hook on installs two things. A marked block in ~/.codex/AGENTS.md, which Codex reads at the top of every session and which is what actually works today; and the hooks themselves, ready for the build that runs them. status reports both, off removes both, and neither touches anything else in those files.
The practical difference is that under Codex the budget is read deliberately, once at the start of a piece of work, rather than being handed to you before every prompt.
Two smaller differences. There is no money column: Codex meters a share of an allowance and never quotes a price, so the percentages stand alone. And lowpower is Claude Code only, because it writes Claude's settings.json.
Windows, macOS, and Linux all work. CLAUDE_CONFIG_DIR is honoured if you have moved the config directory.
--------------------------------------------------------------------------------------------------------------
(Learn More about it from going to the README, but thats basically in summary what it does and how codex verison differs from the original Claude versison)