pub struct ProviderUsage {
pub provider: String,
pub api_provider: Option<String>,
pub account: Option<String>,
pub source: Option<String>,
pub account_info: Option<AccountInfo>,
pub fetched_at: Option<String>,
pub saved_resets: Option<SavedResets>,
pub usage: Option<Usage>,
pub error: Option<String>,
}Expand description
One provider/account’s usage entry. The /usage response is an array of
these. A fetch failure becomes an entry carrying error (silent-degrade),
never a failure of the whole array.
Fields§
§provider: StringCodexBar provider name (e.g. “codex”), which consumers map to their own id.
api_provider: Option<String>Canonical API provider identifier — the models.dev slug for the same
provider (e.g. “openai” when provider == "codex", “anthropic” for
“claude”, “google” for “gemini”, “xai” for “grok”). Present when the
producer knows the canonical name; absent for providers with no models.dev
counterpart, where consumers fall back to provider. Lets every consumer
key on one canonical name instead of each maintaining its own
CodexBar-name → canonical map.
account: Option<String>§source: Option<String>Which retrieval path produced this (e.g. “oauth”) — observability only.
account_info: Option<AccountInfo>§fetched_at: Option<String>§saved_resets: Option<SavedResets>§usage: Option<Usage>§error: Option<String>Present only on a degraded entry. The consumer skips any entry with a
truthy error.
Implementations§
Trait Implementations§
Source§impl Clone for ProviderUsage
impl Clone for ProviderUsage
Source§fn clone(&self) -> ProviderUsage
fn clone(&self) -> ProviderUsage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more