Repository navigation
Replies: 1 comment
|
Thanks for this write-up, @mark-iap! It matches what I found while building a Windows taskbar widget on top of these numbers. A few things that may help others:
If anyone wants this on the Windows taskbar without writing their own script: CCT (open source, Rust, < 1 MB) shows the same 5h/weekly numbers plus reset times. Disclosure: I'm the author. Adding |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Several recent issues (#56275, #56244, #56240, #55709, #55282, #55267) ask "why did my limit drop so fast?", and #56370 / #24080 ask for a non-interactive way to read the windows. Until something like
codex status --jsonexists, this is what works today with what's already in the repo. Corrections welcome.1. Live snapshot:
account/rateLimits/readThe broken pipe in #56370 (via
codex app-server proxy) goes away if you spawn your own stdio server and keep stdin open until the reply arrives. Messages are newline-delimited JSON; sendinitialize, then theinitializednotification.I verified the handshake on CLI 0.164.0 (signed out, it returns
-32600 codex account authentication required to read rate limits). The signed-in output path is only checked against the protocol types, so treat it as untested. It needs ChatGPT sign-in (API-key auth is rejected), and each call hits the backend usage endpoint, so poll gently. On Windows you may need the full path to thecodexbinary (untested).Notes on the payload:
primary/secondaryare slots, not "5h"/"weekly". Classify bywindowDurationMins(300 / 10080). On Pro plans the count is weekly only (the pricing page says Pro currently has no five-hour limit), so a weekly-onlyprimarywithsecondary: nullis expected there (see Pro account: 5-hour usage bucket disappeared from Codex App and account/rateLimits/read #32707).usedPercentis an integer here;resetsAtis Unix seconds.rateLimitsByLimitIdcan hold more than one bucket;rateLimitsis the backward-compatible single view.account/rateLimits/updatednotifications are sparse: merge them into your last snapshot instead of replacing it.Inside the TUI,
/statusshows the same data, and/statuslinecan addfive-hour-limit/weekly-limit.2. History:
token_countevents in rollout filesEach
token_countevent in~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonlstoresrate_limits(snake_case, floatused_percent) next to the turn's token usage, so you can line up percentage jumps with the turns that caused them:Older, cold rollouts may be compressed to
.jsonl.zst; decompress those first. Subagents write their own rollouts, so include them.3. Reading the numbers
Before calling it a metering bug, check the pricing page: Fast uses included usage at 2.5x and Ultrafast at 8x, and the Plus estimates give GPT-6 Astra 5-45 local messages per 5h against 15-160 for GPT-6.1 Sol. In the jq output, a large
inputwith a lowcachedshare usually means context replay (after a pause or compaction). Ifused_percentjumps with no matching tokens in any local rollout and you had no cloud tasks or other devices running, that is the datapoint worth putting in an issue, next to your feedback ID.All reactions