pub struct UsageSnapshot {
pub run_id: String,
pub latest_usage: Option<Usage>,
pub total_usage: Usage,
pub estimate_pricing: Option<PricingEstimate>,
pub entries: Vec<UsageSnapshotEntry>,
pub agent_usages: BTreeMap<String, UsageAgentTotal>,
pub model_usages: BTreeMap<String, Usage>,
pub model_estimate_pricing: BTreeMap<String, PricingEstimate>,
}Expand description
Cumulative usage snapshot for one run.
Realtime consumers should treat each snapshot as a replacement for the previous snapshot with the same run id.
Fields§
§run_id: StringRun identifier for the snapshot.
latest_usage: Option<Usage>Usage reported by the latest provider request that produced this snapshot.
This is intentionally separate from total_usage: realtime UI surfaces may use
the latest request total tokens as the current context-window estimate,
while total_usage remains the cumulative run ledger.
total_usage: UsageCumulative usage across all known entries in this run.
estimate_pricing: Option<PricingEstimate>Estimated cumulative pricing across all known entries in this run, in USD.
entries: Vec<UsageSnapshotEntry>Per-agent/source cumulative usage entries.
agent_usages: BTreeMap<String, UsageAgentTotal>Cumulative usage grouped by agent id.
model_usages: BTreeMap<String, Usage>Cumulative usage grouped by model id.
model_estimate_pricing: BTreeMap<String, PricingEstimate>Estimated cumulative pricing grouped by model id, in USD.
Trait Implementations§
Source§impl Clone for UsageSnapshot
impl Clone for UsageSnapshot
Source§fn clone(&self) -> UsageSnapshot
fn clone(&self) -> UsageSnapshot
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more