cortexkit-provider-usage 0.6.0

Shared wire types for the ai-provider-quota usage.get payload: ProviderUsage, Usage, RateWindow, and account/reset metadata. Pure serde, no logic.
Documentation

Shared wire types for the ai-provider-quota module's usage.get payload.

The quota module serves an array of [ProviderUsage] per request; ALF's router (codexbar-window-extractors.ts), astrocyte's capacity axis, and the ck quota renderer all consume that shape. This crate is the single definition those consumers compile against, so the wire shape cannot drift without a shared-crate PR every side reviews.

Shape, not policy

These are pure data types. Read-time transform semantics are PRODUCER behavior documented on the relevant fields but NOT enforced here:

  • Banked-reset relaxation: the quota module may zero [RateWindow::used_percent] (the EFFECTIVE number consumers pace on) and carry the provider-reported truth in [RateWindow::raw_used_percent]. A consumer renders whatever the wire says; a sudden 0 → high transition is an honest disarm (credits spent / auth broke), not a glitch.
  • Cache-only partial arrays: the quota module never blocks on a fetch, so a result may omit providers not yet swept. Missing ≠ zero.
  • Degraded entries ride in-band: a provider fetch failure is a normal [ProviderUsage] carrying error, not a request-level failure.

Serialization contract consumers depend on

  • camelCase keys (usedPercent, resetsAt, windowMinutes, extraRateWindows, rawUsedPercent, accountInfo, savedResets, usedCount, totalCount).
  • A healthy entry MUST NOT carry error (consumers skip truthy-error entries), so it is omitted when absent.
  • A window is emitted when it has a usedPercent; resetsAt is OPTIONAL and omitted when the provider reports no reset (never fabricated).