FFFF feat(prices): add Gemini 4 Carbon rates and Antigravity model mappings by InfinityPacer · Pull Request #77 · InfinityPacer/meterleaf · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/pricing.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ GPT-6.1 Sol 与 Terra 按各自模型页公布的输入、缓存读取、缓存

`codex-auto-review` 没有自己的公布价。OpenAI 把 Codex 的自动评审请求路由到 `gpt-6-luna` 执行,所以这个模型按 luna 的公布费率估值,价格说明里写明了这一路由事实。它是估值的依据说明,不是独立费率条目。

Antigravity 使用的模型同样按官方公开的每百万 token 费率估值,不是 Google AI Ultra 订阅账单。`gemini-4-argon` 与 `gemini-3.8-flash` 采用 Google Gemini API 与 Vertex AI 公布的标准档与 Flex 档价格,按有效日期分段记录促销期与促销结束后的标准费率,官方没有按输入长度分档,未公布按 token 写入单价的缓存写入保留未计价。`claude-opus-5-5` 与 `claude-sonnet-5-5` 使用 Anthropic 官方模型价格,采集器把带思考档位后缀的响应模型名归一到这两个基础模型 ID。`gpt-oss-120b` 采用 Google Cloud Vertex AI Model Garden 公布的 `openai/gpt-oss-120b-maas` 托管价格,该模型未公布缓存读写折扣,含非零缓存读写的记录保留未计价。历史会话中出现的 `claude-opus-4-6-thinking` 是开启思考的 Opus 4.6,思考 token 按输出计价,归一到 `claude-opus-4-6` 并使用其官方费率。
Antigravity 使用的模型同样按官方公开的每百万 token 费率估值,不是 Google AI Ultra 订阅账单。`gemini-4-carbon`、`gemini-4-argon` 与 `gemini-3.8-flash` 采用 Google Gemini API 与 Vertex AI 公布的标准档与 Flex 档价格,按有效日期分段记录促销期与促销结束后的标准费率,官方没有按输入长度分档,未公布按 token 写入单价的缓存写入保留未计价。`claude-opus-5-5` 与 `claude-sonnet-5-5` 使用 Anthropic 官方模型价格,采集器把带思考档位后缀的响应模型名归一到基础模型 ID(`gemini-4-carbon` 的三档响应名同样归一到 `gemini-4-carbon`)。`gpt-oss-120b` 采用 Google Cloud Vertex AI Model Garden 公布的 `openai/gpt-oss-120b-maas` 托管价格,该模型未公布缓存读写折扣,含非零缓存读写的记录保留未计价。历史会话中出现的 `claude-opus-4-6-thinking` 是开启思考的 Opus 4.6,思考 token 按输出计价,归一到 `claude-opus-4-6` 并使用其官方费率。

