#[non_exhaustive]pub struct CumulativeTokenUsage {
pub prompt_tokens: u64,
pub output_tokens: u64,
pub total_tokens: u64,
pub cache_read_tokens: u64,
pub cache_write_tokens: u64,
pub cost: Option<CumulativeCost>,
}Expand description
Session running totals of counted-once usage.
The cache splits and server-computed cost join the counters. The counters
stay accumulate-only; cost is the documented exception — it may move
either way on price re-adoption and is labeled estimate. Copy was dropped
for the cost member.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.prompt_tokens: u64Counted-once prompt tokens, session total.
output_tokens: u64Output tokens, session total.
total_tokens: u64Counted-once totals, session total.
cache_read_tokens: u64Cache-read tokens, session total: saturating sum of the per-completion splits; an absent split contributes 0. Additive-optional: absent on the wire reads as 0 and zero totals are omitted, so pre-feature bytes decode and re-encode identically.
cache_write_tokens: u64Cache-write tokens, session total. Additive-optional like the read split.
cost: Option<CumulativeCost>Server-computed session cost: None (wire-absent) when no leg is priced
— clients omit the row. Additive-optional: absent reads as unpriced.