#[non_exhaustive]pub struct Pricing {
pub input: f64,
pub output: f64,
pub cache_read: Option<f64>,
pub cache_write: Option<f64>,
}Expand description
Prices in USD per million tokens.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.input: f64Uncached input.
output: f64Output, reasoning included.
cache_read: Option<f64>Input read from the cache, or None when unknown.
cache_write: Option<f64>Input written to the cache, or None when unknown.
Implementations§
Source§impl Pricing
impl Pricing
Sourcepub fn new(input: f64, output: f64) -> Self
pub fn new(input: f64, output: f64) -> Self
Prices for uncached input and for output, with no cache prices.
Sourcepub fn with_cache_read(self, price: f64) -> Self
pub fn with_cache_read(self, price: f64) -> Self
These prices with price for input read from the cache.
Sourcepub fn with_cache_write(self, price: f64) -> Self
pub fn with_cache_write(self, price: f64) -> Self
These prices with price for input written to the cache.
Sourcepub fn cost(&self, usage: &Usage) -> Option<Cost>
pub fn cost(&self, usage: &Usage) -> Option<Cost>
What usage costs at these prices, or None unless it reports both
its input and output tokens. Uncached input is the input tokens less
those read from and written to the cache. A cache part with tokens
but no listed price is None, and the cost is then not
complete: its total leaves that part out. Every
cache write is charged at one price, so a provider that bills longer
retention higher costs more than this says. It is the standard-tier
list price of the tokens: the service tier, long-context price tiers
and hosted-tool fees (web search, code execution) are not in it.
Trait Implementations§
impl Copy for Pricing
Source§impl<'de> Deserialize<'de> for Pricing
impl<'de> Deserialize<'de> for Pricing
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 StructuralPartialEq for Pricing
Auto Trait Implementations§
impl Freeze for Pricing
impl RefUnwindSafe for Pricing
impl Send for Pricing
impl Sync for Pricing
impl Unpin for Pricing
impl UnsafeUnpin for Pricing
impl UnwindSafe for Pricing
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> 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