The best way to control Claude Code, Codex and more from any computer or phone
fix(server): price Antigravity Gemini Flash effort variants (#13809)
Co-authored-by: Julius Marminge <julius0216@outlook.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> Co-authored-by: maria-rcks <maria@kuuro.net>
Ephraim committed
Nov 10, 2026 at 06:56 UTC
9a3f8db9b39704cd1adb522babda23c21de8e1e4
2 files changed
+87
-2
apps/server/src/provider/Drivers/antigravityUsageReader.test.ts
+68
@@ -11,6 +11,8 @@ import * as Layer from "effect/Layer";
11
import * as Path from "effect/Path";
12
import * as SqlClient from "effect/sql/SqlClient";
13
14
+import { parseRateTable, priceUsage } from "../../usage/usagePricing.ts";
15
+
16
import { makeAntigravityUsageCache, readAntigravityUsage } from "./antigravityUsageReader.ts";
17
18
const openDatabase = Effect.fn("openDatabase")(function* (filename: string) {
@@ -162,6 +164,72 @@ describe("readAntigravityUsage", () => {
164
}).pipe(Effect.provide(NodeServices.layer)),
165
);
166
167
+ it.effect("prices Antigravity effort and routing variants at their base model", () =>
168
+ Effect.gen(function* () {
169
+ const path = yield* Path.Path;
170
+ const dir = yield* tempDir;
171
+ yield* seedDatabase(path.join(dir, "variants.db"), (db) =>
172
+ Effect.gen(function* () {
173
+ yield* createTables(db);
174
+ yield* db.run("INSERT INTO gen_metadata VALUES (?, ?)", [
175
+ 0,
176
+ new Uint8Array(protoBytes(1, protoText(19, "Gemini 3.7 Flash Control"))),
177
+ ]);
178
+ yield* db.run("INSERT INTO steps VALUES (?, ?)", [
179
+ 0,
180
+ new Uint8Array(protoBytes(9, protoNumber(2, 10))),
181
+ ]);
182
+ yield* db.run("INSERT INTO steps VALUES (?, ?)", [
183
+ 1,
184
+ new Uint8Array(protoBytes(9, [...protoNumber(1, 1319), ...protoNumber(2, 11)])),
185
+ ]);
186
+ yield* db.run("INSERT INTO steps VALUES (?, ?)", [
187
+ 2,
188
+ new Uint8Array(protoBytes(9, [...protoNumber(1, 1132), ...protoNumber(2, 12)])),
189
+ ]);
190
+ // A model-less step that only learns its model by merging with a named generation.
191
+ yield* db.run("INSERT INTO steps VALUES (?, ?)", [
192
+ 5,
193
+ new Uint8Array(protoBytes(9, [...protoNumber(2, 100), ...protoText(11, "response")])),
194
+ ]);
195
+ yield* db.run("INSERT INTO gen_metadata VALUES (?, ?)", [
196
+ 3,
197
+ new Uint8Array(
198
+ protoBytes(1, [
199
+ ...protoText(19, "Gemini 3.8 Flash High"),
200
+ ...protoBytes(4, [...protoNumber(2, 100), ...protoText(11, "response")]),
201
+ ]),
202
+ ),
203
+ ]);
204
+ }),
205
+ );
206
+ const result = yield* readAntigravityUsage(dir, 0);
207
+ assert.deepStrictEqual(result.errors, []);
208
+ assert.deepStrictEqual(
209
+ records(result).map((record) => [record.model, record.rateModel]),
210
+ [
211
+ ["gemini-3.7-flash-control", "gemini-3.7-flash"],
212
+ ["gemini-3.8-flash-medium", "gemini-3.8-flash"],
213
+ ["gemini-3-flash-agent", "gemini-3-flash-preview"],
214
+ ["gemini-3.8-flash-high", "gemini-3.8-flash"],
215
+ ],
216
+ );
217
+ const table = parseRateTable({
218
+ "gemini-3.7-flash": { input_cost_per_token: 0.75e-6, output_cost_per_token: 3.75e-6 },
219
+ "gemini-3.8-flash": { input_cost_per_token: 0.75e-6, output_cost_per_token: 3.75e-6 },
220
+ "gemini-3-flash-preview": { input_cost_per_token: 0.5e-6, output_cost_per_token: 3e-6 },
221
+ });
222
+ const priced = records(result).map((record) => priceUsage(table, record));
223
+ assert.deepStrictEqual(
224
+ priced.map(({ costSource }) => costSource),
225
+ Array(4).fill("modelPriced"),
226
+ );
227
+ for (const [index, expected] of [7.5e-6, 8.25e-6, 6e-6, 75e-6].entries()) {
228
+ assert.closeTo(priced[index]!.costUsd, expected, 1e-12);
229
+ }
230
+ }).pipe(Effect.provide(NodeServices.layer)),
231
+ );
232
+
233
it.effect("prices ACP effort variants at the base model rate", () =>
234
Effect.gen(function* () {
235
const path = yield* Path.Path;
apps/server/src/provider/Drivers/antigravityUsageReader.ts
+19
-2
@@ -100,11 +100,28 @@ const MODEL_IDS: Record<number, string> = {
100
1018: "gemini-3-flash-preview",
101
1084: "gemini-3-flash-preview",
102
1047: "gemini-3-flash-preview",
103
+ 1020: "gemini-3.5-flash-low",
104
+ 1072: "gemini-3.6-flash-medium",
105
+ 1073: "gemini-3.6-flash-low",
106
+ 1132: "gemini-3-flash-agent",
107
+ 1133: "gemini-3-flash-agent",
108
+ 1187: "gemini-3.5-flash-extra-low",
109
+ 1298: "gemini-3.7-flash-high",
110
+ 1299: "gemini-3.7-flash-medium",
111
+ 1301: "gemini-3.7-flash-tiered",
112
+ 1318: "gemini-3.8-flash-high",
113
+ 1319: "gemini-3.8-flash-medium",
114
+ 1320: "gemini-3.8-flash-low",
115
+ 1322: "gemini-3.8-flash-tiered",
116
};
117
105
-// ACP slugs append the thinking level, which shares the base model's price.
118
+// Effort and routing variants share the base model's price.
119
function withRateModel(record: UsageRecord): UsageRecord {
107
- const rateModel = record.model.replace(/-(?:low|medium|high)$/, "");
120
+ const base = record.model.replace(
121
+ /-(?:extra-low|low|medium|high|tiered|control|thinking|agent)$/,
122
+ "",
123
+ );
124
+ const rateModel = base === "gemini-3-flash" ? "gemini-3-flash-preview" : base;
125
return rateModel === record.model ? record : { ...record, rateModel };
126
}
127