pub struct Usage {
pub input_tokens: u32,
pub output_tokens: u32,
pub cached_input_tokens: u32,
pub cache_creation_input_tokens: u32,
pub served_speed: Option<ServedSpeed>,
}Fields§
§input_tokens: u32Total input tokens reported by the provider.
output_tokens: u32§cached_input_tokens: u32Portion of input_tokens billed at a cached-input rate, when reported.
cache_creation_input_tokens: u32Portion of input_tokens spent creating provider-side prompt cache entries.
served_speed: Option<ServedSpeed>Which speed tier actually served the request, when the provider says.
Requesting a premium tier does not guarantee getting one: Anthropic
serves claude-opus-4-6 at standard speed without erroring, and
OpenAI downgrades priority requests under a sharp traffic ramp. Both
bill the tier they actually ran, so this is the field that says whether
the premium request was honoured.
None when the provider reported no tier — which is the normal case for
every provider and model that has no premium tier to begin with.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Usage
impl<'de> Deserialize<'de> for Usage
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Usage, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Usage, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Usage
impl Serialize for Usage
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
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