@devries-cameron20 / t3code-1 / commits / 056b4457cc
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(usage): Gemini 4 Argon usage from Antigravity now has a price (#24834)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Theo Browne committed Oct 25, 2026 at 02:50 UTC 056b4457cc687b053e15f1fc89afb900078a127e
4 files changed +66 -9
apps/server/src/provider/Drivers/antigravityUsageReader.test.ts
+30
@@ -162,6 +162,36 @@ describe("readAntigravityUsage", () => {
162 }).pipe(Effect.provide(NodeServices.layer)),
163 );
164
165 + it.effect("prices ACP effort variants at the base model rate", () =>
166 + Effect.gen(function* () {
167 + const path = yield* Path.Path;
168 + const dir = yield* tempDir;
169 + yield* seedDatabase(path.join(dir, "effort.db"), (db) =>
170 + Effect.gen(function* () {
171 + yield* createTables(db);
172 + for (const [idx, name] of ["gemini-4-argon-high", "gemini-4-argon"].entries()) {
173 + yield* db.run("INSERT INTO gen_metadata VALUES (?, ?)", [
174 + idx,
175 + new Uint8Array(protoBytes(1, protoText(19, name))),
176 + ]);
177 + yield* db.run("INSERT INTO steps VALUES (?, ?)", [
178 + idx,
179 + new Uint8Array(protoBytes(9, protoNumber(2, 10 + idx))),
180 + ]);
181 + }
182 + }),
183 + );
184 + const result = yield* readAntigravityUsage(dir, 0);
185 + assert.deepStrictEqual(
186 + records(result).map(({ model, rateModel }) => [model, rateModel]),
187 + [
188 + ["gemini-4-argon-high", "gemini-4-argon"],
189 + ["gemini-4-argon", undefined],
190 + ],
191 + );
192 + }).pipe(Effect.provide(NodeServices.layer)),
193 + );
194 +
195 it.effect("merges Antigravity aliases that bridge previously separate step records", () =>
196 Effect.gen(function* () {
197 const path = yield* Path.Path;
apps/server/src/provider/Drivers/antigravityUsageReader.ts
+7 -1
@@ -101,6 +101,12 @@ const MODEL_IDS: Record<number, string> = {
101 1047: "gemini-3-flash-preview",
102 };
103
104 +// ACP slugs append the thinking level, which shares the base model's price.
105 +function withRateModel(record: UsageRecord): UsageRecord {
106 + const rateModel = record.model.replace(/-(?:low|medium|high)$/, "");
107 + return rateModel === record.model ? record : { ...record, rateModel };
108 +}
109 +
110 function modelName(name: string, id: number): string {
111 if (name) {
112 const normalized = name
@@ -470,7 +476,7 @@ export const readAntigravityUsage = Effect.fn("readAntigravityUsage")(function*
476 }
477 for (const [index, group] of groups.entries()) {
478 if (group.parent === index && group.record.timestampMs >= sinceMs) {
473 - files[group.fileIndex]!.records.push(group.record);
479 + files[group.fileIndex]!.records.push(withRateModel(group.record));
480 }
481 }
482 return { files, errors };
apps/server/src/usage/usagePricing.test.ts
+15
@@ -233,6 +233,21 @@ describe("usage pricing", () => {
233 );
234 });
235
236 + it("keeps a bare alias when a reseller entry omits the fast tier", () => {
237 + const table = parseRateTable({
238 + "provider-a/example-model": {
239 + ...rate(1),
240 + input_cost_per_token_priority: 2,
241 + output_cost_per_token_priority: 10,
242 + },
243 + "provider-b/example-model": rate(1),
244 + });
245 +
246 + expect(lookupRate(table, "example-model")).toEqual(
247 + lookupRate(table, "provider-a/example-model"),
248 + );
249 + });
250 +
251 it("leaves an ambiguous bare name unpriced", () => {
252 const table = parseRateTable({
253 "provider-a/example-model": rate(1),
apps/server/src/usage/usagePricing.ts
+14 -8
@@ -120,8 +120,8 @@ export function parseRateTable(document: unknown): RateTable {
120 const held = aliasCandidates.get(alias);
121 if (held === undefined) {
122 aliasCandidates.set(alias, rate);
123 - } else if (held !== null && !sameRate(held, rate)) {
124 - aliasCandidates.set(alias, null);
123 + } else if (held !== null) {
124 + aliasCandidates.set(alias, mergeAliasRate(held, rate));
125 }
126 }
127 for (const [alias, rate] of aliasCandidates) {
@@ -141,12 +141,18 @@ function sameTokenRates(a: TokenRates | null, b: TokenRates | null): boolean {
141 );
142 }
143
144 -function sameRate(a: ModelRate, b: ModelRate): boolean {
145 - return (
146 - sameTokenRates(a, b) &&
147 - sameTokenRates(a.fast, b.fast) &&
148 - sameTokenRates(a.ultrafast, b.ultrafast)
149 - );
144 +// Resellers often omit speed tiers, so a missing tier fills from the other entry instead of conflicting.
145 +function mergeAliasRate(a: ModelRate, b: ModelRate): ModelRate | null {
146 + const fast = a.fast ?? b.fast;
147 + const ultrafast = a.ultrafast ?? b.ultrafast;
148 + if (
149 + !sameTokenRates(a, b) ||
150 + !sameTokenRates(fast, b.fast ?? fast) ||
151 + !sameTokenRates(ultrafast, b.ultrafast ?? ultrafast)
152 + ) {
153 + return null;
154 + }
155 + return { ...a, fast, ultrafast };
156 }
157
158 function ratesAt(rate: ModelRate, speed: UsageSpeed): TokenRates {