pub struct ModelPricing {
pub input_price_per_million: f64,
pub output_price_per_million: f64,
pub cache_read_multiplier: f64,
pub cache_write_multiplier: f64,
}Expand description
Pricing structure for a Claude model
All prices are per million tokens (M). Cache multipliers are applied to input price.
Fields§
§input_price_per_million: f64Price per million input tokens ($/M)
output_price_per_million: f64Price per million output tokens ($/M)
cache_read_multiplier: f64Cache read multiplier (0.1 = 10% of input price)
cache_write_multiplier: f64Cache write multiplier (0.25 = 25% of input price)
Implementations§
Source§impl ModelPricing
impl ModelPricing
Sourcepub fn default_average() -> Self
pub fn default_average() -> Self
Default average pricing for unknown models
Uses a weighted average across common models (sonnet-4 weight: 70%, opus-4: 20%, haiku-4: 10%) to provide reasonable estimates when model is unknown or unrecognized.
Trait Implementations§
Source§impl Clone for ModelPricing
impl Clone for ModelPricing
Source§fn clone(&self) -> ModelPricing
fn clone(&self) -> ModelPricing
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ModelPricing
impl RefUnwindSafe for ModelPricing
impl Send for ModelPricing
impl Sync for ModelPricing
impl Unpin 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