pub struct ModelUsage {
pub requests: u64,
pub input_tokens: u64,
pub output_tokens: u64,
pub cache_read_tokens: u64,
pub cache_write_tokens: u64,
pub reasoning_tokens: u64,
pub counterfactual_requests: u64,
pub counterfactual_input_tokens: u64,
pub counterfactual_billed_tokens: u64,
pub measured: MeasuredSlice,
}Expand description
Cumulative real token counts for one model. Cost is derived at read time so a pricing-table change re-values historical usage consistently.
Fields§
§requests: u64§input_tokens: u64§output_tokens: u64§cache_read_tokens: u64§cache_write_tokens: u64§reasoning_tokens: u64§counterfactual_requests: u64Requests whose free count_tokens probe answered (#701) — the rows the
verified-savings pair below covers. serde(default) keeps pre-#701
usage files loadable.
counterfactual_input_tokens: u64Provider-counted input tokens the covered requests would have billed WITHOUT lean-ctx (sum of probe answers on the original bodies).
counterfactual_billed_tokens: u64Input-side tokens those same requests actually billed (input + cache read + cache write) — same request, same moment, no confound.
measured: MeasuredSliceThe turns whose response carried the provider’s own USD charge
(OpenRouter usage accounting, #1179). Their tokens are inside the
totals above; pricing subtracts this slice and books its measured USD
instead of a table estimate. serde(default) keeps older files loadable.
Trait Implementations§
Source§impl Clone for ModelUsage
impl Clone for ModelUsage
Source§fn clone(&self) -> ModelUsage
fn clone(&self) -> ModelUsage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ModelUsage
impl Debug for ModelUsage
Source§impl Default for ModelUsage
impl Default for ModelUsage
Source§fn default() -> ModelUsage
fn default() -> ModelUsage
Source§impl<'de> Deserialize<'de> for ModelUsage
impl<'de> Deserialize<'de> for ModelUsage
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>,
Source§impl PartialEq for ModelUsage
impl PartialEq for ModelUsage
Source§fn eq(&self, other: &ModelUsage) -> bool
fn eq(&self, other: &ModelUsage) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for ModelUsage
impl Serialize for ModelUsage
impl StructuralPartialEq for ModelUsage
Auto Trait Implementations§
impl Freeze for ModelUsage
impl RefUnwindSafe for ModelUsage
impl Send for ModelUsage
impl Sync for ModelUsage
impl Unpin for ModelUsage
impl UnsafeUnpin for ModelUsage
impl UnwindSafe for ModelUsage
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more