pub struct ApproxCost {
pub usd: f64,
pub may_overstate: bool,
pub may_understate: bool,
}Expand description
A cost figure plus which way it can be wrong.
Presenting an estimate as an exact price is the same failure as billing an unrated bucket at zero, one step later — so the direction travels with the number instead of being re-derived (or forgotten) at each display site.
Fields§
§usd: f64USD.
may_overstate: boolThe true cost may be lower — a bucket was priced at a substitute rate that can only be too high (a cache read at the uncached-input rate), or a pricing tier is cheaper than the base sheet used.
may_understate: boolThe true cost may be higher — a pricing tier dearer than the base sheet could not be resolved from the tokens the caller had, or a cache write was priced at the uncached-input rate and the provider charges a surcharge for it (Anthropic 1.25x, OpenRouter’s 1h TTL 2x).
Implementations§
Source§impl ApproxCost
impl ApproxCost
Trait Implementations§
Source§impl Clone for ApproxCost
impl Clone for ApproxCost
impl Copy for ApproxCost
Source§impl Debug for ApproxCost
impl Debug for ApproxCost
Source§impl PartialEq for ApproxCost
impl PartialEq for ApproxCost
impl StructuralPartialEq for ApproxCost
Auto Trait Implementations§
impl Freeze for ApproxCost
impl RefUnwindSafe for ApproxCost
impl Send for ApproxCost
impl Sync for ApproxCost
impl Unpin for ApproxCost
impl UnsafeUnpin for ApproxCost
impl UnwindSafe for ApproxCost
Blanket Implementations§
impl<T> Boilerplate for T
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
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> ErasedDestructor for Twhere
T: 'static,
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