File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -218,7 +218,7 @@ fn get_model_pricing(model: &str) -> ModelPricing {
218218
219219 // Fall back to default pricing (may be outdated - users can override via CORTEX_PRICING_*)
220220 // Pricing per 1M tokens (as of late 2024/early 2025 - may change)
221- match model {
221+ match model_lower . as_str ( ) {
222222 // Anthropic
223223 m if m. contains ( "claude-opus-4" ) || m. contains ( "opus-4" ) => ModelPricing {
224224 input_per_million : 15.0 ,
@@ -735,6 +735,14 @@ mod tests {
735735 assert ! ( ( cost - 12.5 ) . abs( ) < 0.001 ) ;
736736 }
737737
738+ #[ test]
739+ fn test_calculate_cost_is_case_insensitive_for_builtin_pricing ( ) {
740+ let lowercase_cost = calculate_cost ( "gpt-4o" , 1_000_000 , 1_000_000 ) ;
741+ let uppercase_cost = calculate_cost ( "GPT-4O" , 1_000_000 , 1_000_000 ) ;
742+
743+ assert ! ( ( uppercase_cost - lowercase_cost) . abs( ) < f64 :: EPSILON ) ;
744+ }
745+
738746 #[ test]
739747 fn test_validate_days_range ( ) {
740748 // Valid values
You can’t perform that action at this time.
0 commit comments