未配置的模型不会自动别名到其他模型。网关参考价不是已核实的官方报价,也不能用于推导订阅 Credits。图像与实时模型需要相应媒体 Token 分桶,不能用文本四桶冒充完整费用。

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "meterleaf",
"version": "0.16.4",
"version": "0.16.5",
"private": true,
"type": "module",
"license": "Apache-2.0",
Expand Down
128 changes: 126 additions & 2 deletions prices/meterleaf-2026-10-30.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"schemaVersion": 1,
"id": "meterleaf",
"supersedes": ["meterleaf-openai"],
"version": "2026-10-30.2",
"version": "2026-10-30.3",
"publishedAt": "2026-10-30T00:00:00Z",
"unit": "per_million_tokens",
"sources": [
Expand Down Expand Up @@ -48,7 +48,7 @@
"GPT-6.1 Sol and Terra Credits use the Codex token rate card (Standard speed). Fast mode credits are 2x Standard; Ultrafast rates are not configured for text tiers.",
"Codex records carry no cache TTL split, so GPT-6.1 Terra cache writes use the published 30-minute-retention price; the steeper 12-hour price is not configured separately.",
"codex-auto-review is not published with its own prices. OpenAI routes Codex automatic reviews to gpt-6-luna, so codex-auto-review usage is estimated with luna published rates. This is an estimate of the routed model, not a distinct price list entry.",
"Gemini 4 Argon and Gemini 3.8 Flash use the text rates published on the Gemini API and Vertex AI pricing pages. Both models include the full 1M context window at a single rate with no long-context surcharge, and have no published per-token cache-write rate (context caching storage is billed per hour out of band). Promotional pricing applies through 2026-11-30 for Gemini 4 Argon ($2/$0.10/$10 Standard, $1/$0.05/$5 Flex) and through 2026-12-31 for Gemini 3.8 Flash ($0.75/$0.075/$3.75 Standard, $0.375/$0.0375/$1.875 Flex), with post-promotion rates taking effect on 2026-12-01 and 2027-01-01 respectively.",
"Gemini 4 Carbon, Gemini 4 Argon and Gemini 3.8 Flash use the text rates published on the Gemini API and Vertex AI pricing pages. All three models include the full 1M context window at a single rate with no long-context surcharge, and have no published per-token cache-write rate (context caching storage is billed per hour out of band). Promotional pricing applies through 2026-11-30 for Gemini 4 Carbon and Gemini 4 Argon ($2/$0.10/$10 Standard, $1/$0.05/$5 Flex) and through 2026-12-31 for Gemini 3.8 Flash ($0.75/$0.075/$3.75 Standard, $0.375/$0.0375/$1.875 Flex), with post-promotion rates taking effect on 2026-12-01 and 2027-01-01 respectively.",
"Claude Sonnet 5.5 uses the published Claude API rates ($2 input, $0.10 cache read at 5% of base input, $2.50 5-minute cache write, $4 1-hour cache write, $10 output), with the full 1M context window at standard prices and no published fast tier.",
"GPT-OSS 120B (openai/gpt-oss-120b-maas on Vertex AI Model Garden) uses the per-token rates published on Google Cloud Model Garden partner models pricing ($0.09 input, $0.36 output). Cache read and cache write rates are not published for this model and remain null."
],
Expand Down Expand Up @@ -2115,6 +2115,130 @@
"output": "10"
}
},
{
"model": "gemini-4-carbon",
"effectiveFrom": "1970-01-01T00:00:00Z",
"effectiveUntil": "2026-12-01T00:00:00Z",
"promotion": {
"description": "Promotional pricing published on Gemini API and Vertex AI pricing pages through November 30, 2026.",
"confirmedThrough": "2026-11-30"
},
"currency": "usd",
"usdBasis": "subscription",
"tier": "standard",
"rates": {
"input": "2",
"cacheRead": "0.1",
"cacheWrite": null,
"output": "10"
}
},
{
"model": "gemini-4-carbon",
"effectiveFrom": "1970-01-01T00:00:00Z",
"effectiveUntil": "2026-12-01T00:00:00Z",
"promotion": {
"description": "Promotional pricing published on Gemini API and Vertex AI pricing pages through November 30, 2026.",
"confirmedThrough": "2026-11-30"
},
"currency": "usd",
"usdBasis": "api",
"tier": "standard",
"rates": {
"input": "2",
"cacheRead": "0.1",
"cacheWrite": null,
"output": "10"
}
},
{
"model": "gemini-4-carbon",
"effectiveFrom": "1970-01-01T00:00:00Z",
"effectiveUntil": "2026-12-01T00:00:00Z",
"promotion": {
"description": "Promotional pricing published on Gemini API and Vertex AI pricing pages through November 30, 2026.",
"confirmedThrough": "2026-11-30"
},
"currency": "usd",
"usdBasis": "subscription",
"tier": "flex",
"rates": {
"input": "1",
"cacheRead": "0.05",
"cacheWrite": null,
"output": "5"
}
},
{
"model": "gemini-4-carbon",
"effectiveFrom": "1970-01-01T00:00:00Z",
"effectiveUntil": "2026-12-01T00:00:00Z",
"promotion": {
"description": "Promotional pricing published on Gemini API and Vertex AI pricing pages through November 30, 2026.",
"confirmedThrough": "2026-11-30"
},
"currency": "usd",
"usdBasis": "api",
"tier": "flex",
"rates": {
"input": "1",
"cacheRead": "0.05",
"cacheWrite": null,
"output": "5"
}
},
{
"model": "gemini-4-carbon",
"effectiveFrom": "2026-12-01T00:00:00Z",
"currency": "usd",
"usdBasis": "subscription",
"tier": "standard",
"rates": {
"input": "4",
"cacheRead": "0.2",
"cacheWrite": null,
"output": "20"
}
},
{
"model": "gemini-4-carbon",
"effectiveFrom": "2026-12-01T00:00:00Z",
"currency": "usd",
"usdBasis": "api",
"tier": "standard",
"rates": {
"input": "4",
"cacheRead": "0.2",
"cacheWrite": null,
"output": "20"
}
},
{
"model": "gemini-4-carbon",
"effectiveFrom": "2026-12-01T00:00:00Z",
"currency": "usd",
"usdBasis": "subscription",
"tier": "flex",
"rates": {
"input": "2",
"cacheRead": "0.1",
"cacheWrite": null,
"output": "10"
}
},
{
"model": "gemini-4-carbon",
"effectiveFrom": "2026-12-01T00:00:00Z",
"currency": "usd",
"usdBasis": "api",
"tier": "flex",
"rates": {
"input": "2",
"cacheRead": "0.1",
"cacheWrite": null,
"output": "10"
}
},
{
"model": "gemini-4-argon",
"effectiveFrom": "1970-01-01T00:00:00Z",
Expand Down
7 changes: 7 additions & 0 deletions src/collector/agy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -657,9 +657,16 @@ const enumModels: Record<number, { model: string; effort?: string }> = {
1045: { model: "claude-sonnet-5-5", effort: "low" },
1046: { model: "claude-sonnet-5-5", effort: "medium" },
1047: { model: "claude-sonnet-5-5", effort: "high" },
1417: { model: "gemini-4-argon", effort: "high" },
1418: { model: "gemini-4-argon", effort: "medium" },
1419: { model: "gemini-4-argon", effort: "low" },
1427: { model: "gemini-4-carbon", effort: "high" },
1437: { model: "gemini-4-carbon", effort: "medium" },
1438: { model: "gemini-4-carbon", effort: "low" },
};

const displayModels: Record<string, string> = {
"gemini 4 carbon": "gemini-4-carbon",
"gemini 4 argon": "gemini-4-argon",
"gemini 3.8 flash": "gemini-3.8-flash",
"claude opus 5.5": "claude-opus-5-5",
Expand Down
40 changes: 39 additions & 1 deletion tests/collector-agy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,39 @@ test("decodeAgyGenMetadata decodes wire fields, mutually exclusive buckets, and
});

test("normalizeAgyModel maps all Antigravity models and prices them through defaultPriceBook", () => {
expect(
normalizeAgyModel({
responseModel: "gemini-4-carbon-medium",
modelDisplayName: "Gemini 4 Carbon (Medium)",
modelEnum: 1437,
}),
).toEqual({
model: "gemini-4-carbon",
upstreamModel: "gemini-4-carbon-medium",
reasoningEffort: "medium",
});
expect(
normalizeAgyModel({
responseModel: null,
modelDisplayName: "Gemini 4 Carbon (High)",
modelEnum: null,
}),
).toEqual({
model: "gemini-4-carbon",
upstreamModel: null,
reasoningEffort: "high",
});
expect(
normalizeAgyModel({
responseModel: null,
modelDisplayName: null,
modelEnum: 1438,
}),
).toEqual({
model: "gemini-4-carbon",
upstreamModel: null,
reasoningEffort: "low",
});
expect(
normalizeAgyModel({
responseModel: "gemini-4-argon",
Expand Down Expand Up @@ -495,7 +528,11 @@ test("normalizeAgyModel maps all Antigravity models and prices them through defa
// 合并后的账户里,Gemini 池窗口只计 Gemini 模型,第三方池窗口只计其余模型。
const gemini = quotaModelScope("seven-day", true)!;
const thirdParty = quotaModelScope("seven-day-3p")!;
for (const model of ["gemini-4-argon", "gemini-3.8-flash"]) {
for (const model of [
"gemini-4-carbon",
"gemini-4-argon",
"gemini-3.8-flash",
]) {
expect([gemini(model), thirdParty(model)]).toEqual([true, false]);
}
for (const model of [
Expand All @@ -509,6 +546,7 @@ test("normalizeAgyModel maps all Antigravity models and prices them through defa
expect(quotaModelScope("seven-day")).toBeNull();

for (const model of [
"gemini-4-carbon",
"gemini-4-argon",
"gemini-3.8-flash",
"claude-opus-5-5",
Expand Down
25 changes: 24 additions & 1 deletion tests/price-book.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ test("bundled JSON contains separate USD branches with unchanged credits", () =>
expect(api.usd.amount).toBe("6.075");
expect(subscription.credits).toEqual(api.credits);
expect(subscription.apiUsd).toEqual(api.apiUsd);
expect(subscription.version).toBe("meterleaf@2026-10-30.2");
expect(subscription.version).toBe("meterleaf@2026-10-30.3");
// 0.2 及更早版本的价格表标识为 meterleaf-openai,接替关系让报表缓存跨升级保留。
expect(defaultPriceBook.supersedes).toEqual(["meterleaf-openai"]);
});
Expand Down Expand Up @@ -477,6 +477,29 @@ test("Antigravity models use their published Google, Anthropic and Model Garden
},
};

// Gemini 4 Carbon: 促销期至 2026-11-30($2 / $0.10 / $10),2026-12-01 起($4 / $0.20 / $20)。
for (const model of ["gemini-4-carbon", "gemini-4-argon"] as const) {
const promo = valueUsage({ ...baseFact, model }, defaultPriceBook);
expect(promo.subscriptionUsd.amount).toBe("12.1");
expect(promo.apiUsd.amount).toBe("12.1");
expect(
valueUsage({ ...baseFact, model, tier: "flex" }, defaultPriceBook)
.subscriptionUsd.amount,
).toBe("6.05");
const postPromo = valueUsage(
{ ...baseFact, model, occurredAt: "2026-12-01T00:00:00Z" },
defaultPriceBook,
);
expect(postPromo.subscriptionUsd.amount).toBe("24.2");
expect(postPromo.apiUsd.amount).toBe("24.2");
expect(
valueUsage(
{ ...baseFact, model, tokens: { ...baseFact.tokens, cacheWrite: 1 } },
defaultPriceBook,
).usd.reason,
).toBe("unsupported-rate-bucket");
}

// Gemini 4 Argon: 促销期至 2026-11-30($2 / $0.10 / $10),2026-12-01 起($4 / $0.20 / $20)。
const argonPromo = valueUsage(
{ ...baseFact, model: "gemini-4-argon" },
Expand Down
Loading
0