Skip to content

Commit baeb991

Browse files
ryoppippicursoragentviniciusdsandrade
authored
fix(antigravity): map model ID 1402 to claude-opus-5-5 (ccusage#1948)
* 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 ccusage#1947 Co-authored-by: viniciusdsandrade <[email protected]> * test(antigravity): cover Claude Opus 5.5 through the loader The parser test called the mapping helpers directly, so it did not prove that real Antigravity rows load with the right model and cost. Extend the production report fixture with a row that only carries model ID 1402 and a row that stores `model_placeholder_m402`, and assert both load as `claude-opus-5-5` with a non-zero cost and no missing-pricing warning. The snapshot now includes them in the daily, weekly, monthly and session reports. Co-authored-by: viniciusdsandrade <[email protected]> --------- Co-authored-by: Cursor Agent <[email protected]> Co-authored-by: viniciusdsandrade <[email protected]>
1 parent 06a3343 commit baeb991

3 files changed

Lines changed: 233 additions & 27 deletions

File tree

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

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,14 @@ mod tests {
139139
"gemini-3.6-flash": {
140140
"input_cost_per_token": 0.000003,
141141
"output_cost_per_token": 0.000004
142+
},
143+
"claude-opus-5-5": {
144+
"input_cost_per_token": 0.000005,
145+
"output_cost_per_token": 0.000025
142146
}
143147
}"#
144148
),
145-
2
149+
3
146150
);
147151
pricing
148152
}
@@ -682,8 +686,55 @@ mod tests {
682686
&[],
683687
&[],
684688
);
689+
create_database(
690+
&fixture.path("third/conversations/third.db"),
691+
&[
692+
(
693+
1,
694+
metadata_blob(
695+
None,
696+
Some(UsageFixture {
697+
model_id: Some(1402),
698+
input_tokens: 300,
699+
total_output_tokens: 60,
700+
visible_output_tokens: 60,
701+
response_id: Some("snapshot-opus-id"),
702+
..UsageFixture::default()
703+
}),
704+
Some((1_781_481_600, 0)),
705+
&[],
706+
),
707+
),
708+
(
709+
2,
710+
metadata_blob(
711+
Some("model_placeholder_m402"),
712+
Some(UsageFixture {
713+
input_tokens: 400,
714+
total_output_tokens: 80,
715+
visible_output_tokens: 80,
716+
response_id: Some("snapshot-opus-placeholder"),
717+
..UsageFixture::default()
718+
}),
719+
Some((1_781_481_660, 0)),
720+
&[],
721+
),
722+
),
723+
],
724+
&[],
725+
&[],
726+
);
685727
let pricing = snapshot_pricing();
686728
let entries = load_from_fixture_with_pricing(&fixture, true, &pricing);
729+
for response_id in ["snapshot-opus-id", "snapshot-opus-placeholder"] {
730+
let entry = entries
731+
.iter()
732+
.find(|entry| entry.data.message.id.as_deref() == Some(response_id))
733+
.unwrap();
734+
assert_eq!(entry.model.as_deref(), Some("claude-opus-5-5"));
735+
assert!(entry.cost > 0.0);
736+
assert!(entry.missing_pricing_model.is_none());
737+
}
687738
let periods = [
688739
crate::cli::AgentReportKind::Daily,
689740
crate::cli::AgentReportKind::Weekly,

‎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!(

‎rust/adapters/antigravity/src/snapshots/ccusage_adapter_antigravity__loader__tests__snapshots_production_reports_for_focused_periods.snap‎

Lines changed: 144 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,37 @@ expression: reports
4949
"outputTokens": 50,
5050
"totalCost": 0.0008,
5151
"totalTokens": 250
52+
},
53+
{
54+
"cacheCreationTokens": 0,
55+
"cacheReadTokens": 0,
56+
"date": "2026-06-15",
57+
"inputTokens": 700,
58+
"modelBreakdowns": [
59+
{
60+
"cacheCreationTokens": 0,
61+
"cacheReadTokens": 0,
62+
"cost": 0.007,
63+
"inputTokens": 700,
64+
"modelName": "claude-opus-5-5",
65+
"outputTokens": 140
66+
}
67+
],
68+
"modelsUsed": [
69+
"claude-opus-5-5"
70+
],
71+
"outputTokens": 140,
72+
"totalCost": 0.007,
73+
"totalTokens": 840
5274
}
5375
],
5476
"totals": {
5577
"cacheCreationTokens": 5,
5678
"cacheReadTokens": 20,
57-
"inputTokens": 300,
58-
"outputTokens": 80,
59-
"totalCost": 0.000987,
60-
"totalTokens": 415
79+
"inputTokens": 1000,
80+
"outputTokens": 220,
81+
"totalCost": 0.007987000000000001,
82+
"totalTokens": 1255
6183
}
6284
},
6385
"table": [
@@ -86,6 +108,19 @@ expression: reports
86108
"output": 50,
87109
"period": "2026-06-08",
88110
"total": 250
111+
},
112+
{
113+
"cacheCreate": 0,
114+
"cacheRead": 0,
115+
"cost": 0.007,
116+
"firstColumn": "Date",
117+
"input": 700,
118+
"models": [
119+
"claude-opus-5-5"
120+
],
121+
"output": 140,
122+
"period": "2026-06-15",
123+
"total": 840
89124
}
90125
]
91126
},
@@ -117,8 +152,16 @@ expression: reports
117152
{
118153
"cacheCreationTokens": 0,
119154
"cacheReadTokens": 0,
120-
"inputTokens": 200,
155+
"inputTokens": 900,
121156
"modelBreakdowns": [
157+
{
158+
"cacheCreationTokens": 0,
159+
"cacheReadTokens": 0,
160+
"cost": 0.007,
161+
"inputTokens": 700,
162+
"modelName": "claude-opus-5-5",
163+
"outputTokens": 140
164+
},
122165
{
123166
"cacheCreationTokens": 0,
124167
"cacheReadTokens": 0,
@@ -129,21 +172,22 @@ expression: reports
129172
}
130173
],
131174
"modelsUsed": [
132-
"gemini-3.6-flash"
175+
"gemini-3.6-flash",
176+
"claude-opus-5-5"
133177
],
134178
"month": "2026-06",
135-
"outputTokens": 50,
136-
"totalCost": 0.0008,
137-
"totalTokens": 250
179+
"outputTokens": 190,
180+
"totalCost": 0.0078000000000000005,
181+
"totalTokens": 1090
138182
}
139183
],
140184
"totals": {
141185
"cacheCreationTokens": 5,
142186
"cacheReadTokens": 20,
143-
"inputTokens": 300,
144-
"outputTokens": 80,
145-
"totalCost": 0.000987,
146-
"totalTokens": 415
187+
"inputTokens": 1000,
188+
"outputTokens": 220,
189+
"totalCost": 0.007987000000000001,
190+
"totalTokens": 1255
147191
}
148192
},
149193
"table": [
@@ -163,15 +207,16 @@ expression: reports
163207
{
164208
"cacheCreate": 0,
165209
"cacheRead": 0,
166-
"cost": 0.0008,
210+
"cost": 0.0078000000000000005,
167211
"firstColumn": "Month",
168-
"input": 200,
212+
"input": 900,
169213
"models": [
170-
"gemini-3.6-flash"
214+
"gemini-3.6-flash",
215+
"claude-opus-5-5"
171216
],
172-
"output": 50,
217+
"output": 190,
173218
"period": "2026-06",
174-
"total": 250
219+
"total": 1090
175220
}
176221
]
177222
},
@@ -227,15 +272,40 @@ expression: reports
227272
"sessionId": "second",
228273
"totalCost": 0.0008,
229274
"totalTokens": 250
275+
},
276+
{
277+
"cacheCreationTokens": 0,
278+
"cacheReadTokens": 0,
279+
"firstActivity": "2026-06-15T00:00:00.000Z",
280+
"inputTokens": 700,
281+
"lastActivity": "2026-06-15T00:01:00.000Z",
282+
"modelBreakdowns": [
283+
{
284+
"cacheCreationTokens": 0,
285+
"cacheReadTokens": 0,
286+
"cost": 0.007,
287+
"inputTokens": 700,
288+
"modelName": "claude-opus-5-5",
289+
"outputTokens": 140
290+
}
291+
],
292+
"modelsUsed": [
293+
"claude-opus-5-5"
294+
],
295+
"outputTokens": 140,
296+
"projectPath": "Antigravity",
297+
"sessionId": "third",
298+
"totalCost": 0.007,
299+
"totalTokens": 840
230300
}
231301
],
232302
"totals": {
233303
"cacheCreationTokens": 5,
234304
"cacheReadTokens": 20,
235-
"inputTokens": 300,
236-
"outputTokens": 80,
237-
"totalCost": 0.000987,
238-
"totalTokens": 415
305+
"inputTokens": 1000,
306+
"outputTokens": 220,
307+
"totalCost": 0.007987000000000001,
308+
"totalTokens": 1255
239309
}
240310
},
241311
"table": [
@@ -264,6 +334,19 @@ expression: reports
264334
"output": 50,
265335
"period": "second",
266336
"total": 250
337+
},
338+
{
339+
"cacheCreate": 0,
340+
"cacheRead": 0,
341+
"cost": 0.007,
342+
"firstColumn": "Session",
343+
"input": 700,
344+
"models": [
345+
"claude-opus-5-5"
346+
],
347+
"output": 140,
348+
"period": "third",
349+
"total": 840
267350
}
268351
]
269352
},
@@ -272,10 +355,10 @@ expression: reports
272355
"totals": {
273356
"cacheCreationTokens": 5,
274357
"cacheReadTokens": 20,
275-
"inputTokens": 300,
276-
"outputTokens": 80,
277-
"totalCost": 0.000987,
278-
"totalTokens": 415
358+
"inputTokens": 1000,
359+
"outputTokens": 220,
360+
"totalCost": 0.007987000000000001,
361+
"totalTokens": 1255
279362
},
280363
"weekly": [
281364
{
@@ -321,6 +404,28 @@ expression: reports
321404
"totalCost": 0.0008,
322405
"totalTokens": 250,
323406
"week": "2026-06-08"
407+
},
408+
{
409+
"cacheCreationTokens": 0,
410+
"cacheReadTokens": 0,
411+
"inputTokens": 700,
412+
"modelBreakdowns": [
413+
{
414+
"cacheCreationTokens": 0,
415+
"cacheReadTokens": 0,
416+
"cost": 0.007,
417+
"inputTokens": 700,
418+
"modelName": "claude-opus-5-5",
419+
"outputTokens": 140
420+
}
421+
],
422+
"modelsUsed": [
423+
"claude-opus-5-5"
424+
],
425+
"outputTokens": 140,
426+
"totalCost": 0.007,
427+
"totalTokens": 840,
428+
"week": "2026-06-15"
324429
}
325430
]
326431
},
@@ -350,6 +455,19 @@ expression: reports
350455
"output": 50,
351456
"period": "2026-06-08",
352457
"total": 250
458+
},
459+
{
460+
"cacheCreate": 0,
461+
"cacheRead": 0,
462+
"cost": 0.007,
463+
"firstColumn": "Week",
464+
"input": 700,
465+
"models": [
466+
"claude-opus-5-5"
467+
],
468+
"output": 140,
469+
"period": "2026-06-15",
470+
"total": 840
353471
}
354472
]
355473
}

0 commit comments

Comments
 (0)