pub struct UsageMeta {
pub input_tokens: u32,
pub output_tokens: u32,
pub cache_creation_tokens: Option<u32>,
pub cache_read_tokens: Option<u32>,
pub reasoning_tokens: Option<u32>,
}Expand description
Token usage for one or more LLM API calls, as reported by the provider.
Used both per-message (TranscriptEntry.usage) and as a cumulative
session total stored in SessionMeta.cost (g156).
Fields§
§input_tokens: u32§output_tokens: u32§cache_creation_tokens: Option<u32>Prompt-cache creation tokens (Anthropic / OpenAI).
cache_read_tokens: Option<u32>Prompt-cache read tokens (Anthropic / OpenAI).
reasoning_tokens: Option<u32>Reasoning/thinking tokens (DeepSeek R1, o1, etc.).
Implementations§
Source§impl UsageMeta
impl UsageMeta
Sourcepub fn accumulate(&mut self, other: &UsageMeta)
pub fn accumulate(&mut self, other: &UsageMeta)
Accumulate another UsageMeta into self.
Sourcepub fn from_token_usage(tu: &TokenUsage) -> Self
pub fn from_token_usage(tu: &TokenUsage) -> Self
Convert from crate::llm::TokenUsage (g156 integration point).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for UsageMeta
impl<'de> Deserialize<'de> for UsageMeta
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 UsageMeta
Auto Trait Implementations§
impl Freeze for UsageMeta
impl RefUnwindSafe for UsageMeta
impl Send for UsageMeta
impl Sync for UsageMeta
impl Unpin for UsageMeta
impl UnsafeUnpin for UsageMeta
impl UnwindSafe for UsageMeta
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
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>
Converts
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>
Converts
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