Expand description
Provider usage limits as the provider itself shows them, read ONLY from PTY screens: the
node’s limit heartbeat (crate::limit_heartbeat: one light service PTY per signed-in
provider account) and any node PTY session that happens to show the screen.
- claude:
/usage(and/status) — “Current session” = 5h window, “Current week” = 7d window, the plan from “Claude Max/Pro/Team/Enterprise”. - codex:
/status— its “5h limit” and “Weekly limit” lines. - grok:
/usage— the “Usage limit” panel: “Weekly limit ()”, the spent share, the reset. - kimi:
/usage— its “5h limit” and “Weekly limit” lines (% left).
Nothing is estimated, and no other source is read: no session logs or rollouts, no
provider error text (that only notifies the operator), never tokens, OAuth or auth.json.
Every entry keeps its source and observed_at_ms.
Structs§
- Provider
Limits - RawReading
- A provider’s own limit line, kept as it was shown (providers say
% usedor% left). - Window
Functions§
- changed
- codex_
reset_ ms - A codex reset as shown on its screen:
resets HH:MM(the next such time) orresets HH:MM on D Mon(that day; next year when already past). The screen gives no zone, so it is the node’s local time (now’s offset). - collect
- Everything seen on screens now.
- fresh_
5h_ used - The 5h window usage of
providerif a reading at mostmax_age_msold is known (any source). - now_ms
- observe_
screen - Called from the frame publisher with every scanned session screen.
- observe_
screen_ as - Remember a limit screen under
source(screenorheartbeat). True when it was one. - parse_
claude_ screen - Parse a claude
/usage(or/status) screen.Nonewhen it shows neither. - parse_
codex_ status - Parse a codex
/statusscreen: the5h limit/Weekly limitlines (N% used, orN% left), and the reset in parentheses. Nothing else on the screen is kept (it also shows the account’s email).Nonewhen it shows no limit line. - parse_
grok_ usage - Parse a grok
/usagepanel (“Usage limit” tab):Weekly limit (<plan>), a bar line with the share of the window spent (74%; grok shows usage, so a bare percent there is used), andResets: <date>. The plan in parentheses is the tier.Nonewithout a limit line. - parse_
kimi_ usage - Parse a kimi
/usage(alias/status) screen:5h limit/Weekly limitlines withN% left(kimi shows what is left), with or without a colon, the reset on the same or the next line.Nonewithout a limit line. - parse_
screen - Parse
screenasprovider’s limit screen. - reading
- The percent on
lineand what it means.leftalso coversremaining. - says_
not_ signed_ in - A CLI screen that says the CLI is not signed in (no limit screen will ever come).
- window_
from - A window from a raw reading: used and remaining both derived from it;
unknownkeeps both unset (routing never guesses which way a bare percent goes).