@qmediat.io/gemini-code-context-mcp 1.22.0 → 1.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +93 -1
- package/dist/cache/caching-mode.d.ts +2 -2
- package/dist/cache/caching-mode.d.ts.map +1 -1
- package/dist/cache/caching-mode.js +2 -2
- package/dist/cache/caching-mode.js.map +1 -1
- package/dist/gemini/model-registry.d.ts.map +1 -1
- package/dist/gemini/model-registry.js +14 -4
- package/dist/gemini/model-registry.js.map +1 -1
- package/dist/gemini/model-taxonomy.d.ts +8 -0
- package/dist/gemini/model-taxonomy.d.ts.map +1 -1
- package/dist/gemini/model-taxonomy.js +29 -7
- package/dist/gemini/model-taxonomy.js.map +1 -1
- package/dist/tools/ask-agentic.tool.d.ts +11 -61
- package/dist/tools/ask-agentic.tool.d.ts.map +1 -1
- package/dist/tools/ask-agentic.tool.js +18 -15
- package/dist/tools/ask-agentic.tool.js.map +1 -1
- package/dist/tools/ask.tool.d.ts +29 -82
- package/dist/tools/ask.tool.d.ts.map +1 -1
- package/dist/tools/ask.tool.js +7 -5
- package/dist/tools/ask.tool.js.map +1 -1
- package/dist/tools/clear.tool.d.ts +1 -5
- package/dist/tools/clear.tool.d.ts.map +1 -1
- package/dist/tools/code.tool.d.ts +24 -76
- package/dist/tools/code.tool.d.ts.map +1 -1
- package/dist/tools/code.tool.js +11 -5
- package/dist/tools/code.tool.js.map +1 -1
- package/dist/tools/registry.d.ts +11 -11
- package/dist/tools/registry.d.ts.map +1 -1
- package/dist/tools/registry.js +32 -12
- package/dist/tools/registry.js.map +1 -1
- package/dist/tools/reindex.tool.d.ts +1 -7
- package/dist/tools/reindex.tool.d.ts.map +1 -1
- package/dist/tools/shared/abort-timeout.d.ts +6 -0
- package/dist/tools/shared/abort-timeout.d.ts.map +1 -1
- package/dist/tools/shared/abort-timeout.js +12 -5
- package/dist/tools/shared/abort-timeout.js.map +1 -1
- package/dist/tools/shared/thinking.d.ts +25 -3
- package/dist/tools/shared/thinking.d.ts.map +1 -1
- package/dist/tools/shared/thinking.js +25 -3
- package/dist/tools/shared/thinking.js.map +1 -1
- package/dist/tools/status.tool.d.ts +1 -5
- package/dist/tools/status.tool.d.ts.map +1 -1
- package/dist/utils/cost-estimator.d.ts +58 -4
- package/dist/utils/cost-estimator.d.ts.map +1 -1
- package/dist/utils/cost-estimator.js +206 -78
- package/dist/utils/cost-estimator.js.map +1 -1
- package/dist/utils/pricing-overrides.d.ts +10 -0
- package/dist/utils/pricing-overrides.d.ts.map +1 -0
- package/dist/utils/pricing-overrides.js +104 -0
- package/dist/utils/pricing-overrides.js.map +1 -0
- package/package.json +2 -3
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* token budgets or ships a new level, one edit here propagates to both
|
|
9
9
|
* call sites (and any future reasoning-capable tool we add).
|
|
10
10
|
*/
|
|
11
|
+
import { z } from 'zod';
|
|
11
12
|
/**
|
|
12
13
|
* Accepted values for `thinkingLevel` on both `ask` and `code`. Uppercased
|
|
13
14
|
* to match `ThinkingLevel` enum members in `@google/genai` — we pass the
|
|
@@ -24,11 +25,20 @@
|
|
|
24
25
|
* - Gemini 3 Pro supports LOW / MEDIUM / HIGH (not MINIMAL); default HIGH.
|
|
25
26
|
* - Gemini 3 Flash supports all four; Flash-Lite defaults to MINIMAL.
|
|
26
27
|
* - Gemini 2.5 family does NOT support `thinkingLevel` — use `thinkingBudget`.
|
|
27
|
-
*
|
|
28
|
+
* - Gemini 4 Hydrogen adds XHIGH above HIGH (changelog 2026-11-12: low,
|
|
29
|
+
* medium, high — its default — and xhigh).
|
|
30
|
+
* Every tool accepts all five values at the schema boundary and lets Gemini
|
|
28
31
|
* reject unsupported combinations at request time, so the MCP surface stays
|
|
29
32
|
* stable across model rollouts.
|
|
30
33
|
*/
|
|
31
|
-
export const THINKING_LEVELS = ['MINIMAL', 'LOW', 'MEDIUM', 'HIGH'];
|
|
34
|
+
export const THINKING_LEVELS = ['MINIMAL', 'LOW', 'MEDIUM', 'HIGH', 'XHIGH'];
|
|
35
|
+
/** The one description of `thinkingLevel` (`THINKING_LEVEL_FIELD` carries it). */
|
|
36
|
+
const THINKING_LEVEL_DESCRIPTION = "Discrete reasoning tier for Gemini 3 and Gemini 4 models — Google's recommended knob on those (ai.google.dev/gemini-api/docs/gemini-3). Values: `MINIMAL` (Flash-Lite only), `LOW`, `MEDIUM`, `HIGH` (Gemini 3 Pro's default), `XHIGH` (Gemini 4 Hydrogen only — a fast-tier model, which `ask` and `ask_agentic` can run and `code` cannot; Gemini 4 Argon and Carbon answer it with a 400). Gemini 2.5 models do NOT support this — use `thinkingBudget` instead. Mutually exclusive with `thinkingBudget`: passing both returns a validation error before we even hit Gemini (Gemini itself also rejects with 400 'cannot use both thinking_level and the legacy thinking_budget parameter').";
|
|
37
|
+
/** The `thinkingLevel` argument of every tool that takes one (`ask`, `code`, `ask_agentic`): one schema, one text. */
|
|
38
|
+
export const THINKING_LEVEL_FIELD = z
|
|
39
|
+
.enum(THINKING_LEVELS)
|
|
40
|
+
.optional()
|
|
41
|
+
.describe(THINKING_LEVEL_DESCRIPTION);
|
|
32
42
|
/**
|
|
33
43
|
* Conservative per-tier thinking-token reservations for cost estimation.
|
|
34
44
|
*
|
|
@@ -48,7 +58,7 @@ export const THINKING_LEVELS = ['MINIMAL', 'LOW', 'MEDIUM', 'HIGH'];
|
|
|
48
58
|
* decides to spend); a subsequent call will see the larger measured cost
|
|
49
59
|
* in the budget ledger.
|
|
50
60
|
*
|
|
51
|
-
* HIGH intentionally
|
|
61
|
+
* HIGH and XHIGH intentionally map to `null` → call sites substitute
|
|
52
62
|
* `maxOutputTokens - 1024` so the value tracks each tool's actual output
|
|
53
63
|
* cap (8_192 for `ask`, 32_768 for `code`) rather than a hard-coded
|
|
54
64
|
* duplicate.
|
|
@@ -58,5 +68,17 @@ export const THINKING_LEVEL_RESERVE = {
|
|
|
58
68
|
LOW: 2_048,
|
|
59
69
|
MEDIUM: 4_096,
|
|
60
70
|
HIGH: null,
|
|
71
|
+
XHIGH: null,
|
|
61
72
|
};
|
|
73
|
+
/**
|
|
74
|
+
* A call that ended at the output cap with no answer: the model's thinking used the cap (thinking tokens count
|
|
75
|
+
* against `maxOutputTokens`, and Gemini 4 Carbon / Hydrogen and the 3.x Pro models think without being asked).
|
|
76
|
+
* The message names the cause and the remedy; `null` for any call that produced text or stopped for another reason.
|
|
77
|
+
*/
|
|
78
|
+
export function emptyAtOutputCap(response, thinkingTokens) {
|
|
79
|
+
const stopped = response.candidates?.[0]?.finishReason;
|
|
80
|
+
if (response.text.trim() !== '' || stopped !== 'MAX_TOKENS')
|
|
81
|
+
return null;
|
|
82
|
+
return `the model stopped at the output cap before writing an answer (thinking used ${thinkingTokens} tokens of it; the call was billed). Raise \`maxOutputTokens\`, or bound the thinking with \`thinkingLevel: "LOW"\` / a smaller \`thinkingBudget\`.`;
|
|
83
|
+
}
|
|
62
84
|
//# sourceMappingURL=thinking.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thinking.js","sourceRoot":"","sources":["../../../src/tools/shared/thinking.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH
|
|
1
|
+
{"version":3,"file":"thinking.js","sourceRoot":"","sources":["../../../src/tools/shared/thinking.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAU,CAAC;AAEtF,kFAAkF;AAClF,MAAM,0BAA0B,GAC9B,kqBAAkqB,CAAC;AAErqB,sHAAsH;AACtH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC;KAClC,IAAI,CAAC,eAAe,CAAC;KACrB,QAAQ,EAAE;KACV,QAAQ,CAAC,0BAA0B,CAAC,CAAC;AASxC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAgD;IACjF,OAAO,EAAE,GAAG;IACZ,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,IAAI;IACV,KAAK,EAAE,IAAI;CACZ,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAC9B,QAGC,EACD,cAAsB;IAEtB,MAAM,OAAO,GAAG,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC;IACvD,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,OAAO,KAAK,YAAY;QAAE,OAAO,IAAI,CAAC;IACzE,OAAO,+EAA+E,cAAc,qJAAqJ,CAAC;AAC5P,CAAC"}
|
|
@@ -5,11 +5,7 @@ import { z } from 'zod';
|
|
|
5
5
|
import { type ToolDefinition } from './registry.js';
|
|
6
6
|
export declare const statusInputSchema: z.ZodObject<{
|
|
7
7
|
workspace: z.ZodOptional<z.ZodString>;
|
|
8
|
-
},
|
|
9
|
-
workspace?: string | undefined;
|
|
10
|
-
}, {
|
|
11
|
-
workspace?: string | undefined;
|
|
12
|
-
}>;
|
|
8
|
+
}, z.core.$strip>;
|
|
13
9
|
export type StatusInput = z.infer<typeof statusInputSchema>;
|
|
14
10
|
export declare const statusTool: ToolDefinition<StatusInput>;
|
|
15
11
|
//# sourceMappingURL=status.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.tool.d.ts","sourceRoot":"","sources":["../../src/tools/status.tool.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,KAAK,cAAc,EAA2B,MAAM,eAAe,CAAC;AAE7E,eAAO,MAAM,iBAAiB
|
|
1
|
+
{"version":3,"file":"status.tool.d.ts","sourceRoot":"","sources":["../../src/tools/status.tool.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,KAAK,cAAc,EAA2B,MAAM,eAAe,CAAC;AAE7E,eAAO,MAAM,iBAAiB;;iBAE5B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAW5D,eAAO,MAAM,UAAU,EAAE,cAAc,CAAC,WAAW,CA0KlD,CAAC"}
|
|
@@ -1,16 +1,52 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Approximate cost estimator for reporting (not billing authoritative).
|
|
3
3
|
*
|
|
4
|
-
* Rates are per million tokens
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Rates are per million tokens, Standard tier, the rates of Google's pricing page
|
|
5
|
+
* (https://ai.google.dev/gemini-api/docs/pricing, read 2026-10-16) with the dates
|
|
6
|
+
* they take effect. Where the page has a prompt-size tier (≤ 200k / > 200k tokens)
|
|
7
|
+
* the dearer tier is the row: the estimator does not see the prompt's size, so the
|
|
8
|
+
* row stays an upper bound. An unpriced id takes the dearest row of its category.
|
|
9
|
+
* `GEMINI_PRICING_OVERRIDES` (JSON, keyed by model id) replaces a row at run time.
|
|
7
10
|
*/
|
|
8
|
-
|
|
11
|
+
/** One set of rates, USD per 1M tokens. */
|
|
12
|
+
export interface Rates {
|
|
9
13
|
inputPerMillion: number;
|
|
10
14
|
outputPerMillion: number;
|
|
11
15
|
/** Cached tokens are billed at a reduced rate. Optional — falls back to 0.25× input. */
|
|
12
16
|
cachedInputPerMillion?: number;
|
|
13
17
|
}
|
|
18
|
+
/** Rates that replace a row's from a UTC date on (`YYYY-MM-DD`, inclusive). */
|
|
19
|
+
export interface NextRates extends Required<Rates> {
|
|
20
|
+
from: string;
|
|
21
|
+
}
|
|
22
|
+
export interface PricingEntry extends Rates {
|
|
23
|
+
/** A price change Google has announced: in force from `next.from`. */
|
|
24
|
+
next?: NextRates;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Google's rolling aliases and the versioned id each served on 2026-10-16 (measured
|
|
28
|
+
* by the response's `modelVersion`; re-measure when Google moves them). The target
|
|
29
|
+
* only names the category: Google can move an alias to a dearer model between two
|
|
30
|
+
* measurements, so an alias prices at the dearest rate of its target's category.
|
|
31
|
+
*/
|
|
32
|
+
export declare const ALIAS_TARGET: Readonly<Record<string, string>>;
|
|
33
|
+
/** The ids the table prices (an alias is never one of them). Exported for the tests. */
|
|
34
|
+
export declare function isPricedId(id: string): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Where a model's price can come from, in the order `pricedRow` reads them.
|
|
37
|
+
* Exported with `pricedRow` for the tests.
|
|
38
|
+
*/
|
|
39
|
+
export interface PricingSources {
|
|
40
|
+
overrides: Readonly<Record<string, PricingEntry>>;
|
|
41
|
+
aliasTarget: Readonly<Record<string, string>>;
|
|
42
|
+
rows: Readonly<Record<string, PricingEntry>>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The row that prices `model`, or `undefined` when its category's bound applies:
|
|
46
|
+
* an override of the id itself; for an alias, its target's override (an alias never
|
|
47
|
+
* prices as a row — neither its own nor its target's); else the id's row.
|
|
48
|
+
*/
|
|
49
|
+
export declare function pricedRow(model: string, src: PricingSources): PricingEntry | undefined;
|
|
14
50
|
export interface CostInputs {
|
|
15
51
|
/** The service tier the call runs on; flex halves the price. */
|
|
16
52
|
serviceTier?: 'standard' | 'flex' | undefined;
|
|
@@ -19,11 +55,25 @@ export interface CostInputs {
|
|
|
19
55
|
cachedInputTokens: number;
|
|
20
56
|
outputTokens: number;
|
|
21
57
|
thinkingTokens?: number;
|
|
58
|
+
/**
|
|
59
|
+
* The moment whose rates apply. Defaults to now: a settled call is priced at the
|
|
60
|
+
* rates in force when it settles; a reservation goes through
|
|
61
|
+
* `estimateReservationUsd`, which covers the call's whole window.
|
|
62
|
+
*/
|
|
63
|
+
at?: Date | undefined;
|
|
22
64
|
}
|
|
23
65
|
/** Google's flex tier is billed at half the standard price for the same model. */
|
|
24
66
|
export declare const FLEX_PRICE_FACTOR = 0.5;
|
|
25
67
|
/** Estimated cost in USD (float). Multiply by 1e6 for micros before storing. */
|
|
26
68
|
export declare function estimateCostUsd(input: CostInputs): number;
|
|
69
|
+
/**
|
|
70
|
+
* A reservation for a call that may run up to `coverMs` (its timeout; `null`: none):
|
|
71
|
+
* the dearer of the cost at the rates in force at its start and at the end of that
|
|
72
|
+
* window, so a call that crosses a price change settles at or under what it reserved.
|
|
73
|
+
* A call without a timeout reserves at the dearest rate, per component, of every rate
|
|
74
|
+
* in force from its start on.
|
|
75
|
+
*/
|
|
76
|
+
export declare function estimateReservationUsd(input: CostInputs, coverMs: number | null): number;
|
|
27
77
|
export declare function toMicrosUsd(dollars: number): number;
|
|
28
78
|
export interface PreCallEstimateInputs {
|
|
29
79
|
serviceTier?: 'standard' | 'flex' | undefined;
|
|
@@ -38,6 +88,10 @@ export interface PreCallEstimateInputs {
|
|
|
38
88
|
expectedOutputTokens: number;
|
|
39
89
|
/** Thinking budget, passed through as extra output tokens. */
|
|
40
90
|
thinkingTokens?: number;
|
|
91
|
+
/** The call's timeout in ms (`null`: none): the reservation covers the rates of that window. */
|
|
92
|
+
coverMs: number | null;
|
|
93
|
+
/** When the reservation is made. Defaults to now. */
|
|
94
|
+
at?: Date | undefined;
|
|
41
95
|
}
|
|
42
96
|
/**
|
|
43
97
|
* Pre-call cost estimate used by the budget-reservation path. Charges
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cost-estimator.d.ts","sourceRoot":"","sources":["../../src/utils/cost-estimator.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"cost-estimator.d.ts","sourceRoot":"","sources":["../../src/utils/cost-estimator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,2CAA2C;AAC3C,MAAM,WAAW,KA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
* Rates are per million tokens, Standard tier, the rates of Google's pricing page
|
|
5
|
+
* (https://ai.google.dev/gemini-api/docs/pricing, read 2026-10-16) with the dates
|
|
6
|
+
* they take effect. Where the page has a prompt-size tier (≤ 200k / > 200k tokens)
|
|
7
|
+
* the dearer tier is the row: the estimator does not see the prompt's size, so the
|
|
8
|
+
* row stays an upper bound. An unpriced id takes the dearest row of its category.
|
|
9
|
+
* `GEMINI_PRICING_OVERRIDES` (JSON, keyed by model id) replaces a row at run time.
|
|
7
10
|
*/
|
|
8
11
|
import { categorizeModel, costTierOf, isTextGenCategory } from '../gemini/model-taxonomy.js';
|
|
12
|
+
import { parsePricingOverrides } from './pricing-overrides.js';
|
|
13
|
+
const FLASH_3X = {
|
|
14
|
+
inputPerMillion: 0.75,
|
|
15
|
+
outputPerMillion: 3.75,
|
|
16
|
+
cachedInputPerMillion: 0.075,
|
|
17
|
+
next: {
|
|
18
|
+
from: '2027-01-01',
|
|
19
|
+
inputPerMillion: 1.5,
|
|
20
|
+
outputPerMillion: 7.5,
|
|
21
|
+
cachedInputPerMillion: 0.15,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
/** The > 200k-token tier of the 3.x Pro previews (≤ 200k: 2 / 12 / 0.2). */
|
|
25
|
+
const PRO_3X_PREVIEW = {
|
|
26
|
+
inputPerMillion: 4,
|
|
27
|
+
outputPerMillion: 18,
|
|
28
|
+
cachedInputPerMillion: 0.4,
|
|
29
|
+
};
|
|
30
|
+
/** The 3.1 Flash-Lite rates; the page prices the model once, GA and preview ids alike. */
|
|
31
|
+
const FLASH_LITE_31 = {
|
|
32
|
+
inputPerMillion: 0.25,
|
|
33
|
+
outputPerMillion: 1.5,
|
|
34
|
+
cachedInputPerMillion: 0.025,
|
|
35
|
+
};
|
|
36
|
+
/** Gemini 4 Argon and Carbon: one row on the page, the same rise on 2026-12-01. */
|
|
37
|
+
const REASONING_4 = {
|
|
38
|
+
inputPerMillion: 2,
|
|
39
|
+
outputPerMillion: 10,
|
|
40
|
+
cachedInputPerMillion: 0.1,
|
|
41
|
+
next: {
|
|
42
|
+
from: '2026-12-01',
|
|
43
|
+
inputPerMillion: 4,
|
|
44
|
+
outputPerMillion: 20,
|
|
45
|
+
cachedInputPerMillion: 0.2,
|
|
46
|
+
},
|
|
47
|
+
};
|
|
9
48
|
const DEFAULT_PRICING = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
'gemini-3
|
|
20
|
-
'gemini-3.1-
|
|
21
|
-
'gemini-
|
|
22
|
-
'gemini-
|
|
23
|
-
'gemini-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
49
|
+
'gemini-4-carbon': REASONING_4,
|
|
50
|
+
'gemini-4-argon': REASONING_4,
|
|
51
|
+
// Read 2026-11-14 (as Carbon's row). Flat: the page lists no dated change. Its cached rate is 0.075 on the page — 5 % of the input
|
|
52
|
+
// rate, not the Flash line's 10 %.
|
|
53
|
+
'gemini-4-hydrogen': {
|
|
54
|
+
inputPerMillion: 1.5,
|
|
55
|
+
outputPerMillion: 7.5,
|
|
56
|
+
cachedInputPerMillion: 0.075,
|
|
57
|
+
},
|
|
58
|
+
'gemini-3-pro-preview': PRO_3X_PREVIEW,
|
|
59
|
+
'gemini-3.1-pro-preview': PRO_3X_PREVIEW,
|
|
60
|
+
'gemini-3.8-flash': FLASH_3X,
|
|
61
|
+
'gemini-3.7-flash': FLASH_3X,
|
|
62
|
+
'gemini-3.6-flash': FLASH_3X,
|
|
63
|
+
'gemini-3-flash-preview': {
|
|
64
|
+
inputPerMillion: 0.5,
|
|
65
|
+
outputPerMillion: 3,
|
|
66
|
+
cachedInputPerMillion: 0.05,
|
|
67
|
+
},
|
|
68
|
+
// The page lists it as `gemini-3.1-flash-image` (text input / text and thinking output).
|
|
69
|
+
'gemini-3.1-flash-image-preview': { inputPerMillion: 0.5, outputPerMillion: 3 },
|
|
70
|
+
'gemini-3.5-flash-lite': {
|
|
71
|
+
inputPerMillion: 0.3,
|
|
72
|
+
outputPerMillion: 2.5,
|
|
73
|
+
cachedInputPerMillion: 0.03,
|
|
74
|
+
},
|
|
75
|
+
'gemini-3.1-flash-lite': FLASH_LITE_31,
|
|
76
|
+
'gemini-3.1-flash-lite-preview': FLASH_LITE_31,
|
|
77
|
+
// The > 200k-token tier (≤ 200k: 1.25 / 10 / 0.125).
|
|
78
|
+
'gemini-2.5-pro': { inputPerMillion: 2.5, outputPerMillion: 15, cachedInputPerMillion: 0.25 },
|
|
79
|
+
'gemini-2.5-flash': { inputPerMillion: 0.3, outputPerMillion: 2.5, cachedInputPerMillion: 0.03 },
|
|
80
|
+
'gemini-2.5-flash-lite': {
|
|
81
|
+
inputPerMillion: 0.1,
|
|
82
|
+
outputPerMillion: 0.4,
|
|
83
|
+
cachedInputPerMillion: 0.01,
|
|
84
|
+
},
|
|
30
85
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
overrides = {};
|
|
51
|
-
}
|
|
52
|
-
return overrides;
|
|
86
|
+
/**
|
|
87
|
+
* Google's rolling aliases and the versioned id each served on 2026-10-16 (measured
|
|
88
|
+
* by the response's `modelVersion`; re-measure when Google moves them). The target
|
|
89
|
+
* only names the category: Google can move an alias to a dearer model between two
|
|
90
|
+
* measurements, so an alias prices at the dearest rate of its target's category.
|
|
91
|
+
*/
|
|
92
|
+
// Exported for the tests, which check every target is a priced id.
|
|
93
|
+
export const ALIAS_TARGET = {
|
|
94
|
+
'gemini-pro-latest': 'gemini-3.1-pro-preview',
|
|
95
|
+
'gemini-flash-latest': 'gemini-3.8-flash',
|
|
96
|
+
'gemini-flash-lite-latest': 'gemini-3.5-flash-lite',
|
|
97
|
+
};
|
|
98
|
+
/** `record[key]` when `key` is the record's own (never a prototype member such as `constructor`). */
|
|
99
|
+
function own(record, key) {
|
|
100
|
+
return Object.hasOwn(record, key) ? record[key] : undefined;
|
|
101
|
+
}
|
|
102
|
+
/** The ids the table prices (an alias is never one of them). Exported for the tests. */
|
|
103
|
+
export function isPricedId(id) {
|
|
104
|
+
return own(DEFAULT_PRICING, id) !== undefined;
|
|
53
105
|
}
|
|
54
106
|
/**
|
|
55
107
|
* Conservative defaults for models we've never seen — one for each cost tier
|
|
@@ -76,38 +128,96 @@ const UNKNOWN_RATE_BY_TIER = {
|
|
|
76
128
|
function cachedRate(row) {
|
|
77
129
|
return row.cachedInputPerMillion ?? row.inputPerMillion * 0.25;
|
|
78
130
|
}
|
|
131
|
+
/** The UTC calendar date of `at`, `YYYY-MM-DD`. */
|
|
132
|
+
function utcDate(at) {
|
|
133
|
+
return at.toISOString().slice(0, 10);
|
|
134
|
+
}
|
|
135
|
+
/** The highest of two rate sets, per component. */
|
|
136
|
+
function dearerRates(a, b) {
|
|
137
|
+
return {
|
|
138
|
+
inputPerMillion: Math.max(a.inputPerMillion, b.inputPerMillion),
|
|
139
|
+
outputPerMillion: Math.max(a.outputPerMillion, b.outputPerMillion),
|
|
140
|
+
cachedInputPerMillion: Math.max(cachedRate(a), cachedRate(b)),
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
/** The rates of `entry` in force at `at`: its `next` rates from their UTC date on. */
|
|
144
|
+
function ratesAt(entry, at) {
|
|
145
|
+
const next = entry.next;
|
|
146
|
+
if (next === undefined || utcDate(at) < next.from)
|
|
147
|
+
return entry;
|
|
148
|
+
return next;
|
|
149
|
+
}
|
|
79
150
|
/**
|
|
80
|
-
* The dearest
|
|
81
|
-
*
|
|
82
|
-
* unpriced model of that category, read from the table instead of a fixed number.
|
|
151
|
+
* The dearest rates `entry` bills at `at` or at any later dated change, per component:
|
|
152
|
+
* what a call that may settle at any time from `at` on can cost.
|
|
83
153
|
*/
|
|
84
|
-
function
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
154
|
+
function dearestEverRates(entry, at) {
|
|
155
|
+
const next = entry.next;
|
|
156
|
+
if (next === undefined || utcDate(at) >= next.from)
|
|
157
|
+
return ratesAt(entry, at);
|
|
158
|
+
return dearerRates(entry, next);
|
|
159
|
+
}
|
|
160
|
+
/** The rates of `entry` for `moment`. */
|
|
161
|
+
function ratesFor(entry, moment) {
|
|
162
|
+
return moment.onward ? dearestEverRates(entry, moment.at) : ratesAt(entry, moment.at);
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* The dearest rate `rows` have for `moment` in a text category, per component (the
|
|
166
|
+
* highest input, output and cached rate of its rows): an upper bound for an unpriced
|
|
167
|
+
* model or an alias of that category, or `undefined` for a category no text row prices.
|
|
168
|
+
*/
|
|
169
|
+
function dearestTextRate(category, moment, rows) {
|
|
170
|
+
if (!isTextGenCategory(category))
|
|
171
|
+
return undefined;
|
|
172
|
+
let held;
|
|
173
|
+
for (const [id, entry] of Object.entries(rows)) {
|
|
174
|
+
if (categorizeModel(id) !== category)
|
|
89
175
|
continue;
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
176
|
+
const row = ratesFor(entry, moment);
|
|
177
|
+
held = held === undefined ? row : dearerRates(held, row);
|
|
178
|
+
}
|
|
179
|
+
return held;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* The row that prices `model`, or `undefined` when its category's bound applies:
|
|
183
|
+
* an override of the id itself; for an alias, its target's override (an alias never
|
|
184
|
+
* prices as a row — neither its own nor its target's); else the id's row.
|
|
185
|
+
*/
|
|
186
|
+
export function pricedRow(model, src) {
|
|
187
|
+
const override = own(src.overrides, model);
|
|
188
|
+
if (override !== undefined)
|
|
189
|
+
return override;
|
|
190
|
+
const target = own(src.aliasTarget, model);
|
|
191
|
+
if (target !== undefined)
|
|
192
|
+
return own(src.overrides, target);
|
|
193
|
+
return own(src.rows, model);
|
|
194
|
+
}
|
|
195
|
+
let loaded = null;
|
|
196
|
+
function loadPricing() {
|
|
197
|
+
if (loaded !== null)
|
|
198
|
+
return loaded;
|
|
199
|
+
const overrides = parsePricingOverrides(process.env.GEMINI_PRICING_OVERRIDES);
|
|
200
|
+
const boundRows = Object.assign(Object.create(null), DEFAULT_PRICING);
|
|
201
|
+
for (const [id, entry] of Object.entries(overrides)) {
|
|
202
|
+
// An alias never prices as a row, so its override never sets a category's bound.
|
|
203
|
+
if (own(ALIAS_TARGET, id) === undefined)
|
|
204
|
+
boundRows[id] = entry;
|
|
96
205
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
function pricingFor(model) {
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
//
|
|
107
|
-
//
|
|
108
|
-
//
|
|
109
|
-
|
|
110
|
-
|
|
206
|
+
loaded = { sources: { overrides, aliasTarget: ALIAS_TARGET, rows: DEFAULT_PRICING }, boundRows };
|
|
207
|
+
return loaded;
|
|
208
|
+
}
|
|
209
|
+
function pricingFor(model, moment) {
|
|
210
|
+
const { sources, boundRows } = loadPricing();
|
|
211
|
+
const row = pricedRow(model, sources);
|
|
212
|
+
if (row)
|
|
213
|
+
return ratesFor(row, moment);
|
|
214
|
+
// An alias or an unpriced text model: the dearest rate of its category (an alias's
|
|
215
|
+
// is its measured target's). Anything else: the conservative rate of its cost tier —
|
|
216
|
+
// a model the taxonomy cannot place gets the premium rate rather than flash: better
|
|
217
|
+
// to block an over-budget user than let a never-seen model undercharge past the cap.
|
|
218
|
+
const categoryId = own(sources.aliasTarget, model) ?? model;
|
|
219
|
+
const bound = dearestTextRate(categorizeModel(categoryId), moment, boundRows);
|
|
220
|
+
return bound ?? UNKNOWN_RATE_BY_TIER[costTierOf(categoryId)];
|
|
111
221
|
}
|
|
112
222
|
/** Google's flex tier is billed at half the standard price for the same model. */
|
|
113
223
|
export const FLEX_PRICE_FACTOR = 0.5;
|
|
@@ -116,10 +226,12 @@ function tierFactor(tier) {
|
|
|
116
226
|
}
|
|
117
227
|
/** Estimated cost in USD (float). Multiply by 1e6 for micros before storing. */
|
|
118
228
|
export function estimateCostUsd(input) {
|
|
119
|
-
|
|
120
|
-
|
|
229
|
+
return costFor(input, { at: input.at ?? new Date(), onward: false });
|
|
230
|
+
}
|
|
231
|
+
function costFor(input, moment) {
|
|
232
|
+
const p = pricingFor(input.model, moment);
|
|
121
233
|
const uncached = (input.uncachedInputTokens / 1_000_000) * p.inputPerMillion;
|
|
122
|
-
const cached = (input.cachedInputTokens / 1_000_000) * cachedRate;
|
|
234
|
+
const cached = (input.cachedInputTokens / 1_000_000) * cachedRate(p);
|
|
123
235
|
const output = (input.outputTokens / 1_000_000) * p.outputPerMillion;
|
|
124
236
|
// Thinking tokens are currently billed as output tokens on Gemini Pro family.
|
|
125
237
|
const thinking = input.thinkingTokens
|
|
@@ -127,6 +239,20 @@ export function estimateCostUsd(input) {
|
|
|
127
239
|
: 0;
|
|
128
240
|
return (uncached + cached + output + thinking) * tierFactor(input.serviceTier);
|
|
129
241
|
}
|
|
242
|
+
/**
|
|
243
|
+
* A reservation for a call that may run up to `coverMs` (its timeout; `null`: none):
|
|
244
|
+
* the dearer of the cost at the rates in force at its start and at the end of that
|
|
245
|
+
* window, so a call that crosses a price change settles at or under what it reserved.
|
|
246
|
+
* A call without a timeout reserves at the dearest rate, per component, of every rate
|
|
247
|
+
* in force from its start on.
|
|
248
|
+
*/
|
|
249
|
+
export function estimateReservationUsd(input, coverMs) {
|
|
250
|
+
const start = input.at ?? new Date();
|
|
251
|
+
if (coverMs === null)
|
|
252
|
+
return costFor(input, { at: start, onward: true });
|
|
253
|
+
const end = new Date(start.getTime() + coverMs);
|
|
254
|
+
return Math.max(costFor(input, { at: start, onward: false }), costFor(input, { at: end, onward: false }));
|
|
255
|
+
}
|
|
130
256
|
export function toMicrosUsd(dollars) {
|
|
131
257
|
return Math.round(dollars * 1_000_000);
|
|
132
258
|
}
|
|
@@ -142,14 +268,16 @@ export function toMicrosUsd(dollars) {
|
|
|
142
268
|
export function estimatePreCallCostUsd(input) {
|
|
143
269
|
const workspaceTokens = Math.ceil(Math.max(0, input.workspaceBytes) / 4);
|
|
144
270
|
const promptTokens = Math.ceil(Math.max(0, input.promptChars) / 4);
|
|
145
|
-
|
|
271
|
+
const call = {
|
|
146
272
|
model: input.model,
|
|
147
273
|
serviceTier: input.serviceTier,
|
|
148
274
|
uncachedInputTokens: workspaceTokens + promptTokens + Math.max(0, input.extraInputTokens ?? 0),
|
|
149
275
|
cachedInputTokens: 0,
|
|
150
276
|
outputTokens: Math.max(0, input.expectedOutputTokens),
|
|
277
|
+
at: input.at,
|
|
151
278
|
...(input.thinkingTokens !== undefined ? { thinkingTokens: input.thinkingTokens } : {}),
|
|
152
|
-
}
|
|
279
|
+
};
|
|
280
|
+
return estimateReservationUsd(call, input.coverMs);
|
|
153
281
|
}
|
|
154
282
|
/**
|
|
155
283
|
* Raw conversion: `micros → dollars` as a full-precision float. Sub-cent values
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cost-estimator.js","sourceRoot":"","sources":["../../src/utils/cost-estimator.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"cost-estimator.js","sourceRoot":"","sources":["../../src/utils/cost-estimator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAC7F,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAoB/D,MAAM,QAAQ,GAAiB;IAC7B,eAAe,EAAE,IAAI;IACrB,gBAAgB,EAAE,IAA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C;IACnE,MAAM,IAAI,GAAe;QACvB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,mBAAmB,EAAE,eAAe,GAAG,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,gBAAgB,IAAI,CAAC,CAAC;QAC9F,iBAAiB,EAAE,CAAC;QACpB,YAAY,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,oBAAoB,CAAC;QACrD,EAAE,EAAE,KAAK,CAAC,EAAE;QACZ,GAAG,CAAC,KAAK,CAAC,cAAc,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,KAAK,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACxF,CAAC;IACF,OAAO,sBAAsB,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;AACrD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,OAAO,MAAM,GAAG,SAAS,CAAC;AAC5B,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,oBAAoB,CAAC,OAAe;IAClD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `GEMINI_PRICING_OVERRIDES`: the operator's price rows, validated at load. An entry
|
|
3
|
+
* the estimator could not price with (a rate that is not a finite number ≥ 0, a
|
|
4
|
+
* `next` without a `YYYY-MM-DD` `from` or without all three rates) is dropped with
|
|
5
|
+
* one warning naming the model and the reason; the table's row for it stays.
|
|
6
|
+
*/
|
|
7
|
+
import type { PricingEntry } from './cost-estimator.js';
|
|
8
|
+
/** The valid rows of `raw` (the variable's JSON) by model id; nothing when unset. */
|
|
9
|
+
export declare function parsePricingOverrides(raw: string | undefined): Record<string, PricingEntry>;
|
|
10
|
+
//# sourceMappingURL=pricing-overrides.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pricing-overrides.d.ts","sourceRoot":"","sources":["../../src/utils/pricing-overrides.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAS,MAAM,qBAAqB,CAAC;AAuE/D,qFAAqF;AACrF,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CA4B3F"}
|