Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
fix(usage): price Antigravity's Gemini 4 Neon/Hydrogen, Claude Thinking and GPT-OSS models (MUL-9875) (#11211)
Jiayuan Zhang27dea952b9ae
diff --git a/packages/views/runtimes/utils.test.ts b/packages/views/runtimes/utils.test.tsindex 1207bc6b04..c5071cda57 100644--- a/packages/views/runtimes/utils.test.ts+++ b/packages/views/runtimes/utils.test.ts@@ -424,6 +424,8 @@ describe("estimateCost", () => {it("prices published Gemini token SKUs at standard rates in every bucket", () => {const cases = [+ { model: "gemini-4-neon", input: 3, output: 15, cacheRead: 0.15, cacheWrite: 3 },+ { model: "gemini-4-hydrogen", input: 1.5, output: 7.5, cacheRead: 0.075, cacheWrite: 1.5 },{ model: "gemini-4-argon", input: 2, output: 10, cacheRead: 0.1, cacheWrite: 2 },{ model: "gemini-4-carbon", input: 2, output: 10, cacheRead: 0.1, cacheWrite: 2 },{ model: "gemini-3.8-flash", input: 0.75, output: 3.75, cacheRead: 0.075, cacheWrite: 0.75 },@@ -476,9 +478,11 @@ describe("estimateCost", () => {["Gemini 3.1 Pro", "gemini-3.1-pro", 2],["Gemini 4 Argon", "gemini-4-argon", 2],["Gemini 4 Carbon", "gemini-4-carbon", 2],+ ["Gemini 4 Neon", "gemini-4-neon", 3],+ ["Gemini 4 Hydrogen", "gemini-4-hydrogen", 1.5],] as const) {- for (const model of [label, `${label} (High)`, `google/${label} (Low)`,- `${id}-minimal`, `antigravity:${id}-high`, `custom:google/${id}-low[1m]`]) {+ for (const model of [label, `${label} (High)`, `google/${label} (Low)`, `${label} (Extra)`,+ `${id}-minimal`, `${id}-xhigh`, `antigravity:${id}-high`, `custom:google/${id}-low[1m]`]) {expect(isModelPriced(model, "antigravity"), model).toBe(true);expect(estimateCost({ ...zeroUsage, provider: "antigravity", model, input_tokens: 1_000_000 }), model).toBeCloseTo(price, 5);}@@ -486,9 +490,9 @@ describe("estimateCost", () => {});it("resolves Antigravity Claude effort suffixes and display labels at the base tier", () => {- // Antigravity appends the reasoning effort to Claude ids- // (`claude-opus-5-5-high`) or reports the display label. Effort is a- // reasoning dial, not a different SKU, so both price at the base model's+ // Antigravity appends the reasoning effort or Thinking mode to Claude ids+ // (`claude-opus-5-5-high`) or reports the display label. Both are a+ // reasoning dial, not a different SKU, so they price at the base model's// tier — but only under the antigravity provider (the scoping stays// pinned by "keeps Cursor variant stripping scoped to Cursor rows"),// mirroring priceForAntigravityModel in server/internal/metrics/pricing.go.@@ -499,10 +503,13 @@ describe("estimateCost", () => {cache_read_tokens: 1_000_000, cache_write_tokens: 1_000_000,});const opus55 = 4 + 20 + 0.2 + 5;+ const sonnet55 = 2 + 10 + 0.1 + 2.5;+ const opus46 = 5 + 25 + 0.5 + 6.25;+ const sonnet46 = 3 + 15 + 0.3 + 3.75;for (const [model, want] of [["claude-opus-5-5-high", opus55],["claude-opus-5-5-medium", opus55],- ["claude-sonnet-5-5-low", 2 + 10 + 0.1 + 2.5],+ ["claude-sonnet-5-5-low", sonnet55],["claude-haiku-5-5-minimal", 0.1 + 0.5 + 0.01 + 0.125],["claude-opus-5-5-high[1m]", opus55],["claude-opus-5.5-high", opus55],@@ -510,6 +517,13 @@ describe("estimateCost", () => {["antigravity:claude-opus-5-5-high", opus55],["Claude Opus 5.5 (High)", opus55],["Claude Opus 5.5", opus55],+ ["claude-opus-5-5-thinking", opus55],+ ["Claude Opus 5.5 (Thinking)", opus55],+ ["Claude Sonnet 5.5 (Thinking)", sonnet55],+ ["claude-sonnet-5-5-thinking", sonnet55],+ ["Claude Opus 4.6 (Thinking)", opus46],+ ["claude-opus-4-6-thinking", opus46],+ ["Claude Sonnet 4.6 (Thinking)", sonnet46],] as const) {expect(isModelPriced(model, "antigravity"), model).toBe(true);expect(cost(model), model).toBeCloseTo(want, 5);@@ -517,13 +531,14 @@ describe("estimateCost", () => {expect(collectUnmappedModels([{ ...zeroUsage, provider: "antigravity", model: "claude-opus-5-5-high", input_tokens: 1 },{ ...zeroUsage, provider: "antigravity", model: "Claude Sonnet 5.5 (Medium)", input_tokens: 1 },+ { ...zeroUsage, provider: "antigravity", model: "Claude Opus 5.5 (Thinking)", input_tokens: 1 },])).toEqual([]);- // Only the four effort levels Antigravity supports are stripped, the+ // Only the levels Antigravity offers for Claude are stripped, the// version is a major or major.minor number, and one context tag at most;// everything else stays unmapped.for (const model of ["claude-opus-5-5-fast", "claude-opus-5-5-max", "claude-opus-5-5-xhigh",- "claude-opus-5-5-thinking", "claude-opus-5-5-preview",+ "claude-opus-5-5-thinking-high", "Claude Opus 5.5 (Extra)", "claude-opus-5-5-preview","claude-opus-5-5-99-high", "claude-opus-5-5-20261001-high","claude-opus-5-5-high-latest", "/claude-opus-5-5-high","claude-opus-5-5[]", "claude-opus-5-5-high[1m][2m]",@@ -533,6 +548,39 @@ describe("estimateCost", () => {}});+ it("prices Antigravity GPT-OSS 120B at Vertex AI's rate, scoped to Antigravity", () => {+ const cost = (model: string, provider?: string) =>+ estimateCost({+ ...zeroUsage, provider, model,+ input_tokens: 1_000_000, output_tokens: 1_000_000,+ cache_read_tokens: 1_000_000, cache_write_tokens: 1_000_000,+ });+ for (const model of [+ "GPT-OSS 120B (Medium)", "GPT-OSS 120B", "gpt-oss-120b", "gpt-oss-120b-medium",+ "gpt-oss-120b-high[1m]", "openai/gpt-oss-120b",+ ]) {+ expect(isModelPriced(model, "antigravity"), model).toBe(true);+ expect(cost(model, "antigravity"), model).toBeCloseTo(0.09 + 0.36 + 0.09 + 0.09, 5);+ }+ expect(collectUnmappedModels([+ { ...zeroUsage, provider: "antigravity", model: "GPT-OSS 120B (Medium)", input_tokens: 1 },+ ])).toEqual([]);+ // Orchestrator splits a turn between a planner and an executor model, so+ // no single rate fits; other gpt-oss sizes and variants are not guessed.+ for (const model of [+ "gpt-oss-20b", "GPT-OSS 20B (Medium)", "gpt-oss-120b-xhigh", "gpt-oss-120b-preview",+ "GPT-OSS 120B (Turbo)", "gpt-oss-120b[1m][2m]",+ "Orchestrator (Neon)", "Orchestrator (Carbon)", "gemini-pro-orchestrator",+ ]) {+ expect(isModelPriced(model, "antigravity"), model).toBe(false);+ expect(cost(model, "antigravity"), model).toBe(0);+ }+ // Other runtimes reach gpt-oss through hosts with their own rates.+ for (const provider of [undefined, "opencode", "cursor"]) {+ expect(isModelPriced("gpt-oss-120b", provider), String(provider)).toBe(false);+ }+ });+it("does not guess Gemini variant or multimodal generation prices", () => {for (const model of ["gemini-3.8-flash-lite",@@ -563,6 +611,14 @@ describe("estimateCost", () => {"gemini-4-carbon-fast","gemini-4-carbon[1m][2m]","gemini-4-argon[1m][2m]",+ "gemini-4-neon-fast",+ "gemini-4-neon-max",+ "gemini-4-neon-extra",+ "gemini-4-neon[1m][2m]",+ "gemini-4-hydrogen-fast",+ "Gemini 4 Neon (Ultra)",+ "Gemini 4 Hydrogen (Xhigh)",+ "Gemini 4 Neon Medium",]) {expect(isModelPriced(model, "antigravity"), model).toBe(false);expect(estimateCost({ ...zeroUsage, provider: "antigravity", model, input_tokens: 1_000_000 }), model).toBe(0);diff --git a/packages/views/runtimes/utils.ts b/packages/views/runtimes/utils.tsindex cdba446937..8751440539 100644--- a/packages/views/runtimes/utils.ts+++ b/packages/views/runtimes/utils.ts@@ -297,7 +297,8 @@ const MODEL_PRICING: Record<"gpt-5.4": { input: 2.50, output: 15, cacheRead: 0.25, cacheWrite: 2.50 },"gpt-5.3-codex": { input: 1.75, output: 14, cacheRead: 0.175, cacheWrite: 1.75 },- // -- Google: https://ai.google.dev/gemini-api/docs/pricing (2026-10-19).+ // -- Google: https://ai.google.dev/gemini-api/docs/pricing (2026-10-19;+ // Gemini 4 Neon and Hydrogen 2026-11-23).// Standard API-equivalent token estimates, not subscription charges.// Argon's intro rate ends 2026-11-30; Flash 3.6/3.8, Robotics and// 3.8 TTS promotions end 2026-12-31. Update the static rows at expiry.@@ -310,6 +311,8 @@ const MODEL_PRICING: Record<// Speech-only SKUs have one input/output rate; mixed-modality Live,// Image, Omni and Embedding SKUs stay unmapped because aggregate tokens// cannot distinguish their rates. Mirror server/internal/metrics/pricing.go. --+ "gemini-4-neon": { input: 3, output: 15, cacheRead: 0.15, cacheWrite: 3 },+ "gemini-4-hydrogen": { input: 1.5, output: 7.5, cacheRead: 0.075, cacheWrite: 1.5 },"gemini-4-argon": { input: 2, output: 10, cacheRead: 0.1, cacheWrite: 2 },// Gemini 4 Carbon shares Argon's intro rate through 2026-11-30 (checked 2026-11-11)."gemini-4-carbon": { input: 2, output: 10, cacheRead: 0.1, cacheWrite: 2 },@@ -338,6 +341,15 @@ const MODEL_PRICING: Record<"gemini-3.5-transcribe-live": { input: 3.5, output: 21, cacheRead: 0, cacheWrite: 0 },"gemini-3.5-live-translate-preview": { input: 3.5, output: 21, cacheRead: 0, cacheWrite: 0 },+ // -- Antigravity serves GPT-OSS 120B from Google Cloud: Vertex AI's list+ // rate (https://cloud.google.com/model-garden/partner-models/pricing,+ // 2026-11-23), which has no cache-hit rate, so cached tokens bill as+ // input. Provider-qualified because other runtimes reach gpt-oss+ // through hosts with their own rates. Orchestrator stays unmapped: it+ // splits a turn between a planner and an executor model. Mirror+ // server/internal/metrics/pricing.go. --+ "antigravity/gpt-oss-120b": { input: 0.09, output: 0.36, cacheRead: 0.09, cacheWrite: 0.09 },+// -- OpenAI: GPT-5 family (Codex CLI's default is gpt-5-codex; -codex/-mini/-nano variants priced per OpenAI tiers) --"gpt-5-codex": { input: 1.25, output: 10, cacheRead: 0.125, cacheWrite: 1.25 },"gpt-5-mini": { input: 0.25, output: 2, cacheRead: 0.025, cacheWrite: 0.25 },@@ -689,29 +701,35 @@ function cursorPricingCandidates(model: string, canonical: string[]): string[] {return [...new Set([...qualified, `cursor/${base}`, base, ...canonical])];}-// Antigravity labels Claude models with the reasoning effort, as a slug-// suffix (`claude-opus-5-5-high`) or a display label (`Claude Opus 5.5-// (High)`); effort selects reasoning, not a SKU, so both price at the base-// tier like canonGemini, scoped to antigravity — a bare `claude-opus-5-5-high`-// elsewhere stays unmapped; mirrors priceForAntigravityModel in pricing.go.+// Antigravity labels Claude models with the reasoning effort or its Thinking+// mode, as a slug suffix (`claude-opus-5-5-high`, `claude-opus-4-6-thinking`)+// or a display label (`Claude Opus 5.5 (High)`, `Claude Opus 5.5 (Thinking)`);+// both select reasoning, not a SKU, so they price at the base tier like+// canonGemini, scoped to antigravity — a bare `claude-opus-5-5-high`+// elsewhere stays unmapped. GPT-OSS 120B arrives as `GPT-OSS 120B (Medium)`+// or an effort-suffixed slug and resolves to `antigravity/gpt-oss-120b`.+// Mirrors priceForAntigravityModel in pricing.go.const ANTIGRAVITY_CLAUDE_DISPLAY =- /^(?:[a-z][a-z0-9_-]*[/:])*claude (opus|sonnet|haiku|fable) (\d+(?:[.-]\d+)?)(?: \((?:minimal|low|medium|high)\))?$/i;+ /^(?:[a-z][a-z0-9_-]*[/:])*claude (opus|sonnet|haiku|fable) (\d+(?:[.-]\d+)?)(?: \((?:minimal|low|medium|high|thinking)\))?$/i;const ANTIGRAVITY_CLAUDE_EFFORT =- /^(?:[a-z][a-z0-9_-]*[/:])*(claude-(?:opus|sonnet|haiku|fable)-\d+(?:[.-]\d+)?)-(?:minimal|low|medium|high)$/i;+ /^(?:[a-z][a-z0-9_-]*[/:])*(claude-(?:opus|sonnet|haiku|fable)-\d+(?:[.-]\d+)?)-(?:minimal|low|medium|high|thinking)$/i;+const ANTIGRAVITY_GPT_OSS_120B =+ /^(?:[a-z][a-z0-9_-]*[/:])*gpt-oss(?:-120b(?:-(?:low|medium|high))?| 120b(?: \((?:low|medium|high)\))?)$/i;-function antigravityClaudeBase(model: string): string | undefined {+function antigravityBaseModel(model: string): string | undefined {const id = model.trim().replace(/\[[^\]]+\]$/, "");const display = ANTIGRAVITY_CLAUDE_DISPLAY.exec(id);if (display) return `claude-${display[1]}-${display[2]!.replace(/\./g, "-")}`.toLowerCase();const effort = ANTIGRAVITY_CLAUDE_EFFORT.exec(id);- return effort?.[1]?.replace(/\./g, "-").toLowerCase();+ if (effort) return effort[1]!.replace(/\./g, "-").toLowerCase();+ return ANTIGRAVITY_GPT_OSS_120B.test(id) ? "gpt-oss-120b" : undefined;}-// antigravityPricingCandidates appends the Claude base id (one trailing-// context tag tolerated), keeping the qualified-first lookup order.+// antigravityPricingCandidates appends the base id (one trailing context tag+// tolerated), keeping the qualified-first lookup order.function antigravityPricingCandidates(model: string, base: string[], provider: string): string[] {- const claude = antigravityClaudeBase(model);- if (!claude) return [...base.map((c) => qualify(provider, c)), ...base];- return [...base.map((c) => qualify(provider, c)), `${provider}/${claude}`, ...base, claude];+ const resolved = antigravityBaseModel(model);+ if (!resolved) return [...base.map((c) => qualify(provider, c)), ...base];+ return [...base.map((c) => qualify(provider, c)), `${provider}/${resolved}`, ...base, resolved];}// The canonical storage/diagnostic key for a (model, provider) pair: the@@ -818,10 +836,11 @@ function canonicalCandidates(model: string): string[] {// Antigravity's display labels and effort-suffixed IDs refer to the same// Gemini SKU. Match only recognized shapes; never strip arbitrary variants.+ // Neon and Hydrogen add a fourth level: `Extra` in the picker, `xhigh` in ids.const canonGemini = (s: string) => {- const display = /^gemini (\d+(?:\.\d+)?) (flash(?:-lite)?|pro|argon|carbon)(?: \((?:minimal|low|medium|high)\))?$/i.exec(s);+ const display = /^gemini (\d+(?:\.\d+)?) (flash(?:-lite)?|pro|argon|carbon|hydrogen|neon)(?: \((?:minimal|low|medium|high|extra)\))?$/i.exec(s);if (display) return `gemini-${display[1]}-${display[2]}`.toLowerCase();- const slug = /^(gemini-\d+(?:\.\d+)?-(?:flash(?:-lite)?|pro|argon|carbon))(?:-(?:minimal|low|medium|high))?$/i.exec(s);+ const slug = /^(gemini-\d+(?:\.\d+)?-(?:flash(?:-lite)?|pro|argon|carbon|hydrogen|neon))(?:-(?:minimal|low|medium|high|xhigh))?$/i.exec(s);return slug ? slug[1]!.toLowerCase() : s;};diff --git a/server/internal/metrics/cursor_pricing_test.go b/server/internal/metrics/cursor_pricing_test.goindex bf8682fb6b..474c88c818 100644--- a/server/internal/metrics/cursor_pricing_test.go+++ b/server/internal/metrics/cursor_pricing_test.go@@ -102,10 +102,10 @@ func TestPriceForRuntimeModelKeepsCursorParsingScopedToCursor(t *testing.T) {// TestPriceForRuntimeModelAntigravityClaudeEffort pins the Antigravity-scoped// Claude effort fallback: agy reports Claude models with a reasoning-effort-// suffix or a display label (see readAntigravitySelectedModel in-// server/pkg/agent/antigravity.go); effort selects reasoning, not a SKU, so-// the id prices at the base Claude tier. Only the four levels Antigravity-// supports are stripped, the version is a major or major.minor number, and+// or Thinking suffix, or a display label (see readAntigravitySelectedModel in+// server/pkg/agent/antigravity.go); both select reasoning, not a SKU, so the+// id prices at the base Claude tier. Only the levels Antigravity offers for+// Claude are stripped, the version is a major or major.minor number, and// only the antigravity provider gets the rewrite — the non-Antigravity rows// stay pinned unmapped by// TestPriceForRuntimeModelKeepsCursorParsingScopedToCursor. Mirrors the@@ -126,7 +126,16 @@ func TestPriceForRuntimeModelAntigravityClaudeEffort(t *testing.T) {{"antigravity:claude-opus-5-5-high", "anthropic:claude-opus-5-5"},{"Claude Opus 5.5 (High)", "anthropic:claude-opus-5-5"},{"Claude Opus 5.5", "anthropic:claude-opus-5-5"},+ {"claude-opus-5-5-thinking", "anthropic:claude-opus-5-5"},+ {"Claude Opus 5.5 (Thinking)", "anthropic:claude-opus-5-5"},+ {"Claude Sonnet 5.5 (Thinking)", "anthropic:claude-sonnet-5-5"},+ {"claude-sonnet-5-5-thinking", "anthropic:claude-sonnet-5-5"},+ {"Claude Opus 4.6 (Thinking)", "anthropic:claude-opus-4.6"},+ {"claude-opus-4-6-thinking", "anthropic:claude-opus-4.6"},+ {"Claude Sonnet 4.6 (Thinking)", "anthropic:claude-sonnet-4.6"},{"gemini-4-carbon-high", "google:gemini-4-carbon"},+ {"gemini-4-neon-xhigh", "google:gemini-4-neon"},+ {"Gemini 4 Hydrogen (Extra)", "google:gemini-4-hydrogen"},} {want := modelPrices[tc.key]got, ok := PriceForRuntimeModel("antigravity", tc.model)@@ -138,7 +147,8 @@ func TestPriceForRuntimeModelAntigravityClaudeEffort(t *testing.T) {"claude-opus-5-5-fast","claude-opus-5-5-max","claude-opus-5-5-xhigh",- "claude-opus-5-5-thinking",+ "claude-opus-5-5-thinking-high",+ "Claude Opus 5.5 (Extra)","claude-opus-5-5-preview","claude-opus-5-5-99-high","claude-opus-5-5-20261001-high",@@ -155,7 +165,49 @@ func TestPriceForRuntimeModelAntigravityClaudeEffort(t *testing.T) {// The Claude effort fallback must not leak beyond the antigravity// provider; provider="claude" is pinned by// TestPriceForRuntimeModelKeepsCursorParsingScopedToCursor.- if got, ok := PriceForRuntimeModel("", "claude-opus-5-5-high"); ok {- t.Errorf("PriceForRuntimeModel(\"\", claude-opus-5-5-high) = %+v; want unmapped", got)+ for _, model := range []string{"claude-opus-5-5-high", "Claude Opus 5.5 (Thinking)"} {+ if got, ok := PriceForRuntimeModel("", model); ok {+ t.Errorf("PriceForRuntimeModel(\"\", %q) = %+v; want unmapped", model, got)+ }+ }+}++// TestPriceForRuntimeModelAntigravityGPTOSS pins GPT-OSS 120B on Antigravity+// to Vertex AI's rate, and keeps that rate from leaking to other runtimes,+// which reach gpt-oss through hosts with different prices. Orchestrator+// splits a turn across two models, so it stays unmapped.+func TestPriceForRuntimeModelAntigravityGPTOSS(t *testing.T) {+ want := ModelPrice{Provider: "google", Model: "gpt-oss-120b", InputPerM: 0.09, CacheReadPerM: 0.09, CacheWritePerM: 0.09, OutputPerM: 0.36}+ for _, model := range []string{+ "GPT-OSS 120B (Medium)",+ "GPT-OSS 120B",+ "gpt-oss-120b",+ "gpt-oss-120b-medium",+ "gpt-oss-120b-high[1m]",+ "openai/gpt-oss-120b",+ } {+ if got, ok := PriceForRuntimeModel("antigravity", model); !ok || got != want {+ t.Errorf("PriceForRuntimeModel(antigravity, %q) = %+v, %v; want %+v", model, got, ok, want)+ }+ }+ for _, model := range []string{+ "gpt-oss-20b",+ "GPT-OSS 20B (Medium)",+ "gpt-oss-120b-xhigh",+ "gpt-oss-120b-preview",+ "GPT-OSS 120B (Turbo)",+ "gpt-oss-120b[1m][2m]",+ "Orchestrator (Neon)",+ "Orchestrator (Carbon)",+ "gemini-pro-orchestrator",+ } {+ if got, ok := PriceForRuntimeModel("antigravity", model); ok {+ t.Errorf("PriceForRuntimeModel(antigravity, %q) = %+v; want unmapped", model, got)+ }+ }+ for _, provider := range []string{"", "opencode", "cursor"} {+ if got, ok := PriceForRuntimeModel(provider, "gpt-oss-120b"); ok {+ t.Errorf("PriceForRuntimeModel(%q, gpt-oss-120b) = %+v; want unmapped", provider, got)+ }}}diff --git a/server/internal/metrics/gemini_pricing_test.go b/server/internal/metrics/gemini_pricing_test.goindex 6271390048..13e3583dfd 100644--- a/server/internal/metrics/gemini_pricing_test.go+++ b/server/internal/metrics/gemini_pricing_test.go@@ -7,6 +7,8 @@ func TestPriceForModelAliasGemini(t *testing.T) {id stringprice ModelPrice}{+ {"gemini-4-neon", ModelPrice{Provider: "google", Model: "gemini-4-neon", InputPerM: 3, CacheReadPerM: 0.15, CacheWritePerM: 3, OutputPerM: 15}},+ {"gemini-4-hydrogen", ModelPrice{Provider: "google", Model: "gemini-4-hydrogen", InputPerM: 1.5, CacheReadPerM: 0.075, CacheWritePerM: 1.5, OutputPerM: 7.5}},{"gemini-4-argon", ModelPrice{Provider: "google", Model: "gemini-4-argon", InputPerM: 2, CacheReadPerM: 0.1, CacheWritePerM: 2, OutputPerM: 10}},{"gemini-4-carbon", ModelPrice{Provider: "google", Model: "gemini-4-carbon", InputPerM: 2, CacheReadPerM: 0.1, CacheWritePerM: 2, OutputPerM: 10}},{"gemini-3.8-flash", ModelPrice{Provider: "google", Model: "gemini-3.8-flash", InputPerM: 0.75, CacheReadPerM: 0.075, CacheWritePerM: 0.75, OutputPerM: 3.75}},@@ -50,12 +52,14 @@ func TestPriceForModelAliasGemini(t *testing.T) {{"Gemini 3.1 Pro", "gemini-3.1-pro"},{"Gemini 4 Argon", "gemini-4-argon"},{"Gemini 4 Carbon", "gemini-4-carbon"},+ {"Gemini 4 Neon", "gemini-4-neon"},+ {"Gemini 4 Hydrogen", "gemini-4-hydrogen"},} {want, ok := PriceForModelAlias(tc.id)if !ok {t.Fatalf("missing price for %q", tc.id)}- for _, alias := range []string{tc.label, tc.label + " (High)", "google/" + tc.label + " (Low)", tc.id + "-minimal", "antigravity:" + tc.id + "-high", "custom:google/" + tc.id + "-low[1m]"} {+ for _, alias := range []string{tc.label, tc.label + " (High)", "google/" + tc.label + " (Low)", tc.label + " (Extra)", tc.id + "-minimal", tc.id + "-xhigh", "antigravity:" + tc.id + "-high", "custom:google/" + tc.id + "-low[1m]"} {if got, ok := PriceForModelAlias(alias); !ok || got != want {t.Errorf("display/effort alias %q = %+v, %v; want %+v", alias, got, ok, want)}@@ -90,6 +94,14 @@ func TestPriceForModelAliasGemini(t *testing.T) {"gemini-4-argon[1m][2m]","gemini-4-carbon-fast","gemini-4-carbon[1m][2m]",+ "gemini-4-neon-fast",+ "gemini-4-neon-max",+ "gemini-4-neon-extra",+ "gemini-4-neon[1m][2m]",+ "gemini-4-hydrogen-fast",+ "Gemini 4 Neon (Ultra)",+ "Gemini 4 Hydrogen (Xhigh)",+ "Gemini 4 Neon Medium",} {if got, ok := PriceForModelAlias(alias); ok {t.Errorf("unknown or multimodal alias %q borrowed a rate: %+v", alias, got)diff --git a/server/internal/metrics/pricing.go b/server/internal/metrics/pricing.goindex a007686dcc..3fac5be27d 100644--- a/server/internal/metrics/pricing.go+++ b/server/internal/metrics/pricing.go@@ -82,7 +82,8 @@ var modelPrices = map[string]ModelPrice{"minimax:m2.7": {Provider: "minimax", Model: "m2.7", InputPerM: 0.30, CacheReadPerM: 0.06, CacheWritePerM: 0.375, OutputPerM: 1.20},"minimax:m2.7-highspeed": {Provider: "minimax", Model: "m2.7-highspeed", InputPerM: 0.60, CacheReadPerM: 0.06, CacheWritePerM: 0.375, OutputPerM: 2.40},// Google standard token prices: ai.google.dev/gemini-api/docs/pricing- // (2026-10-19). Mirror packages/views/runtimes/utils.ts.+ // (2026-10-19; Gemini 4 Neon and Hydrogen 2026-11-23). Mirror+ // packages/views/runtimes/utils.ts.// Argon's intro rate expires 2026-11-30; Flash 3.6/3.8, Robotics and// 3.8 TTS promotions expire 2026-12-31. Update these static rows at expiry.// As documented at ai.google.dev/gemini-api/docs/deprecations, 3.5 Flash@@ -93,6 +94,8 @@ var modelPrices = map[string]ModelPrice{// buckets are 0. Speech-only SKUs have a fixed rate per input/output bucket.// Mixed-modality Live/Image/Omni/Embedding, grounding and hourly cache// storage cannot be inferred from these token totals.+ "google:gemini-4-neon": {Provider: "google", Model: "gemini-4-neon", InputPerM: 3, CacheReadPerM: 0.15, CacheWritePerM: 3, OutputPerM: 15},+ "google:gemini-4-hydrogen": {Provider: "google", Model: "gemini-4-hydrogen", InputPerM: 1.5, CacheReadPerM: 0.075, CacheWritePerM: 1.5, OutputPerM: 7.5},"google:gemini-4-argon": {Provider: "google", Model: "gemini-4-argon", InputPerM: 2, CacheReadPerM: 0.1, CacheWritePerM: 2, OutputPerM: 10},"google:gemini-4-carbon": {Provider: "google", Model: "gemini-4-carbon", InputPerM: 2, CacheReadPerM: 0.1, CacheWritePerM: 2, OutputPerM: 10}, // shares Argon's intro rate through 2026-11-30 (checked 2026-11-11)"google:gemini-3.8-flash": {Provider: "google", Model: "gemini-3.8-flash", InputPerM: 0.75, CacheReadPerM: 0.075, CacheWritePerM: 0.75, OutputPerM: 3.75},@@ -255,6 +258,8 @@ var modelAliasRules = []struct {{regexp.MustCompile(`minimax-m2[.]7`), "minimax:m2.7"},// Each Gemini SKU is exact: an image/audio/preview variant must never// inherit the nearest text model rate. Known efforts normalize below.+ {regexp.MustCompile(`(^|/|:)gemini-4-neon$`), "google:gemini-4-neon"},+ {regexp.MustCompile(`(^|/|:)gemini-4-hydrogen$`), "google:gemini-4-hydrogen"},{regexp.MustCompile(`(^|/|:)gemini-4-argon$`), "google:gemini-4-argon"},{regexp.MustCompile(`(^|/|:)gemini-4-carbon$`), "google:gemini-4-carbon"},{regexp.MustCompile(`(^|/|:)gemini-3\.8-flash$`), "google:gemini-3.8-flash"},@@ -331,17 +336,33 @@ var contextTagRe = regexp.MustCompile(`\[[^\]]+\]$`)// Antigravity reports a display label or an effort-suffixed model ID. Effort// selects reasoning, not a different SKU. Only strip known effort spellings;// unknown variants must remain unpriced instead of borrowing a family's rate.-var geminiDisplayNameRe = regexp.MustCompile(`(^|/|:)gemini ([0-9]+(?:\.[0-9]+)?) (flash(?:-lite)?|pro|argon|carbon)(?: \((?:minimal|low|medium|high)\))?$`)-var geminiEffortSuffixRe = regexp.MustCompile(`((?:^|/|:)gemini-[0-9]+(?:\.[0-9]+)?-(?:flash(?:-lite)?|pro|argon|carbon))-(?:minimal|low|medium|high)$`)+// Neon and Hydrogen add a fourth level, labeled `Extra` in the picker and+// `xhigh` in catalog ids (`gemini-4-neon-xhigh`).+var geminiDisplayNameRe = regexp.MustCompile(`(^|/|:)gemini ([0-9]+(?:\.[0-9]+)?) (flash(?:-lite)?|pro|argon|carbon|hydrogen|neon)(?: \((?:minimal|low|medium|high|extra)\))?$`)+var geminiEffortSuffixRe = regexp.MustCompile(`((?:^|/|:)gemini-[0-9]+(?:\.[0-9]+)?-(?:flash(?:-lite)?|pro|argon|carbon|hydrogen|neon))-(?:minimal|low|medium|high|xhigh)$`)-// Antigravity also labels Claude models with the reasoning effort, as a slug-// suffix (`claude-opus-5-5-high`) or a display label (`Claude Opus 5.5-// (High)`); effort selects reasoning, not a different SKU. Scoped to the-// Antigravity runtime because Cursor ids carry the same suffixes at+// Antigravity also labels Claude models with the reasoning effort or its+// Thinking mode, as a slug suffix (`claude-opus-5-5-high`,+// `claude-opus-4-6-thinking`) or a display label (`Claude Opus 5.5 (High)`,+// `Claude Opus 5.5 (Thinking)`). Both select reasoning, not a different SKU:+// Anthropic bills thinking tokens as output at the model's own rate. Scoped+// to the Antigravity runtime because Cursor ids carry the same suffixes at// Cursor-specific rates and a bare `claude-opus-5-5-high` elsewhere stays// unmapped. Mirrors pricingCandidates in packages/views/runtimes/utils.ts.-var antigravityClaudeDisplayRe = regexp.MustCompile(`^(?:[a-z][a-z0-9_-]*[/:])*claude (opus|sonnet|haiku|fable) ([0-9]+(?:[.-][0-9]+)?)(?: \((?:minimal|low|medium|high)\))?$`)-var antigravityClaudeEffortRe = regexp.MustCompile(`^(?:[a-z][a-z0-9_-]*[/:])*(claude-(?:opus|sonnet|haiku|fable)-[0-9]+(?:[.-][0-9]+)?)-(?:minimal|low|medium|high)$`)+var antigravityClaudeDisplayRe = regexp.MustCompile(`^(?:[a-z][a-z0-9_-]*[/:])*claude (opus|sonnet|haiku|fable) ([0-9]+(?:[.-][0-9]+)?)(?: \((?:minimal|low|medium|high|thinking)\))?$`)+var antigravityClaudeEffortRe = regexp.MustCompile(`^(?:[a-z][a-z0-9_-]*[/:])*(claude-(?:opus|sonnet|haiku|fable)-[0-9]+(?:[.-][0-9]+)?)-(?:minimal|low|medium|high|thinking)$`)++// Antigravity serves GPT-OSS 120B (`GPT-OSS 120B (Medium)`) from Google+// Cloud, so it prices at Vertex AI's gpt-oss-120b list rate+// (cloud.google.com/model-garden/partner-models/pricing, 2026-11-23), which+// publishes no cache-hit rate: cached tokens bill as input. Scoped to+// Antigravity because other runtimes reach gpt-oss through hosts with their+// own rates. Orchestrator (`Orchestrator (Neon)`, `gemini-pro-orchestrator`)+// stays unmapped: it splits a turn between a planner and an executor model,+// so no single rate fits its aggregated usage.+var antigravityGPTOSS120BRe = regexp.MustCompile(`^(?:[a-z][a-z0-9_-]*[/:])*gpt-oss(?:-120b(?:-(?:low|medium|high))?| 120b(?: \((?:low|medium|high)\))?)$`)++var antigravityGPTOSS120BPrice = ModelPrice{Provider: "google", Model: "gpt-oss-120b", InputPerM: 0.09, CacheReadPerM: 0.09, CacheWritePerM: 0.09, OutputPerM: 0.36}func matchModelAlias(model string) (ModelPrice, bool) {model = geminiDisplayNameRe.ReplaceAllString(model, "${1}gemini-${2}-${3}")@@ -408,8 +429,9 @@ func PriceForModelAlias(model string) (ModelPrice, bool) {}// priceForAntigravityModel prices usage reported by the Antigravity runtime:-// after the general resolver misses, retry the Claude effort/display forms.-// One trailing context tag is the same SKU; the `$` anchor rejects a second.+// after the general resolver misses, retry the Claude effort/display forms,+// then GPT-OSS 120B. One trailing context tag is the same SKU; the `$` anchor+// rejects a second.func priceForAntigravityModel(model string) (ModelPrice, bool) {if price, ok := PriceForModelAlias(model); ok {return price, true@@ -421,6 +443,9 @@ func priceForAntigravityModel(model string) (ModelPrice, bool) {if m := antigravityClaudeEffortRe.FindStringSubmatch(s); m != nil {return PriceForModelAlias(strings.ReplaceAll(m[1], ".", "-"))}+ if antigravityGPTOSS120BRe.MatchString(s) {+ return antigravityGPTOSS120BPrice, true+ }return ModelPrice{}, false}