Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
MUL-9221: fix(usage): price Gemini 4 Hydrogen and Carbon on Cursor (#10571)
Jiayuan Zhanga26d19beff5e
diff --git a/packages/views/runtimes/utils.test.ts b/packages/views/runtimes/utils.test.tsindex 24a92dcefe..1207bc6b04 100644--- a/packages/views/runtimes/utils.test.ts+++ b/packages/views/runtimes/utils.test.ts@@ -807,6 +807,10 @@ describe("estimateCost", () => {expect(cost("cursor-grok-4.6-high")).toBeCloseTo(2 + 6 + 0.5, 5);expect(cost("grok-4.7-medium")).toBeCloseTo(2 + 6 + 0.5, 5);expect(cost("gemini-4-argon-medium")).toBeCloseTo(2 + 10 + 0.1, 5);+ expect(cost("gemini-4-hydrogen-high")).toBeCloseTo(1.5 + 7.5 + 0.075, 5);+ expect(cost("gemini-4-hydrogen-xhigh")).toBeCloseTo(1.5 + 7.5 + 0.075, 5);+ // Cursor's post-intro Carbon rate, not the bare row's $2 / $10 intro rate.+ expect(cost("gemini-4-carbon-medium")).toBeCloseTo(4 + 20 + 0.2, 5);expect(cost("muse-wonder-1.0-minimal")).toBeCloseTo(4 + 20 + 0.2, 5);expect(cost("kimi-k3-max")).toBeCloseTo(3 + 15 + 0.3, 5);expect(cost("claude-opus-4-8[context=1m,effort=high,fast=false]")).toBeCloseTo(diff --git a/packages/views/runtimes/utils.ts b/packages/views/runtimes/utils.tsindex 260576a4d6..1c86ad0196 100644--- a/packages/views/runtimes/utils.ts+++ b/packages/views/runtimes/utils.ts@@ -499,8 +499,10 @@ const MODEL_PRICING: Record<// is the bill, so Cursor rows use it even where it differs from the// vendor rows above — except temporary promotional rates, which are not// used: GPT-5.6 Sol keeps its $5 / $30 list rate (Fast at 2x) rather- // than the sheet's promo price. Keys are the Cursor base id- // left by `cursorBaseModel`, which drops the effort / thinking / fast+ // than the sheet's promo price, and Gemini 4 Carbon its $4 / $20 rate+ // from 2026-12-01 rather than the introductory $2 / $10 (the bare+ // gemini-4-carbon row above still carries the intro rate). Keys are the+ // Cursor base id left by `cursorBaseModel`, which drops the effort / thinking / fast// variant parts — effort and thinking don't change per-token rates.// A `-fast` row exists only where a Fast rate is published: on Cursor's// sheet, or (where Cursor offers a Fast variant its sheet doesn't price)@@ -557,6 +559,8 @@ const MODEL_PRICING: Record<"cursor/gpt-5-fast": { input: 2.5, output: 20, cacheRead: 0.25, cacheWrite: 0 },"cursor/gpt-5-mini": { input: 0.25, output: 2, cacheRead: 0.025, cacheWrite: 0 },"cursor/gemini-4-argon": { input: 2, output: 10, cacheRead: 0.1, cacheWrite: 0 },+ "cursor/gemini-4-carbon": { input: 4, output: 20, cacheRead: 0.2, cacheWrite: 0 },+ "cursor/gemini-4-hydrogen": { input: 1.5, output: 7.5, cacheRead: 0.075, cacheWrite: 0 },"cursor/gemini-3.8-flash": { input: 0.75, output: 3.75, cacheRead: 0.075, cacheWrite: 0 },"cursor/gemini-3.7-flash": { input: 0.75, output: 3.75, cacheRead: 0.075, cacheWrite: 0 },// Cursor bills 3.6 / 3.5 Flash above Google's current (promotional /diff --git a/server/internal/metrics/cursor_pricing.go b/server/internal/metrics/cursor_pricing.goindex a2f8ca8599..62195a1930 100644--- a/server/internal/metrics/cursor_pricing.go+++ b/server/internal/metrics/cursor_pricing.go@@ -9,7 +9,9 @@ import (// (cursor.com/docs/models-and-pricing), keyed by the base id cursorBaseModel// leaves. Cursor's sheet is the bill even where it differs from the vendor// rows in modelPrices, except that temporary promotional rates are not used:-// GPT-5.6 Sol keeps its $5 / $30 list rate (Fast at 2x). Where Cursor offers+// GPT-5.6 Sol keeps its $5 / $30 list rate (Fast at 2x), and Gemini 4 Carbon+// its $4 / $20 rate from 2026-12-01 rather than the introductory $2 / $10+// (the google: vendor row still carries the intro rate). Where Cursor offers// a Fast variant its sheet doesn't price, the `-fast` row carries the vendor's// published Fast rate, since Cursor bills third-party models at API list// price; other Fast variants stay unmapped rather than borrowing the cheaper@@ -77,6 +79,8 @@ var cursorModelPrices = buildCursorPrices([]struct {{"gpt-5-fast", 2.5, 20, 0.25, 0},{"gpt-5-mini", 0.25, 2, 0.025, 0},{"gemini-4-argon", 2, 10, 0.1, 0},+ {"gemini-4-carbon", 4, 20, 0.2, 0},+ {"gemini-4-hydrogen", 1.5, 7.5, 0.075, 0},{"gemini-3.8-flash", 0.75, 3.75, 0.075, 0},{"gemini-3.7-flash", 0.75, 3.75, 0.075, 0},{"gemini-3.6-flash", 1.5, 7.5, 0.15, 0},diff --git a/server/internal/metrics/cursor_pricing_test.go b/server/internal/metrics/cursor_pricing_test.goindex f77e4025f3..bf8682fb6b 100644--- a/server/internal/metrics/cursor_pricing_test.go+++ b/server/internal/metrics/cursor_pricing_test.go@@ -58,6 +58,9 @@ func TestPriceForRuntimeModelCursorRates(t *testing.T) {{"gpt-5.5-high-fast", 12.5, 75, 1.25, 0},{"gemini-3.6-flash-high", 1.5, 7.5, 0.15, 0},{"gemini-3.5-flash", 1.5, 9, 0.15, 0},+ {"gemini-4-hydrogen-high", 1.5, 7.5, 0.075, 0},+ {"gemini-4-hydrogen-xhigh", 1.5, 7.5, 0.075, 0},+ {"gemini-4-carbon-medium", 4, 20, 0.2, 0},} {got, ok := PriceForRuntimeModel("cursor", tc.model)if !ok {@@ -76,6 +79,7 @@ func TestPriceForRuntimeModelCursorFastNeverBorrowsStandardRate(t *testing.T) {"claude-sonnet-5[fast=true]","kimi-k3-fast","gemini-4-argon-fast",+ "gemini-4-hydrogen-high-fast",} {if got, ok := PriceForRuntimeModel("cursor", model); ok {t.Errorf("PriceForRuntimeModel(cursor, %q) = %+v; want unmapped", model, got)