#[non_exhaustive]pub struct Usage {
pub input_tokens: Option<u64>,
pub output_tokens: Option<u64>,
pub cache_read_tokens: Option<u64>,
pub cache_write_tokens: Option<u64>,
pub cost_usd: Option<f64>,
pub premium_requests: Option<u64>,
}Expand description
Token and cost accounting for a run.
Every field is optional because the three agents report different subsets: Claude reports full token counts and a dollar cost, Codex reports tokens, Copilot reports premium requests and no tokens at all. An absent field means “this agent did not say”, never zero.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.input_tokens: Option<u64>Non-cached input tokens.
output_tokens: Option<u64>Generated tokens.
cache_read_tokens: Option<u64>Input tokens served from the prompt cache.
cache_write_tokens: Option<u64>Input tokens written into the prompt cache.
cost_usd: Option<f64>Cost in USD, when the agent priced the run itself. Never inferred from a local price table, because a guessed cost is worse than no cost.
Copilot’s premium-request count, its only usage unit.
Implementations§
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 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