Skip to content

Commit 8852b4b

Browse files
fix(antigravity): map model ID 1402 to claude-opus-5-5
Antigravity reports Claude Opus 5.5 as model ID 1402. It was not in the ID table, so it fell back to `model_placeholder_m402`, which has no pricing entry and was reported at $0 with a missing-pricing warning. Map both the numeric ID and the placeholder to `claude-opus-5-5`, which the embedded pricing catalog already prices, and cover the mapping plus a non-zero calculated cost in a parser test. Fixes #1947 Co-authored-by: viniciusdsandrade <[email protected]>
1 parent 06a3343 commit 8852b4b

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

‎rust/adapters/antigravity/src/parser.rs‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,7 @@ fn model_name_from_id(model_id: u64) -> String {
867867
1072 => "gemini-3.6-flash-medium".to_string(),
868868
1073 => "gemini-3.6-flash-low".to_string(),
869869
1417..=1419 => "gemini-4-argon".to_string(),
870+
1402 => "claude-opus-5-5".to_string(),
870871
1050 => "gemini-3.1-flash-lite".to_string(),
871872
1_000.. => format!("model_placeholder_m{}", model_id - 1_000),
872873
_ => format!("antigravity-model-{model_id}"),
@@ -922,6 +923,7 @@ fn normalize_antigravity_model(raw: &str) -> Option<String> {
922923
"model_placeholder_m417" | "model_placeholder_m418" | "model_placeholder_m419" => {
923924
"gemini-4-argon"
924925
}
926+
"model_placeholder_m402" => "claude-opus-5-5",
925927
"model_placeholder_m50" => "gemini-3.1-flash-lite",
926928
"model_placeholder_m26" => "claude-opus-4-6",
927929
"model_placeholder_m35" => "claude-sonnet-4-6",
@@ -1593,6 +1595,41 @@ mod tests {
15931595
);
15941596
}
15951597

1598+
#[test]
1599+
fn maps_claude_opus_5_5_id_and_placeholder_to_priced_model() {
1600+
assert_eq!(model_name_from_id(1402), "claude-opus-5-5");
1601+
assert_eq!(
1602+
normalize_antigravity_model("model_placeholder_m402").as_deref(),
1603+
Some("claude-opus-5-5")
1604+
);
1605+
1606+
let pricing = PricingMap::load_embedded();
1607+
let usage = TokenUsageRaw {
1608+
input_tokens: 1_000_000,
1609+
output_tokens: 1_000_000,
1610+
..TokenUsageRaw::default()
1611+
};
1612+
let cost = calculate_antigravity_cost(
1613+
&model_name_from_id(1402),
1614+
None,
1615+
usage,
1616+
TimestampMs::UNIX_EPOCH,
1617+
CostMode::Calculate,
1618+
&pricing,
1619+
);
1620+
assert!(cost > 0.0);
1621+
assert!(
1622+
missing_antigravity_pricing(
1623+
"claude-opus-5-5",
1624+
None,
1625+
usage,
1626+
CostMode::Calculate,
1627+
&pricing,
1628+
)
1629+
.is_none()
1630+
);
1631+
}
1632+
15961633
#[test]
15971634
fn newer_gemini_effort_variants_fall_back_to_base_pricing() {
15981635
assert_eq!(

0 commit comments

Comments
 (0)