pub struct CostEstimation {
pub model_id: String,
pub input_tokens: u64,
pub output_tokens: u64,
pub input_cost_usd: f64,
pub output_cost_usd: f64,
pub total_cost_usd: f64,
pub batch_discount_usd: Option<f64>,
pub cache_savings_usd: Option<f64>,
pub final_cost_usd: f64,
pub breakdown: CostBreakdown,
}
Expand description
Cost estimation result
Fields§
§model_id: String
Model ID
input_tokens: u64
Input tokens
output_tokens: u64
Output tokens
input_cost_usd: f64
Input cost in USD
output_cost_usd: f64
Output cost in USD
total_cost_usd: f64
Total cost in USD
batch_discount_usd: Option<f64>
Batch discount (if applicable)
cache_savings_usd: Option<f64>
Cache savings (if applicable)
final_cost_usd: f64
Final cost after discounts
breakdown: CostBreakdown
Cost breakdown
Implementations§
Source§impl CostEstimation
impl CostEstimation
Sourcepub fn cost_per_1k_tokens(&self) -> f64
pub fn cost_per_1k_tokens(&self) -> f64
Calculate cost per 1000 tokens
Sourcepub fn savings_percentage(&self) -> f64
pub fn savings_percentage(&self) -> f64
Get savings percentage from discounts
Trait Implementations§
Source§impl Clone for CostEstimation
impl Clone for CostEstimation
Source§fn clone(&self) -> CostEstimation
fn clone(&self) -> CostEstimation
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 CostEstimation
impl Debug for CostEstimation
Source§impl<'de> Deserialize<'de> for CostEstimation
impl<'de> Deserialize<'de> for CostEstimation
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 CostEstimation
impl RefUnwindSafe for CostEstimation
impl Send for CostEstimation
impl Sync for CostEstimation
impl Unpin for CostEstimation
impl UnwindSafe for CostEstimation
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