pub struct UsageDetails {
pub input_token_count: Option<u64>,
pub output_token_count: Option<u64>,
pub total_token_count: Option<u64>,
pub cache_creation_input_token_count: Option<u64>,
pub cache_read_input_token_count: Option<u64>,
pub reasoning_output_token_count: Option<u64>,
pub additional_counts: HashMap<String, u64>,
}Expand description
Token usage counts for a request/response.
Supports element-wise addition to accumulate usage across streamed updates.
Fields§
§input_token_count: Option<u64>§output_token_count: Option<u64>§total_token_count: Option<u64>§cache_creation_input_token_count: Option<u64>The number of input tokens written to a provider-managed cache.
cache_read_input_token_count: Option<u64>The number of input tokens served from a provider-managed cache.
reasoning_output_token_count: Option<u64>The number of output tokens used for reasoning.
additional_counts: HashMap<String, u64>Additional, provider-specific counts merged into the root on serialize.
Implementations§
Source§impl UsageDetails
impl UsageDetails
pub fn new() -> UsageDetails
Sourcepub fn add_assign(&mut self, other: &UsageDetails)
pub fn add_assign(&mut self, other: &UsageDetails)
Element-wise add another usage into this one, treating None as 0
only when the other side has a value.
Trait Implementations§
Source§impl Add for UsageDetails
impl Add for UsageDetails
Source§type Output = UsageDetails
type Output = UsageDetails
The resulting type after applying the
+ operator.Source§fn add(self, rhs: UsageDetails) -> <UsageDetails as Add>::Output
fn add(self, rhs: UsageDetails) -> <UsageDetails as Add>::Output
Performs the
+ operation. Read moreSource§impl Clone for UsageDetails
impl Clone for UsageDetails
Source§fn clone(&self) -> UsageDetails
fn clone(&self) -> UsageDetails
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for UsageDetails
impl Debug for UsageDetails
Source§impl Default for UsageDetails
impl Default for UsageDetails
Source§fn default() -> UsageDetails
fn default() -> UsageDetails
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for UsageDetails
impl<'de> Deserialize<'de> for UsageDetails
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<UsageDetails, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<UsageDetails, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for UsageDetails
Source§impl PartialEq for UsageDetails
impl PartialEq for UsageDetails
Source§impl Serialize for UsageDetails
impl Serialize for UsageDetails
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 UsageDetails
Auto Trait Implementations§
impl Freeze for UsageDetails
impl RefUnwindSafe for UsageDetails
impl Send for UsageDetails
impl Sync for UsageDetails
impl Unpin for UsageDetails
impl UnsafeUnpin for UsageDetails
impl UnwindSafe for UsageDetails
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