pub struct CostCalculator;Expand description
Cost calculator for token usage
Implementations§
Source§impl CostCalculator
impl CostCalculator
Sourcepub fn calculate_cost(usage: &TokenUsage, pricing: &ModelPricing) -> f64
pub fn calculate_cost(usage: &TokenUsage, pricing: &ModelPricing) -> f64
Calculate cost for a given token usage and pricing
Sourcepub fn calculate_cost_default(usage: &TokenUsage) -> f64
pub fn calculate_cost_default(usage: &TokenUsage) -> f64
Calculate cost using default pricing
Sourcepub fn pricing_for_model(model: &str) -> ModelPricing
pub fn pricing_for_model(model: &str) -> ModelPricing
Get pricing for a model by name
Auto Trait Implementations§
impl Freeze for CostCalculator
impl RefUnwindSafe for CostCalculator
impl Send for CostCalculator
impl Sync for CostCalculator
impl Unpin for CostCalculator
impl UnsafeUnpin for CostCalculator
impl UnwindSafe for CostCalculator
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