mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-11-21 15:05:56 +00:00
fix(pricing): price Vertex Gemini 3 Flash, 2.5 Pro and 2.5 Flash Lite at their own rates
The new vertex default rows copied Pro rates onto gemini-3-flash-preview ($2/$12 instead of $0.50/$3), used a flat $2/$12 for gemini-2.5-pro (Google bills $1.25/$10 up to 200K prompt tokens and $2.50/$15 above), and set the 2.5 Flash Lite cached-input rate to $0.025 instead of $0.01. Add the long_context tier for 2.5 Pro and a test that pins the rows.
This commit is contained in:
@@ -335,12 +335,14 @@ export const DEFAULT_PRICING_FRONTIER = {
|
||||
reasoning: 18.0,
|
||||
cache_creation: 2.0,
|
||||
},
|
||||
// Gemini 3 Flash is a Flash-tier model: $0.50 in / $3 out (thinking billed as output) /
|
||||
// $0.05 cached (https://cloud.google.com/vertex-ai/generative-ai/pricing).
|
||||
"gemini-3-flash-preview": {
|
||||
input: 2.0,
|
||||
output: 12.0,
|
||||
cached: 0.25,
|
||||
reasoning: 18.0,
|
||||
cache_creation: 2.0,
|
||||
input: 0.5,
|
||||
output: 3.0,
|
||||
cached: 0.05,
|
||||
reasoning: 3.0,
|
||||
cache_creation: 0.5,
|
||||
},
|
||||
"gemini-3.1-pro-preview": {
|
||||
input: 2.0,
|
||||
@@ -349,12 +351,22 @@ export const DEFAULT_PRICING_FRONTIER = {
|
||||
reasoning: 18.0,
|
||||
cache_creation: 2.0,
|
||||
},
|
||||
// Gemini 2.5 Pro: $1.25 in / $10 out / $0.125 cached for prompts up to 200K tokens;
|
||||
// prompts over 200K are billed $2.50 / $15 / $0.25 for the whole request.
|
||||
"gemini-2.5-pro": {
|
||||
input: 2.0,
|
||||
output: 12.0,
|
||||
cached: 0.25,
|
||||
reasoning: 18.0,
|
||||
cache_creation: 2.0,
|
||||
input: 1.25,
|
||||
output: 10.0,
|
||||
cached: 0.125,
|
||||
reasoning: 10.0,
|
||||
cache_creation: 1.25,
|
||||
long_context: {
|
||||
threshold: 200_000,
|
||||
input: 2.5,
|
||||
output: 15.0,
|
||||
cached: 0.25,
|
||||
reasoning: 15.0,
|
||||
cache_creation: 2.5,
|
||||
},
|
||||
},
|
||||
"gemini-2.5-flash": {
|
||||
input: 0.3,
|
||||
@@ -366,7 +378,7 @@ export const DEFAULT_PRICING_FRONTIER = {
|
||||
"gemini-2.5-flash-lite": {
|
||||
input: 0.1,
|
||||
output: 0.4,
|
||||
cached: 0.025,
|
||||
cached: 0.01,
|
||||
reasoning: 0.6,
|
||||
cache_creation: 0.1,
|
||||
},
|
||||
|
||||
@@ -80,6 +80,34 @@ test("remapHistoricalLitellmRows copies historical raw vertex buckets into verte
|
||||
assert.equal(rows.vertex["deepseek-ai/deepseek-v3.1-maas"]?.input, 0.6);
|
||||
});
|
||||
|
||||
test("vertex default rows price Flash and 2.5 tiers at their own rates", async () => {
|
||||
const flash = await getPricingForModel("vertex", "gemini-3-flash-preview");
|
||||
assert.ok(flash);
|
||||
assert.equal(flash.input, 0.5);
|
||||
assert.equal(flash.output, 3);
|
||||
assert.equal(flash.cached, 0.05);
|
||||
|
||||
const flashLite = await getPricingForModel("vertex", "gemini-2.5-flash-lite");
|
||||
assert.ok(flashLite);
|
||||
assert.equal(flashLite.cached, 0.01);
|
||||
|
||||
const proShort = await calculateCostDetailed("vertex", "gemini-2.5-pro", {
|
||||
prompt_tokens: 200_000,
|
||||
completion_tokens: 100_000,
|
||||
});
|
||||
assert.equal(proShort.priced, true);
|
||||
// 200K × $1.25 + 100K × $10 — exactly 200K stays on the base tier.
|
||||
assert.ok(Math.abs(proShort.costUsd - 1.25) < 1e-9, `got ${proShort.costUsd}`);
|
||||
|
||||
const proLong = await calculateCostDetailed("vertex", "gemini-2.5-pro", {
|
||||
prompt_tokens: 300_000,
|
||||
completion_tokens: 100_000,
|
||||
});
|
||||
assert.equal(proLong.priced, true);
|
||||
// Over 200K the whole request moves to $2.50 in / $15 out.
|
||||
assert.ok(Math.abs(proLong.costUsd - 2.25) < 1e-9, `got ${proLong.costUsd}`);
|
||||
});
|
||||
|
||||
test("getPricingForModel resolves vertex gemini-4-argon default and synced prices", async () => {
|
||||
const defaultPricing = await getPricingForModel("vertex", "gemini-4-argon");
|
||||
assert.ok(defaultPricing);
|
||||
|
||||
Reference in New Issue
Block a user