pub struct Usage {
pub input_tokens: u64,
pub output_tokens: u64,
pub cache_read_tokens: Option<u64>,
pub cache_creation_tokens: Option<u64>,
pub reasoning_tokens: Option<u64>,
}Expand description
Token accounting parsed from the provider’s terminal usage event.
Fields§
§input_tokens: u64Input (prompt) tokens.
output_tokens: u64Output (completion) tokens.
cache_read_tokens: Option<u64>Tokens served from the prompt cache. None = this wire/provider does
not report the counter; Some(0) = reported as zero (a real signal:
no cache hit). ADR-0009 amendment 2026-07-19 — zero-as-N/A rejected.
cache_creation_tokens: Option<u64>Tokens written to the prompt cache (None on wires that never report
writes, e.g. the OpenAI family).
reasoning_tokens: Option<u64>Reasoning/thinking tokens (None on wires that fold them into
output_tokens, e.g. Anthropic).
Trait Implementations§
Source§impl AddAssign for Usage
impl AddAssign for Usage
Source§fn add_assign(&mut self, rhs: Usage)
fn add_assign(&mut self, rhs: Usage)
Accumulate another turn’s usage field-wise (the engine sums across turns).
impl Copy for Usage
Source§impl<'de> Deserialize<'de> for Usage
impl<'de> Deserialize<'de> for Usage
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Usage, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Usage, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Usage
Source§impl Serialize for Usage
impl Serialize for Usage
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for Usage
Auto Trait Implementations§
impl Freeze for Usage
impl RefUnwindSafe for Usage
impl Send for Usage
impl Sync for Usage
impl Unpin for Usage
impl UnsafeUnpin for Usage
impl UnwindSafe for Usage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.