pub struct Usage {
pub input_tokens: u64,
pub output_tokens: u64,
pub cache_creation_input_tokens: u64,
pub cache_read_input_tokens: u64,
}Expand description
What one turn cost: what the model read, split by where it came from, and what it wrote.
Fields§
§input_tokens: u64§output_tokens: u64§cache_creation_input_tokens: u64§cache_read_input_tokens: u64Implementations§
Source§impl Usage
impl Usage
Sourcepub fn input(&self) -> u64
pub fn input(&self) -> u64
Everything the model was sent for this turn, which is the conversation as it stood. The transcript splits it by where it was served from (fresh, cached this turn, replayed from an earlier one), a billing distinction rather than anything about the conversation, so this recombines it.
Sourcepub fn uncached_input(&self) -> u64
pub fn uncached_input(&self) -> u64
The part of that input the model had not been sent before: what this turn added to the conversation, which is what the turn’s own output can be read against. The cache holds exactly the prefix already sent, so its boundary marks what is new, except where a lapsed cache re-sends a prefix and counts it new again.
Trait Implementations§
impl 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