pub struct Usage {
pub input_tokens: u32,
pub output_tokens: u32,
pub cache_creation_input_tokens: Option<u32>,
pub cache_read_input_tokens: Option<u32>,
pub server_tool_use: Option<ServerToolUsage>,
pub service_tier: Option<String>,
}
Expand description
Usage information for API requests
Fields§
§input_tokens: u32
The number of input tokens which were used
output_tokens: u32
The number of output tokens which were used
cache_creation_input_tokens: Option<u32>
The number of input tokens used to create the cache entry
cache_read_input_tokens: Option<u32>
The number of input tokens read from the cache
server_tool_use: Option<ServerToolUsage>
Server tool usage statistics
service_tier: Option<String>
Service tier used for the request
Implementations§
Source§impl Usage
impl Usage
Sourcepub fn total_tokens(&self) -> u32
pub fn total_tokens(&self) -> u32
Get the total number of tokens used
Sourcepub fn total_input_tokens(&self) -> u32
pub fn total_input_tokens(&self) -> u32
Get the total input tokens including cache tokens
Trait Implementations§
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 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 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