Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Antigravity: run Gemini 4 Neon ids that carry a thinking level (#6981)

Milind Soniece8edae1bcd
diff --git a/server/drivers/acp/core.ts b/server/drivers/acp/core.ts
index 370713a59f..308a82b600 100644
--- a/server/drivers/acp/core.ts
+++ b/server/drivers/acp/core.ts
@@ -246,7 +246,7 @@ export interface AcpSupport extends AcpDriverHooks {
/** Rewrite a picker id (`omlx::model`) into the CLI-native id before spawn and session/select. */
resolveTurnModel?(model: string | undefined, env: Record<string, string | undefined>, catalog: ModelCatalog): string | undefined;
/** Map a saved selection onto the live session's catalog (a retired model id), once session/new or load answers. */
- normalizeSessionSelection?(turn: SendTurnInput, offeredModels: readonly string[]): SendTurnInput;
+ normalizeSessionSelection?(turn: SendTurnInput, offeredModels: readonly string[], catalog: ModelCatalog): SendTurnInput;
/** Per-session settings between session/new (or load) and the first prompt. Some CLIs ignore argv
* and take the model/mode over the wire (droid); a throw fails the turn rather than run another model. */
configureSession?(ctx: {
diff --git a/server/drivers/acp/session-model-controls.test.ts b/server/drivers/acp/session-model-controls.test.ts
index 074abbb59b..f976f4a3f3 100644
--- a/server/drivers/acp/session-model-controls.test.ts
+++ b/server/drivers/acp/session-model-controls.test.ts
@@ -136,7 +136,7 @@ describe("picking the session model before the setter runs", () => {
it("maps a legacy pick onto the live catalog before the stale and fallback checks", () => {
const normalizeSessionSelection = vi.fn((turn, offered: readonly string[]) => offered.includes("two") ? { ...turn, model: "two", variant: "max" } : turn);
const picked = pick({ displayName: "Agent", normalizeSessionSelection, fallbackModel: () => "one" }, "two-max");
- expect(normalizeSessionSelection).toHaveBeenCalledWith(expect.objectContaining({ model: "two-max" }), ["one", "two"]);
+ expect(normalizeSessionSelection).toHaveBeenCalledWith(expect.objectContaining({ model: "two-max" }), ["one", "two"], catalog);
expect(picked).toMatchObject({ turn: { model: "two", variant: "max" }, variant: "max", reportedModel: "two-max", staleProcess: false, notice: null });
});
diff --git a/server/drivers/acp/session-model-controls.ts b/server/drivers/acp/session-model-controls.ts
index aa9f3c9865..de7e5f9c07 100644
--- a/server/drivers/acp/session-model-controls.ts
+++ b/server/drivers/acp/session-model-controls.ts
@@ -154,7 +154,7 @@ export function pickSessionModel(
const { session, requested, catalog } = input;
let { turn, variant, reportedModel } = input;
const offered = offeredModels(session.sessionConfigResult, input.configId);
- const normalized = support.normalizeSessionSelection?.(turn, offered) ?? turn;
+ const normalized = support.normalizeSessionSelection?.(turn, offered, catalog) ?? turn;
if (normalized !== turn) {
turn = normalized;
variant = turn.variant;
diff --git a/server/drivers/antigravity-models.test.ts b/server/drivers/antigravity-models.test.ts
new file mode 100644
index 0000000000..93275c3833
--- /dev/null
+++ b/server/drivers/antigravity-models.test.ts
@@ -0,0 +1,63 @@
+import { describe, expect, it } from "vitest";
+import type { ModelCatalog } from "../contracts.ts";
+import { antigravityRateModel, splitAntigravityThinking, withAntigravityThinking } from "./antigravity-models.ts";
+
+const levels = (...ids: string[]) => ids.map((id) => ({ id, label: id }));
+const catalog: ModelCatalog = {
+ default: "gemini-3.8-flash",
+ options: [
+ { id: "gemini-3.8-flash", label: "Gemini 3.8 Flash", variants: levels("low", "medium", "high") },
+ { id: "gemini-4-neon", label: "Gemini 4 Neon", variants: levels("medium", "high") },
+ { id: "gemini-4-hydrogen", label: "Gemini 4 Hydrogen", variants: levels("extra-low", "low", "high") },
+ { id: "gemini-4-argon", label: "Gemini 4 Argon" },
+ { id: "gemini-4-carbon-high", label: "Gemini 4 Carbon (High)" },
+ ],
+};
+const antigravity = { driverKind: "antigravityAgent", models: catalog };
+
+describe("Antigravity ids with a thinking level", () => {
+ it("splits a level the base model advertises, and only that", () => {
+ expect(splitAntigravityThinking("gemini-4-neon-high", catalog.options)).toEqual({ model: "gemini-4-neon", variant: "high" });
+ expect(splitAntigravityThinking("gemini-4-neon-low", catalog.options)).toBeNull();
+ expect(splitAntigravityThinking("gemini-4-hydrogen-extra-low", catalog.options)).toEqual({ model: "gemini-4-hydrogen", variant: "extra-low" });
+ });
+
+ it("takes the legacy levels for a model whose levels are not known yet only when asked", () => {
+ expect(splitAntigravityThinking("gemini-4-argon-medium", catalog.options)).toBeNull();
+ expect(splitAntigravityThinking("gemini-4-argon-medium", catalog.options, true)).toEqual({ model: "gemini-4-argon", variant: "medium" });
+ expect(splitAntigravityThinking("gemini-4-argon-extra-low", catalog.options, true)).toBeNull();
+ expect(splitAntigravityThinking("gemini-4-neon-low", catalog.options, true)).toBeNull();
+ });
+
+ it("keeps an id the catalog lists, and one whose base it lacks", () => {
+ expect(splitAntigravityThinking("gemini-4-carbon-high", catalog.options)).toBeNull();
+ expect(splitAntigravityThinking("gemini-4-neon", catalog.options)).toBeNull();
+ expect(splitAntigravityThinking("gemini-4-xenon-high", catalog.options)).toBeNull();
+ });
+
+ it("runs a suffixed selection as its base model at that level, unless a level was chosen", () => {
+ const selection = { instanceId: "antigravity", model: "gemini-4-neon-high" };
+ expect(withAntigravityThinking(antigravity, selection, false)).toEqual({ instanceId: "antigravity", model: "gemini-4-neon", variant: "high" });
+ expect(withAntigravityThinking(antigravity, selection, true)).toEqual({ instanceId: "antigravity", model: "gemini-4-neon" });
+ expect(withAntigravityThinking({ ...antigravity, driverKind: "cursor" }, selection, false)).toBe(selection);
+ expect(withAntigravityThinking(null, selection, false)).toBe(selection);
+ const unknownLevels = { instanceId: "antigravity", model: "gemini-4-argon-high" };
+ expect(withAntigravityThinking(antigravity, unknownLevels, false)).toBe(unknownLevels);
+ const listed = { instanceId: "antigravity", model: "gemini-4-neon" };
+ expect(withAntigravityThinking(antigravity, listed, false)).toBe(listed);
+ });
+});
+
+describe("the price an Antigravity id pays", () => {
+ it("is its base model's for effort and routing variants", () => {
+ expect(antigravityRateModel("gemini-4-neon-high")).toBe("gemini-4-neon");
+ expect(antigravityRateModel("gemini-3.5-flash-extra-low")).toBe("gemini-3.5-flash");
+ expect(antigravityRateModel("gemini-4-hydrogen-orchestrator")).toBe("gemini-4-hydrogen");
+ expect(antigravityRateModel("gemini-4-neon")).toBe("gemini-4-neon");
+ });
+
+ it("is the Gemini 4 model an Orchestrator runs on", () => {
+ expect(antigravityRateModel("gemini-pro-orchestrator-neon")).toBe("gemini-4-neon");
+ expect(antigravityRateModel("gemini-pro-orchestrator-g1-pro")).toBe("gemini-4-argon");
+ });
+});
diff --git a/server/drivers/antigravity-models.ts b/server/drivers/antigravity-models.ts
new file mode 100644
index 0000000000..2e93164942
--- /dev/null
+++ b/server/drivers/antigravity-models.ts
@@ -0,0 +1,49 @@
+// Antigravity model ids that carry more than the model: a thinking level, or a routing name in its usage records.
+import type { ModelCatalog, ModelSelection, ProviderInstance } from "../contracts.ts";
+
+/** The levels saved before a runtime said which ones a model offers. */
+const LEGACY_THINKING_LEVELS: readonly string[] = ["low", "medium", "high"];
+
+/** Antigravity 1.3 ids end in a thinking level (`gemini-4-neon-high`); later runtimes list the base model and offer the
+ * level as its thinking option, and still accept the suffixed id. The id is split only when the catalog lacks it, lists
+ * the base, and the suffix is one of the base's thinking levels; `legacyLevels` takes the legacy three for a base whose
+ * levels are not known yet. */
+export function splitAntigravityThinking(
+ model: string,
+ options: ReadonlyArray<Pick<ModelCatalog["options"][number], "id" | "variants">>,
+ legacyLevels = false,
+): { model: string; variant: string } | null {
+ if (options.some((option) => option.id === model)) return null;
+ let split: { model: string; variant: string } | null = null;
+ for (const option of options) {
+ if (!model.startsWith(`${option.id}-`) || (split && split.model.length >= option.id.length)) continue;
+ const level = model.slice(option.id.length + 1);
+ const levels = option.variants?.length ? option.variants.map((variant) => variant.id) : legacyLevels ? LEGACY_THINKING_LEVELS : [];
+ if (levels.includes(level)) split = { model: option.id, variant: level };
+ }
+ return split;
+}
+
+/** A selection named with a suffixed id runs the base model at that level; a level the caller chose keeps its place. */
+export function withAntigravityThinking(
+ instance: Pick<ProviderInstance, "driverKind" | "models"> | null | undefined,
+ selection: ModelSelection,
+ levelChosen: boolean,
+): ModelSelection {
+ if (instance?.driverKind !== "antigravityAgent" || selection.model === instance.models.default) return selection;
+ const split = splitAntigravityThinking(selection.model, instance.models.options);
+ if (!split) return selection;
+ return { ...selection, model: split.model, ...(levelChosen ? {} : { variant: split.variant }) };
+}
+
+// Antigravity's own usage records name its Orchestrator after the Gemini 4 model each one runs on.
+const ORCHESTRATOR_MODELS: Readonly<Record<string, string>> = {
+ "gemini-pro-orchestrator-neon": "gemini-4-neon",
+ "gemini-pro-orchestrator-g1-pro": "gemini-4-argon",
+};
+const RATE_SUFFIX = /-(?:extra-low|low|medium|high|tiered|control|thinking|agent|orchestrator)$/u;
+
+/** The model whose price an Antigravity id pays: effort and routing variants cost what their base model costs. */
+export function antigravityRateModel(model: string): string {
+ return ORCHESTRATOR_MODELS[model] ?? model.replace(RATE_SUFFIX, "");
+}
diff --git a/server/drivers/antigravity-turn-outcome.test.ts b/server/drivers/antigravity-turn-outcome.test.ts
index 4345a93109..33f175c498 100644
--- a/server/drivers/antigravity-turn-outcome.test.ts
+++ b/server/drivers/antigravity-turn-outcome.test.ts
@@ -170,6 +170,8 @@ describe("watchAntigravityPromptOutcome", () => {
expect(antigravityLimitFacts("claude-sonnet-5", known)).toEqual({ limit: "model", limitModels: ["claude-sonnet-5", "gpt-6"] });
expect(antigravityLimitFacts("gemini-3.8-flash-high", known)).toEqual({ limit: "model", limitModels: ["gemini-3.8-flash-high", "gemini-3.8-flash", "gemini-3.8-pro"] });
expect(antigravityLimitFacts("gemini-4-argon", known)).toEqual({ limit: "model", limitModels: ["gemini-4-argon"] });
+ expect(antigravityQuotaFamily("gemini-4-neon")).toBe("gemini");
+ expect(antigravityLimitFacts("gemini-4-neon", known)).toEqual({ limit: "model", limitModels: ["gemini-4-neon", "gemini-3.8-flash", "gemini-3.8-pro"] });
expect(antigravityLimitFacts(undefined, known)).toEqual({ limit: "model" });
});
diff --git a/server/drivers/antigravity.test.ts b/server/drivers/antigravity.test.ts
index 88a8f55508..e436d84d01 100644
--- a/server/drivers/antigravity.test.ts
+++ b/server/drivers/antigravity.test.ts
@@ -643,6 +643,27 @@ describe("official Antigravity runtime", () => {
});
}, 20_000);
+ it("offers Gemini 4 Neon from the account's own list with its thinking levels, keeping the bundled default", async () => {
+ const fake = fakeRuntime();
+ const runtime = await resolveAntigravityRuntime(fake.executable);
+ const levels = [{ value: "medium", name: "Medium" }, { value: "high", name: "High" }];
+ const profile = await prepareAntigravityProfile({
+ instanceId: "neon-catalog", runtime, baseDir: fake.directory,
+ baseEnv: {
+ PATH: process.env.PATH,
+ FAKE_ACP_AUTH_METHOD: "oauth-personal",
+ FAKE_ACP_MODELS: "gemini-4-neon,gemini-3.8-flash",
+ FAKE_ACP_VARIANTS: JSON.stringify({ "gemini-4-neon": { id: "thought_level", currentValue: "high", options: levels } }),
+ },
+ });
+ const catalog = await probeAntigravityModels({ runtime, profile, fallbackDefault: "gemini-3.8-flash" });
+ expect(catalog.default).toBe("gemini-3.8-flash");
+ expect(catalog.options.find((option) => option.id === "gemini-4-neon")).toEqual({
+ id: "gemini-4-neon", label: "gemini-4-neon", variants: [{ id: "medium", label: "Medium" }, { id: "high", label: "High" }],
+ });
+ await expect(probeAntigravityModels({ runtime, profile, fallbackDefault: "gemini-9-flash" })).resolves.toMatchObject({ default: "gemini-4-neon" });
+ }, 20_000);
+
it("rejects a download redirected to insecure HTTP", async () => {
const baseDir = mkdtempSync(join(tmpdir(), "omb-antigravity-insecure-"));
scratch.push(baseDir);
@@ -1015,7 +1036,7 @@ describe("Antigravity driver over shared ACP", () => {
environment: {
FAKE_ACP_AUTH_METHOD: "oauth-personal",
FAKE_ACP_MODELS: sessionModels,
- FAKE_ACP_VARIANTS: JSON.stringify(Object.fromEntries(["gemini-3.8-flash", "gemini-4-argon"].map((id) => [id, {
+ FAKE_ACP_VARIANTS: JSON.stringify(Object.fromEntries(["gemini-3.8-flash", "gemini-4-argon", "gemini-4-neon"].map((id) => [id, {
id: "thinking_level",
currentValue: "high",
options: [{ value: "low", name: "Low" }, { value: "medium", name: "Medium" }, { value: "high", name: "High" }],
@@ -1060,6 +1081,12 @@ describe("Antigravity driver over shared ACP", () => {
expect(calls.some((call: any) => call.params.value === "gemini-4-argon-high")).toBe(false);
});
+ it("runs a Gemini 4 Neon (High) pick as the base model at High thinking when the runtime offers only the base", async () => {
+ const { calls, selection } = await legacyPickTurn("antigravity-legacy-neon", "gemini-3.8-flash,gemini-4-neon", "gemini-4-neon-high");
+ expect(selection).toEqual({ sessionId: expect.any(String), model: "gemini-4-neon", variant: "high" });
+ expect(calls.some((call: any) => call.params.value === "gemini-4-neon-high")).toBe(false);
+ });
+
it("keeps a suffixed Gemini 3.8 Flash pick unchanged when the runtime still offers it", async () => {
const { calls, selection } = await legacyPickTurn("antigravity-suffixed-offered", "gemini-3.8-flash,gemini-3.8-flash-medium", "gemini-3.8-flash-medium");
expect(selection).toEqual({ sessionId: expect.any(String), model: "gemini-3.8-flash-medium" });
@@ -1077,6 +1104,18 @@ describe("Antigravity driver over shared ACP", () => {
expect(normalizeAntigravityTurn({ ...turn, model: "gemini-4-argon-high" }, ["gemini-3.8-flash"])).toEqual({ ...turn, model: "gemini-4-argon-high" });
});
+ it("splits a suffixed id only at a thinking level the catalog gives its base model", () => {
+ const turn = { threadId: "t", text: "hi", model: "gemini-4-neon-high" };
+ const catalog = { default: "gemini-3.8-flash", options: [
+ { id: "gemini-3.8-flash", label: "Gemini 3.8 Flash" },
+ { id: "gemini-4-neon", label: "Gemini 4 Neon", variants: [{ id: "extra-low", label: "Extra Low" }, { id: "high", label: "High" }] },
+ ] };
+ const offered = ["gemini-3.8-flash", "gemini-4-neon"];
+ expect(normalizeAntigravityTurn(turn, offered, catalog)).toEqual({ ...turn, model: "gemini-4-neon", variant: "high" });
+ expect(normalizeAntigravityTurn({ ...turn, model: "gemini-4-neon-extra-low" }, offered, catalog)).toEqual({ ...turn, model: "gemini-4-neon", variant: "extra-low" });
+ expect(normalizeAntigravityTurn({ ...turn, model: "gemini-4-neon-medium" }, offered, catalog)).toEqual({ ...turn, model: "gemini-4-neon-medium" });
+ });
+
it("keeps one process across approval and model changes, starting on OMB's model", async () => {
ensureDirs();
const fake = fakeRuntime();
diff --git a/server/drivers/antigravity.ts b/server/drivers/antigravity.ts
index a88aae4695..a43dbfe1fe 100644
--- a/server/drivers/antigravity.ts
+++ b/server/drivers/antigravity.ts
@@ -29,6 +29,7 @@ import {
verifyAntigravityBrowserHelper,
} from "./antigravity-acp.ts";
import { antigravityLimitFacts, watchAntigravityPromptOutcome } from "./antigravity-turn-outcome.ts";
+import { splitAntigravityThinking } from "./antigravity-models.ts";
import { AntigravityAuthController } from "./antigravity-auth.ts";
import {
antigravityManagedInstallAvailable,
@@ -44,15 +45,13 @@ import { currentEngineCatalog } from "../model-manifest/manifest.ts";
export const STATIC_ANTIGRAVITY_MODELS: ModelCatalog = bundledEngineCatalog("antigravity");
-/** Bots saved before the thinking-level option hold ids like `gemini-3.8-flash-medium` or `gemini-4-argon-high`;
+/** Bots saved before the thinking-level option hold ids like `gemini-3.8-flash-medium` or `gemini-4-neon-high`;
* the official runtime offers only the base model with that option, so run the base at the saved level. A runtime
* that still offers the suffixed id, or lacks the base, or a turn that chose its own level, keeps its selection. */
-export function normalizeAntigravityTurn(turn: SendTurnInput, offeredModels: readonly string[]): SendTurnInput {
- if (turn.variant !== undefined) return turn;
- const match = turn.model?.match(/^(.+)-(low|medium|high)$/u);
- return match && offeredModels.includes(match[1]) && !offeredModels.includes(match[0])
- ? { ...turn, model: match[1], variant: match[2] }
- : turn;
+export function normalizeAntigravityTurn(turn: SendTurnInput, offeredModels: readonly string[], catalog?: ModelCatalog): SendTurnInput {
+ if (turn.variant !== undefined || !turn.model) return turn;
+ const split = splitAntigravityThinking(turn.model, offeredModels.map((id) => catalog?.options.find((option) => option.id === id) ?? { id }), true);
+ return split ? { ...turn, ...split } : turn;
}
/** Antigravity's session modes: `yolo` for Full, `auto_edit` for auto-accept edits, `default` otherwise (it has no reviewer for Auto). */
diff --git a/server/index.ts b/server/index.ts
index 68d67b9f4f..4a91a6a378 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -623,6 +623,7 @@ import { createSetupImportRoutes } from "./routes/setup-import.ts";
import { createComputerRoutes } from "./routes/computers.ts";
import { createStatusRoutes } from "./routes/status.ts";
import { findAntigravityLeftovers, removeAntigravityLeftovers } from "./drivers/antigravity-temp.ts";
+import { withAntigravityThinking } from "./drivers/antigravity-models.ts";
import { createLiveRoutes } from "./routes/live.ts";
import { createNotificationRoutes, notificationListedFor } from "./routes/notifications.ts";
import { createTodayRoutes } from "./routes/today.ts"; import { createInboxRoutes } from "./routes/inbox.ts"; import { createSidebarSectionRoutes } from "./routes/sidebar-sections.ts";
@@ -2540,6 +2541,7 @@ function checkedModelSelection(
raw: unknown,
current?: { selection: ModelSelection; busy: boolean },
requireAvailableModel = false,
+ namedByBot = false,
): { ok: true; selection: ModelSelection } | ({ ok: false; status: number } & ServerErrorBody) {
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
return { ok: false, status: 400, error: "modelSelection must be an object" };
@@ -2551,10 +2553,7 @@ function checkedModelSelection(
if (typeof value.model !== "string" || !value.model.trim()) {
return { ok: false, status: 400, error: "modelSelection.model is required" };
}
- const selection: ModelSelection = {
- instanceId: value.instanceId.trim(),
- model: value.model.trim(),
- };
+ const named: ModelSelection = { instanceId: value.instanceId.trim(), model: value.model.trim() }, selection = namedByBot ? withAntigravityThinking(registry.get(named.instanceId), named, value.effort !== undefined || value.variant !== undefined) : named;
if (hostedModels && !hostedModels.allows(selection)) return { ok: false, status: 400, error: hostedModels.error() };
if (value.effort !== undefined) {
if (!isEffortLevel(value.effort)) {
@@ -13899,7 +13898,7 @@ const handleRequest = async (req: IncomingMessage, res: ServerResponse) => {
projectId = project.id;
}
const sourceTitle = owner.group ? owner.group.name : (store.taskByThread(from.id, fromThreadId)?.title ?? "");
- const picked = body.modelSelection === undefined ? null : checkedModelSelection(body.modelSelection, undefined, true); const refused = !picked ? null : target.id !== from.id ? "model_selection is only for threads on yourself" : !picked.ok ? picked.error : ownThreads.refusal(picked.selection, from); if (refused) return json(res, 400, { error: refused });
+ const picked = body.modelSelection === undefined ? null : checkedModelSelection(body.modelSelection, undefined, true, true); const refused = !picked ? null : target.id !== from.id ? "model_selection is only for threads on yourself" : !picked.ok ? picked.error : ownThreads.refusal(picked.selection, from); if (refused) return json(res, 400, { error: refused });
if (target.id === from.id) { const selfRefused = selfThreadRefusal({ handoff: Boolean(internalCapability.roomHandoffId), requestLine: store.activePath(fromThreadId).findLast((line) => line.role === "user" && line.kind === "text") }); if (selfRefused) return json(res, 409, { error: selfRefused });
const inherited = ownThreads.inherited(from.id, fromThreadId, picked?.ok ? picked.selection : undefined);
if (body.reportBack === true) { if (owner.group) return json(res, 400, { error: "report_back works only from your own conversation, not a room. Leave it out; the thread's result then stays in that thread." }); const tooLong = reportBackTooLong(message); if (tooLong) return json(res, 400, { error: tooLong });
@@ -13968,7 +13967,7 @@ const handleRequest = async (req: IncomingMessage, res: ServerResponse) => {
if (body.modelSelection === undefined) {
const copied = fields.modelSelection && checkedModelSelection(fields.modelSelection, undefined, true); selection = copied && copied.ok && !validateModelProposal(copied.selection) ? copied.selection : await defaultSelection();
} else {
- const checked = checkedModelSelection(body.modelSelection, undefined, true);
+ const checked = checkedModelSelection(body.modelSelection, undefined, true, true);
if (!checked.ok) return json(res, checked.status, refusalBody(checked));
selection = checked.selection;
}
diff --git a/server/model-prices.test.ts b/server/model-prices.test.ts
index 2ad201f65a..352a6053f8 100644
--- a/server/model-prices.test.ts
+++ b/server/model-prices.test.ts
@@ -85,6 +85,16 @@ describe("what the ledger books for a settled turn", () => {
expect(estimatePriceFor({ driverKind: "codex", model: "local::foo+priority" }, { "codex/local::foo": { inputPerMillion: 9, outputPerMillion: 9 } })).toBeNull();
});
+ it("prices an Antigravity id with a thinking level or an Orchestrator name as its base Gemini model", () => {
+ const operator: PriceList = { "gemini-4-neon": { inputPerMillion: 3, outputPerMillion: 15 }, "antigravityAgent/gemini-4-argon": { inputPerMillion: 2, outputPerMillion: 10 } };
+ for (const model of ["gemini-4-neon", "gemini-4-neon-high", "gemini-pro-orchestrator-neon"]) {
+ expect(estimatePriceFor({ driverKind: "antigravityAgent", model }, operator), model).toEqual({ inputPerMillion: 3, outputPerMillion: 15 });
+ }
+ expect(estimatePriceFor({ driverKind: "antigravityAgent", model: "gemini-pro-orchestrator-g1-pro" }, operator)?.inputPerMillion).toBe(2);
+ expect(estimatePriceFor({ driverKind: "antigravityAgent", model: "gemini-3.8-flash-extra-low" }, null)).toEqual(listPriceFor("gemini-3.8-flash"));
+ expect(estimatePriceFor({ driverKind: "acp", model: "gemini-4-neon-high" }, operator)).toBeNull();
+ });
+
it("books an unpriced model as unpriced, not as free", () => {
expect(ledgerCost({ driverKind: "grokAgent", model: "fake-model", input: 5000, output: 100, costUsd: null }, null)).toEqual({ costUsd: null });
expect(ledgerCost({ driverKind: "codex", model: "gpt-5.3-codex-spark", input: 5000, output: 100, costUsd: undefined }, { "claude-sonnet-5": { inputPerMillion: 1, outputPerMillion: 1 } })).toEqual({ costUsd: null });
diff --git a/server/model-prices.ts b/server/model-prices.ts
index 7cd82ffc17..6e0663df81 100644
--- a/server/model-prices.ts
+++ b/server/model-prices.ts
@@ -1,4 +1,5 @@
import type { ModelPrice, PriceList, PricedTurn } from "./prices.ts";
+import { antigravityRateModel } from "./drivers/antigravity-models.ts";
import { codexTierOf } from "./drivers/codex-tier.ts";
import { currentPrices } from "./model-manifest/manifest.ts";
import { billableFor } from "./prices.ts";
@@ -32,7 +33,8 @@ export type CostSource = "reported" | "estimated";
export function estimatePriceFor(turn: Pick<PricedTurn, "driverKind" | "model">, operatorPrices: PriceList | null, at: Date = new Date()): ModelPrice | null {
// A Codex Fast row (`gpt-5.5+priority`) costs what its base model costs; the usage row keeps the full id.
- const model = turn.driverKind === "codex" ? codexTierOf(turn.model)?.model ?? turn.model : turn.model;
+ const model = turn.driverKind === "codex" ? codexTierOf(turn.model)?.model ?? turn.model
+ : turn.driverKind === "antigravityAgent" ? antigravityRateModel(turn.model) : turn.model;
return operatorPrices?.[`${turn.driverKind}/${turn.model}`] ?? operatorPrices?.[turn.model] ??
operatorPrices?.[`${turn.driverKind}/${model}`] ?? operatorPrices?.[model] ??
listPriceFor(model, at) ?? operatorPrices?.default ?? null;