Skip to content

Commit 951482f

Browse files
authored
Add Claude Opus 4.8 pricing (#161)
1 parent 44dbd9c commit 951482f

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

src/models.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,18 @@ fn populate_defaults(
630630
);
631631

632632
// Anthropic Models
633+
add_model!(
634+
"claude-opus-4-8",
635+
PricingStructure::Flat {
636+
input_per_1m: 5.0,
637+
output_per_1m: 25.0
638+
},
639+
CachingSupport::Anthropic {
640+
cache_write_per_1m: 6.25,
641+
cache_read_per_1m: 0.5
642+
},
643+
false
644+
);
633645
add_model!(
634646
"claude-opus-4-7",
635647
PricingStructure::Flat {
@@ -1391,6 +1403,9 @@ fn populate_defaults(
13911403
add_alias!("gpt-5.5-pro", "gpt-5.5-pro");
13921404

13931405
// Anthropic aliases
1406+
add_alias!("claude-opus-4.8", "claude-opus-4-8");
1407+
add_alias!("claude-4.8-opus", "claude-opus-4-8");
1408+
add_alias!("claude-opus-4-8", "claude-opus-4-8");
13941409
add_alias!("claude-opus-4.7", "claude-opus-4-7");
13951410
add_alias!("claude-opus-4.6", "claude-opus-4-6");
13961411
add_alias!("claude-4.6-opus", "claude-opus-4-6");
@@ -2010,6 +2025,20 @@ mod tests {
20102025
reset_global_registry();
20112026
}
20122027

2028+
#[test]
2029+
fn claude_opus_4_8_alias_maps_to_pricing() {
2030+
let model_info = get_model_info("claude-4.8-opus").expect("model should exist");
2031+
assert!(!model_info.is_estimated);
2032+
2033+
let input_cost = calculate_input_cost("claude-4.8-opus", 1_000_000);
2034+
let output_cost = calculate_output_cost("claude-4.8-opus", 1_000_000);
2035+
let cache_cost = calculate_cache_cost("claude-4.8-opus", 1_000_000, 1_000_000);
2036+
2037+
approx_eq(input_cost, 5.0);
2038+
approx_eq(output_cost, 25.0);
2039+
approx_eq(cache_cost, 6.75);
2040+
}
2041+
20132042
#[test]
20142043
fn gemini_3_1_pro_preview_uses_bracket_pricing_for_input() {
20152044
let cost = calculate_input_cost("gemini-3.1-pro-preview", 250_000);

0 commit comments

Comments
 (0)