#[non_exhaustive]pub struct ModelUsage {
pub input_tokens: usize,
pub output_tokens: usize,
pub cache_read_tokens: Option<usize>,
pub cache_write_tokens: Option<usize>,
pub reasoning_tokens: Option<usize>,
}Expand description
Provider-reported token accounting for one model response.
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: usizeTokens counted on the prompt side of the exchange.
output_tokens: usizeTokens counted on the generated side of the exchange.
cache_read_tokens: Option<usize>Provider-reported prompt-cache read (hit) tokens, if disclosed.
cache_write_tokens: Option<usize>Provider-reported prompt-cache write (population) tokens, if disclosed.
reasoning_tokens: Option<usize>Provider-reported reasoning/thinking tokens, if disclosed.
Implementations§
Trait Implementations§
Source§impl Clone for ModelUsage
impl Clone for ModelUsage
Source§impl Debug for ModelUsage
impl Debug for ModelUsage
Source§impl Default for ModelUsage
impl Default for ModelUsage
Source§impl<'de> Deserialize<'de> for ModelUsage
impl<'de> Deserialize<'de> for ModelUsage
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
Auto Trait Implementations§
impl Freeze for ModelUsage
impl RefUnwindSafe for ModelUsage
impl Send for ModelUsage
impl Sync for ModelUsage
impl Unpin for ModelUsage
impl UnsafeUnpin for ModelUsage
impl UnwindSafe for ModelUsage
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