pub struct UsageMetrics {
pub input_tokens: i64,
pub output_tokens: i64,
pub reasoning_tokens: i64,
pub reasoning_output_tokens: i64,
pub total_tokens: i64,
pub cached_input_tokens: i64,
pub cache_read_input_tokens: i64,
pub cache_creation_input_tokens: i64,
pub cache_creation_5m_input_tokens: i64,
pub cache_creation_1h_input_tokens: i64,
}Fields§
§input_tokens: i64§output_tokens: i64§reasoning_tokens: i64§reasoning_output_tokens: i64§total_tokens: i64§cached_input_tokens: i64§cache_read_input_tokens: i64§cache_creation_input_tokens: i64§cache_creation_5m_input_tokens: i64§cache_creation_1h_input_tokens: i64Implementations§
Source§impl UsageMetrics
impl UsageMetrics
pub fn add_assign(&mut self, other: &UsageMetrics)
pub fn reasoning_output_tokens_total(&self) -> i64
pub fn cache_creation_tokens_total(&self) -> i64
pub fn has_cache_tokens(&self) -> bool
pub fn cache_read_tokens_total(&self) -> i64
pub fn cache_usage_breakdown( &self, accounting: CacheInputAccounting, ) -> CacheUsageBreakdown
pub fn cache_hit_rate_with_accounting( &self, accounting: CacheInputAccounting, ) -> Option<f64>
pub fn cache_hit_rate_for_service(&self, service: &str) -> Option<f64>
pub fn cache_hit_rate(&self) -> Option<f64>
pub fn effective_input_tokens_with_accounting( &self, accounting: CacheInputAccounting, ) -> i64
pub fn cache_denominator_tokens_with_accounting( &self, accounting: CacheInputAccounting, ) -> Option<i64>
Trait Implementations§
Source§impl Clone for UsageMetrics
impl Clone for UsageMetrics
Source§fn clone(&self) -> UsageMetrics
fn clone(&self) -> UsageMetrics
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 UsageMetrics
impl Debug for UsageMetrics
Source§impl Default for UsageMetrics
impl Default for UsageMetrics
Source§fn default() -> UsageMetrics
fn default() -> UsageMetrics
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for UsageMetrics
impl<'de> Deserialize<'de> for UsageMetrics
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
Source§impl PartialEq for UsageMetrics
impl PartialEq for UsageMetrics
Source§fn eq(&self, other: &UsageMetrics) -> bool
fn eq(&self, other: &UsageMetrics) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for UsageMetrics
impl Serialize for UsageMetrics
impl Eq for UsageMetrics
impl StructuralPartialEq for UsageMetrics
Auto Trait Implementations§
impl Freeze for UsageMetrics
impl RefUnwindSafe for UsageMetrics
impl Send for UsageMetrics
impl Sync for UsageMetrics
impl Unpin for UsageMetrics
impl UnsafeUnpin for UsageMetrics
impl UnwindSafe for UsageMetrics
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.