pub struct Usage {
pub input_tokens: u32,
pub output_tokens: u32,
pub prompt_cache_hit_tokens: Option<u32>,
pub prompt_cache_miss_tokens: Option<u32>,
pub reasoning_tokens: Option<u32>,
pub reasoning_replay_tokens: Option<u32>,
pub server_tool_use: Option<ServerToolUsage>,
}Expand description
Token usage metadata for a response.
Fields§
§input_tokens: u32§output_tokens: u32§prompt_cache_hit_tokens: Option<u32>§prompt_cache_miss_tokens: Option<u32>§reasoning_tokens: Option<u32>§reasoning_replay_tokens: Option<u32>Approximate input tokens spent re-sending prior reasoning_content
across user-message boundaries (V4 §5.1.1 “Interleaved Thinking”).
server_tool_use: Option<ServerToolUsage>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 Eq for Usage
Source§impl JsonSchema for Usage
impl JsonSchema for Usage
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreimpl 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