pub struct ModelPrice {
pub input_per_1m: f64,
pub output_per_1m: f64,
pub cached_per_1m: f64,
pub reasoning_per_1m: f64,
}Expand description
One model’s price, in USD per 1,000,000 tokens (input and output billed separately, matching
provider pricing). Compiled to integer micro-dollars at load (see crate::llm).
cached_per_1m prices the cached-prompt subset (prompt_tokens_details.cached_tokens, usually a
steep discount) and reasoning_per_1m the reasoning subset (completion_tokens_details. reasoning_tokens). Both default to 0.0, which means inherit the base input/output rate —
so an existing book prices exactly as before; set them only to apply a provider’s separate
cached/reasoning rate.
Fields§
§input_per_1m: f64§output_per_1m: f64§cached_per_1m: f64USD per 1M cached prompt tokens. 0.0 = inherit input_per_1m.
reasoning_per_1m: f64USD per 1M reasoning tokens. 0.0 = inherit output_per_1m.
Trait Implementations§
Source§impl Clone for ModelPrice
impl Clone for ModelPrice
Source§fn clone(&self) -> ModelPrice
fn clone(&self) -> ModelPrice
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for ModelPrice
Source§impl Debug for ModelPrice
impl Debug for ModelPrice
Source§impl Default for ModelPrice
impl Default for ModelPrice
Source§fn default() -> ModelPrice
fn default() -> ModelPrice
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ModelPricewhere
ModelPrice: Default,
impl<'de> Deserialize<'de> for ModelPricewhere
ModelPrice: Default,
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
Auto Trait Implementations§
impl Freeze for ModelPrice
impl RefUnwindSafe for ModelPrice
impl Send for ModelPrice
impl Sync for ModelPrice
impl Unpin for ModelPrice
impl UnsafeUnpin for ModelPrice
impl UnwindSafe for ModelPrice
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