Skip to main content

Module usage

Module usage 

Source
Expand description

Per-credential upstream usage / quota snapshot (§17). OAuth subscription channels expose a usage endpoint that reports the account’s rate-limit windows and (where applicable) credit balance for a single credential. Each channel parses its provider-specific response into this shared shape; the raw upstream JSON is retained in UsageSnapshot::raw so the admin UI can surface fields this normalization does not model.

The fetch is driven exactly like a credential refresh (resolve the credential’s pooled client → send Channel::prepare_usage_requestChannel::parse_usage); the host owns transport and persistence.

Structs§

RateLimitResetCreditConsumeResponse
RateLimitResetCredits
UsageCredits
Money / credit balance and on-demand overage, where the channel exposes it (codex credits, claudecode extra_usage).
UsageSnapshot
Normalized usage/quota snapshot for one credential.
UsageWindow
A single rate-limit or quota window. Providers report usage either as a percentage (used_percent) or as absolute counts (used / limit); a window carries whichever the upstream gives. Reset time is kept verbatim as an ISO-8601 string (resets_at) and/or unix seconds (resets_at_unix).
UsageWindowDescriptor
Stable semantics for one provider-specific quota window.

Enums§

RateLimitResetCreditConsumeOutcome
UsageWindowBoundaryConfidence
Confidence in the normalized period boundary.
UsageWindowBoundarySource
Origin of the normalized period boundary.
UsageWindowMeter
Upstream accounting unit for a quota window.
UsageWindowScope
Local-usage scope governed by an upstream quota window.