Skip to main content

Module provider_limits

Module provider_limits 

Source
Expand description

Provider usage limits as the provider itself reports them. Honest sources only: nothing is estimated, a provider with no source reports nothing.

  • claude: its own /usage (and /status) screens as rendered in a node PTY session — “Current session” = 5h window, “Current week” = 7d window, the plan from “Claude Max/Pro/Team/Enterprise”. The node never types /usage into a session; it only reads screens the session already shows. Credential files are never opened.
  • codex: rate_limits in its own rollout logs (~/.codex/sessions/**/rollout-*.jsonl): primary/secondary windows with used_percent, window_minutes and reset time, plan_type.
  • others: implement LimitSource.

Structs§

CodexRollouts
Codex: newest rollout file, last line with rate_limits.
ProviderLimits
Window

Traits§

LimitSource
A provider-specific reader. read must only use data the provider produced itself.

Functions§

collect
Everything known now: screen-derived entries plus every file source.
default_sources
fresh_5h_used
The 5h window usage of provider if a reading at most max_age_ms old is known.
now_ms
observe_screen
Called from the frame publisher with every scanned screen.
parse_claude_screen
Parse a claude /usage (or /status) screen. None when it shows neither.
parse_codex_line
Parse one codex rollout line carrying rate_limits.