pub struct ModelPricing {
pub model: String,
pub input_cost_per_token: Option<f64>,
pub output_cost_per_token: Option<f64>,
pub cache_read_input_token_cost: Option<f64>,
pub cache_creation_input_token_cost: Option<f64>,
pub max_tokens: Option<u64>,
pub max_input_tokens: Option<u64>,
pub max_output_tokens: Option<u64>,
}Expand description
Model pricing information
Fields§
§model: String§input_cost_per_token: Option<f64>§output_cost_per_token: Option<f64>§cache_read_input_token_cost: Option<f64>§cache_creation_input_token_cost: Option<f64>§max_tokens: Option<u64>§max_input_tokens: Option<u64>§max_output_tokens: Option<u64>Implementations§
Source§impl ModelPricing
impl ModelPricing
Sourcepub fn calculate_cost(
&self,
input_tokens: u64,
output_tokens: u64,
cached_tokens: u64,
cache_creation_tokens: u64,
) -> TokenCostCalculated
pub fn calculate_cost( &self, input_tokens: u64, output_tokens: u64, cached_tokens: u64, cache_creation_tokens: u64, ) -> TokenCostCalculated
Calculate cost for given token usage
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 moreSource§impl Debug for ModelPricing
impl Debug for ModelPricing
Source§impl<'de> Deserialize<'de> for ModelPricing
impl<'de> Deserialize<'de> for ModelPricing
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 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