pub struct TurnUsage { /* private fields */ }Expand description
Exact token accounting for every Responses call in one logical agent turn.
Cache-read and cache-write tokens are subsets of input tokens. Reasoning
tokens are a subset of output tokens. The values are summed from provider
usage records across warmup, generation, tool continuation, steering, and
compaction calls made before the turn reaches its terminal boundary. Check
Self::cost_status to distinguish a provider-omitted usage record from a
genuine zero-token total.
Implementations§
Source§impl TurnUsage
impl TurnUsage
Sourcepub const fn input_tokens(&self) -> u64
pub const fn input_tokens(&self) -> u64
Returns all input tokens billed or reported by the provider.
Sourcepub const fn cached_input_tokens(&self) -> u64
pub const fn cached_input_tokens(&self) -> u64
Returns input tokens served from the provider’s prompt cache.
Sourcepub const fn cache_write_input_tokens(&self) -> u64
pub const fn cache_write_input_tokens(&self) -> u64
Returns input tokens newly written into the provider’s prompt cache.
Sourcepub const fn output_tokens(&self) -> u64
pub const fn output_tokens(&self) -> u64
Returns all output tokens billed or reported by the provider.
Sourcepub const fn reasoning_output_tokens(&self) -> u64
pub const fn reasoning_output_tokens(&self) -> u64
Returns reasoning tokens included within Self::output_tokens.
Sourcepub const fn total_tokens(&self) -> u64
pub const fn total_tokens(&self) -> u64
Returns the provider-reported total token count.
Sourcepub fn estimated_cost(&self) -> Option<&EstimatedUsdCost>
pub fn estimated_cost(&self) -> Option<&EstimatedUsdCost>
Returns the automatic local USD estimate.
Nanocodex applies the built-in standard or priority gpt-5.6-sol
rates. None means the provider omitted usage; absence is never
serialized as a misleading zero.
Sourcepub const fn cost_status(&self) -> CostStatus
pub const fn cost_status(&self) -> CostStatus
Returns why an estimate is present or unavailable.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TurnUsage
impl<'de> Deserialize<'de> for TurnUsage
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>,
impl Eq for TurnUsage
impl StructuralPartialEq for TurnUsage
Auto Trait Implementations§
impl Freeze for TurnUsage
impl RefUnwindSafe for TurnUsage
impl Send for TurnUsage
impl Sync for TurnUsage
impl Unpin for TurnUsage
impl UnsafeUnpin for TurnUsage
impl UnwindSafe for TurnUsage
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>,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.