pub struct PricingInfo {
pub input_cost_per_1k: f64,
pub output_cost_per_1k: f64,
pub currency: String,
}
Expand description
Pricing information for models
Fields§
§input_cost_per_1k: f64
Cost per input token (in USD)
output_cost_per_1k: f64
Cost per output token (in USD)
currency: String
Currency (default: USD)
Implementations§
Source§impl PricingInfo
impl PricingInfo
Sourcepub fn new(input_cost_per_1k: f64, output_cost_per_1k: f64) -> Self
pub fn new(input_cost_per_1k: f64, output_cost_per_1k: f64) -> Self
Create new pricing information
Sourcepub fn with_currency(self, currency: &str) -> Self
pub fn with_currency(self, currency: &str) -> Self
Set custom currency
Sourcepub fn calculate_cost(&self, input_tokens: u32, output_tokens: u32) -> f64
pub fn calculate_cost(&self, input_tokens: u32, output_tokens: u32) -> f64
Calculate cost for a given number of tokens
Trait Implementations§
Source§impl Clone for PricingInfo
impl Clone for PricingInfo
Source§fn clone(&self) -> PricingInfo
fn clone(&self) -> PricingInfo
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 moreSource§impl Debug for PricingInfo
impl Debug for PricingInfo
Source§impl<'de> Deserialize<'de> for PricingInfo
impl<'de> Deserialize<'de> for PricingInfo
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 PricingInfo
impl RefUnwindSafe for PricingInfo
impl Send for PricingInfo
impl Sync for PricingInfo
impl Unpin for PricingInfo
impl UnwindSafe for PricingInfo
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