pub struct ModelPricing {
pub input_per_million: f64,
pub output_per_million: f64,
pub cache_hit_input_per_million: f64,
}Expand description
Per-million-token pricing for one model. USD.
Fields§
§input_per_million: f64§output_per_million: f64§cache_hit_input_per_million: f64Price per million tokens for cache-hit prompts. Defaults to 10% of input rate (DeepSeek’s known discount).
Implementations§
Source§impl ModelPricing
impl ModelPricing
Sourcepub fn cost_usd(&self, usage: TokenUsage) -> f64
pub fn cost_usd(&self, usage: TokenUsage) -> f64
USD cost for the given usage at this pricing.
Trait Implementations§
Source§impl Clone for ModelPricing
impl Clone for ModelPricing
impl Copy for ModelPricing
Source§impl Debug for ModelPricing
impl Debug for ModelPricing
Source§impl From<ModelPricing> for CostPricing
impl From<ModelPricing> for CostPricing
Source§fn from(p: ModelPricing) -> Self
fn from(p: ModelPricing) -> Self
Converts to this type from the input type.
Source§impl PartialEq for ModelPricing
impl PartialEq for ModelPricing
impl StructuralPartialEq for ModelPricing
Auto Trait Implementations§
impl Freeze for ModelPricing
impl RefUnwindSafe for ModelPricing
impl Send for ModelPricing
impl Sync for ModelPricing
impl Unpin for ModelPricing
impl UnsafeUnpin for ModelPricing
impl UnwindSafe for ModelPricing
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<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> IntoMaybeUndefined<T> for T
impl<T> IntoMaybeUndefined<T> for T
Source§fn into_maybe_undefined(self) -> MaybeUndefined<T>
fn into_maybe_undefined(self) -> MaybeUndefined<T>
Converts this value into a three-state builder argument.
Source§impl<T> IntoOption<T> for T
impl<T> IntoOption<T> for T
Source§fn into_option(self) -> Option<T>
fn into_option(self) -> Option<T>
Converts this value into an optional builder argument.