pub struct Usage {
pub input: u64,
pub output: u64,
pub cache_read: u64,
pub cache_write: u64,
pub reasoning: Option<u64>,
pub total_tokens: Option<u64>,
pub cost: Cost,
pub cache_write_1h: Option<u64>,
}Expand description
Token usage and cost of one request.
Fields§
§input: u64§output: u64§cache_read: u64§cache_write: u64§reasoning: Option<u64>Reasoning tokens, already included in output.
total_tokens: Option<u64>Absent in sessions written by early pi versions.
cost: Cost§cache_write_1h: Option<u64>Part of cacheWrite with one-hour retention; Anthropic only.
Implementations§
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 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