#[non_exhaustive]pub struct Usage {
pub input_tokens: u32,
pub output_tokens: u32,
pub total_tokens: u32,
pub cache_read_tokens: u32,
pub cache_creation_tokens: u32,
pub reasoning_tokens: u32,
pub api_duration_ms: u64,
pub prompt_details: PromptTokensDetails,
pub completion_details: CompletionTokensDetails,
}Expand description
Aggregated token usage for a sample or turn.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.input_tokens: u32Input / prompt tokens.
output_tokens: u32Output / completion tokens.
total_tokens: u32Total tokens when provided by the provider.
cache_read_tokens: u32Cache-read tokens (provider-specific; ledger convenience field).
cache_creation_tokens: u32Cache-creation / write tokens.
reasoning_tokens: u32Reasoning tokens (top-level mirror of completion details when set).
api_duration_ms: u64Provider API wall time for this sample, when known (milliseconds).
prompt_details: PromptTokensDetailsPrompt details.
completion_details: CompletionTokensDetailsCompletion details.
Implementations§
Trait Implementations§
Source§impl AddAssign for Usage
impl AddAssign for Usage
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+= operation. Read moreimpl Copy for Usage
Source§impl<'de> Deserialize<'de> for Usage
impl<'de> Deserialize<'de> for Usage
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Usage
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