pub struct ModelPricing {
pub input_per_1m: f64,
pub output_per_1m: f64,
pub cache_read_per_1m: f64,
pub cache_write_per_1m: f64,
}Expand description
Per-million-token rates for a single model, in USD.
Separates uncached input, output, prompt-cache reads and prompt-cache writes, which providers bill at different rates.
§Examples
use ironflow_core::pricing::ModelPricing;
let p = ModelPricing::without_cache(3.0, 15.0);
assert_eq!(p.cache_read_per_1m, 3.0);
assert_eq!(p.cache_write_per_1m, 3.0);Fields§
§input_per_1m: f64Price per million uncached input tokens.
output_per_1m: f64Price per million output tokens.
cache_read_per_1m: f64Price per million input tokens served from the prompt cache.
cache_write_per_1m: f64Price per million input tokens written to the prompt cache.
Implementations§
Source§impl ModelPricing
impl ModelPricing
Sourcepub fn without_cache(input_per_1m: f64, output_per_1m: f64) -> Self
pub fn without_cache(input_per_1m: f64, output_per_1m: f64) -> Self
Build pricing for a model without a known cache rate.
Both cache rates are set equal to input_per_1m, so costs are never
underestimated.
§Examples
use ironflow_core::pricing::ModelPricing;
let p = ModelPricing::without_cache(0.5, 1.5);
assert_eq!(p.input_per_1m, 0.5);
assert_eq!(p.output_per_1m, 1.5);
assert_eq!(p.cache_read_per_1m, 0.5);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 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