Skip to main content

Module quota

Module quota 

Source
Expand description

Provider quota: snapshots, pluggable checkers, and cooldown policy. Provider quota.

A subscription-backed provider does not fail like a service does. It works perfectly until a window is exhausted, refuses everything until that window resets, then works perfectly again. Routing around that needs one thing the crate did not have: a reading of how much budget is left, taken before a turn is spent rather than inferred from the corpse of a failed one.

§The one rule

Never compute a reset time. Windows are rolling and anchored per account, not aligned to a calendar. Two Claude accounts on one machine were observed resetting their weekly windows three days apart. Every reset instant here is one the provider stated; nothing in this module derives one from a wall clock.

§Limitations

A QuotaSnapshot describes an account, not a process. Two processes sharing an account share its budget and each will read the same figure without knowing about the other’s spending.

Structs§

Cooldown
How long a failed probe stays out of the water, and why.
QuotaSnapshot
One window’s worth of quota, as the provider reported it.

Traits§

LimitChecker
Something that can report how much of a provider’s budget remains.

Functions§

iso8601_to_system_time
Convert an ISO-8601 instant to SystemTime.
parse_anthropic_usage
Turn an Anthropic OAuth usage payload into snapshots.