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_request →
Channel::parse_usage); the host owns transport and persistence.
Structs§
- Rate
Limit Reset Credit Consume Response - Rate
Limit Reset Credits - Usage
Credits - Money / credit balance and on-demand overage, where the channel exposes it
(codex credits, claudecode
extra_usage). - Usage
Snapshot - Normalized usage/quota snapshot for one credential.
- Usage
Window - 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).