Estimate the cost of this response (if cost per token is known)
(&self, input_cost_per_token: f64, output_cost_per_token: f64)
| 84 | |
| 85 | /// Estimate the cost of this response (if cost per token is known) |
| 86 | pub fn estimate_cost(&self, input_cost_per_token: f64, output_cost_per_token: f64) -> f64 { |
| 87 | (self.usage.prompt_tokens as f64 * input_cost_per_token) |
| 88 | + (self.usage.completion_tokens as f64 * output_cost_per_token) |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | /// Token usage statistics |
no outgoing calls