(model: &str)
| 53 | |
| 54 | #[must_use] |
| 55 | pub fn pricing_for_model(model: &str) -> Option<ModelPricing> { |
| 56 | let normalized = model.to_ascii_lowercase(); |
| 57 | if normalized.contains("haiku") { |
| 58 | return Some(ModelPricing { |
| 59 | input_cost_per_million: 1.0, |
| 60 | output_cost_per_million: 5.0, |
| 61 | cache_creation_cost_per_million: 1.25, |
| 62 | cache_read_cost_per_million: 0.1, |
| 63 | }); |
| 64 | } |
| 65 | if normalized.contains("opus") { |
| 66 | return Some(ModelPricing { |
| 67 | input_cost_per_million: 15.0, |
| 68 | output_cost_per_million: 75.0, |
| 69 | cache_creation_cost_per_million: 18.75, |
| 70 | cache_read_cost_per_million: 1.5, |
| 71 | }); |
| 72 | } |
| 73 | if normalized.contains("sonnet") { |
| 74 | return Some(ModelPricing::default_sonnet_tier()); |
| 75 | } |
| 76 | None |
| 77 | } |
| 78 | |
| 79 | impl TokenUsage { |
| 80 | #[must_use] |
no outgoing calls