@genesislcap/foundation-ai 15.88.1 → 15.89.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.
@@ -104,10 +104,10 @@ export interface AITiers {
104
104
  * The models are the ones Genesis Create has been running these tiers on in production — except
105
105
  * Anthropic's `reasoning`, moved to `claude-opus-4-8` (see its entry) — and they are a
106
106
  * **benchmark result, not a preference**: re-bench before moving one. Two of the Gemini
107
- * defaults carry a caveat recorded beside them, a preview model and an introductory rate. Two dates
108
- * are already on the calendar for that: `gemini-3.8-flash` sits on an introductory rate that
109
- * doubles on 2027-01-01 (at which point it is dearer on input than the model it replaced),
110
- * and `token-cost.test.ts` fails the build that day; `ai-tiers.test.ts` fails alongside it
107
+ * defaults carry a caveat recorded beside them, a preview model and an introductory rate. One date
108
+ * is already on the calendar for that: `gemini-3.8-flash` sits on an introductory rate that
109
+ * doubles on 2027-01-01 (at which point it no longer undercuts the model it replaced on input).
110
+ * Its price switches on its own that day; `ai-tiers.test.ts` fails the build on the same day,
111
111
  * saying the High tier is the thing to re-bench.
112
112
  *
113
113
  * Every model here must be in `SUPPORTED_*_MODEL_IDS` with a context limit and a price —
@@ -114,8 +114,8 @@ export declare class GeminiTransport implements AITransport, ChatTransport, Cost
114
114
  * default posture. Without this, a caller asking for `high` on `gemini-2.5-pro` and quietly
115
115
  * getting the default is left to wonder why.
116
116
  * - A graded depth whose DIALECT a Gemini 3 tier speaks but whose particular value it does not
117
- * accept — `minimal` on `gemini-3.8-flash` or `gemini-3.1-pro-preview`, the two tiers that
118
- * reject it outright. Nothing is dropped here; `clampThinkingLevel` MOVES the level onto the
117
+ * accept — `minimal` on `gemini-4-argon`, `gemini-3.8-flash` or `gemini-3.1-pro-preview`, the tiers
118
+ * that reject it outright. Nothing is dropped here; `clampThinkingLevel` MOVES the level onto the
119
119
  * nearest one the tier takes, and since ties resolve upward the move is usually to something
120
120
  * DEARER than the caller chose. A cost decision reversed on the wire in the expensive
121
121
  * direction is exactly what this warning exists for — without it the only trace is the bill.
@@ -1 +1 @@
1
- {"version":3,"file":"gemini-transport.d.ts","sourceRoot":"","sources":["../../../src/transports/gemini-transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAClB,KAAK,uBAAuB,EAC7B,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAEV,WAAW,EACX,kBAAkB,EAMnB,MAAM,qBAAqB,CAAC;AA+G7B;;;GAGG;AACH,KAAK,mBAAmB,GAAG,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AA+CjE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,SAAS,mBAAmB,EAAE,GAAG,SAAS,EACrD,KAAK,EAAE,mBAAmB,GACzB,mBAAmB,CAgBrB;AA8CD,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AA6ED;;;;;;GAMG;AACH,qBAAa,0BAA2B,SAAQ,KAAK;IACvC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM;gBAAtB,aAAa,CAAC,EAAE,MAAM;CAI5C;AAED;;;;;;;;GAQG;AACH,qBAAa,eAAgB,YAAW,WAAW,EAAE,aAAa,EAAE,sBAAsB;IACxF,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgB;IACtC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,YA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;;;;;OASG;IACH,OAAO,CAAC,eAAe;IAyCvB,OAAO,CAAC,kBAAkB;IAsI1B;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,wBAAwB;IAoBhC;;;;;;;;OAQG;IACH,OAAO,CAAC,mBAAmB;IAkC3B,OAAO,CAAC,aAAa;IA8BrB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAO;IAChD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,0BAA0B,CAAO;IACzD;;;;;;;;;;OAUG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAO;IACjD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAIxC;IAEF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAQ;YAEjC,IAAI;IAgBlB,OAAO,CAAC,eAAe;CAexB"}
@@ -9,7 +9,7 @@ export type AIProviderType = 'openai' | 'chrome' | 'gemini' | 'anthropic' | 'non
9
9
  *
10
10
  * @beta
11
11
  */
12
- export type GeminiModelId = 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-lite' | 'gemini-3.8-flash' | 'gemini-3.5-flash' | 'gemini-3.1-flash-lite' | 'gemini-3.1-pro-preview';
12
+ export type GeminiModelId = 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-lite' | 'gemini-4-argon' | 'gemini-3.8-flash' | 'gemini-3.5-flash' | 'gemini-3.1-flash-lite' | 'gemini-3.1-pro-preview';
13
13
  /** @beta */
14
14
  export declare const SUPPORTED_GEMINI_MODEL_IDS: readonly GeminiModelId[];
15
15
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"config.types.d.ts","sourceRoot":"","sources":["../../../src/types/config.types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,GAAG,MAAM,CAAC;AAE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
147
  /**
148
148
  * The day `gemini-3.8-flash` leaves its introductory rate (see `GEMINI_PRICING` below).
149
149
  *
150
- * A constant rather than a literal in the test that enforces it, because a SECOND dated
151
- * assertion now hangs off the same day: the High tier picked that model while it was the
152
- * cheaper one, so the flip is also the trigger to re-bench the tier (`tiers/ai-tiers.test.ts`).
153
- * Two hand-copied dates would drift the moment either is corrected, and a re-bench reminder
154
- * that fires on the wrong day is no reminder at all.
150
+ * One constant shared by the price switch and the dated assertion in `tiers/ai-tiers.test.ts`:
151
+ * the High tier picked that model while it was the cheaper one, so the switch is also the
152
+ * trigger to re-bench the tier. Two hand-copied dates would drift the moment either is
153
+ * corrected, and a re-bench reminder that fires on the wrong day is no reminder at all.
155
154
  *
156
- * Not part of the package's public surface — it exists for those two tests.
155
+ * Not part of the package's public surface.
157
156
  *
158
157
  * @internal
159
158
  */
160
159
  export declare const GEMINI_3_8_FLASH_INTRO_RATE_ENDS: number;
160
+ /**
161
+ * The instant `gemini-4-argon` moves from its $2/$10 launch rate to $4/$20 (see `GEMINI_PRICING`).
162
+ * Google publishes the $2/$10 rate "until 30 Nov 2026", so the launch rate applies through 30 Nov
163
+ * inclusive and this is the first instant of 1 Dec UTC. Source:
164
+ * https://ai.google.dev/gemini-api/docs/pricing — re-check the boundary interpretation (timezone
165
+ * and inclusivity) against that page; the docs give a date, not an instant.
166
+ *
167
+ * @internal
168
+ */
169
+ export declare const GEMINI_4_ARGON_LAUNCH_RATE_ENDS: number;
161
170
  /**
162
171
  * Resolve the per-million-token rates for a model given the request's prompt size,
163
172
  * selecting the long-context tier for tiered models when the prompt exceeds
@@ -171,9 +180,13 @@ export declare const GEMINI_3_8_FLASH_INTRO_RATE_ENDS: number;
171
180
  * Unlike Anthropic's, this accessor is not a pure function of the model, which is
172
181
  * why there is no single `ratesFor(model)` across both providers.
173
182
  *
183
+ * `at` is the instant the request is priced at, and only matters for a `dated` model (one with a
184
+ * scheduled rate change); every other model ignores it. Defaults to now, which is right
185
+ * for pricing a request as it happens — pass the request's own timestamp when re-pricing history.
186
+ *
174
187
  * @beta
175
188
  */
176
- export declare function geminiRatesFor(model: GeminiModelId, promptTokens: number): TokenRates;
189
+ export declare function geminiRatesFor(model: GeminiModelId, promptTokens: number, at?: Date): TokenRates;
177
190
  /**
178
191
  * Token counts from a Gemini `usageMetadata` block.
179
192
  *
@@ -201,7 +214,13 @@ export interface GeminiUsageRecord {
201
214
  /**
202
215
  * Cost one Gemini request.
203
216
  *
217
+ * @remarks
218
+ * `at` is the instant the request is priced at, and only matters for a `dated` model (one with a
219
+ * scheduled rate change). It defaults to now, which is right for costing a request as it
220
+ * happens — pass the request's own timestamp when re-pricing stored usage, or the rate in force
221
+ * today is applied to historical requests.
222
+ *
204
223
  * @beta
205
224
  */
206
- export declare function geminiTokenCost(model: GeminiModelId, usage: GeminiUsageRecord): TokenCost;
225
+ export declare function geminiTokenCost(model: GeminiModelId, usage: GeminiUsageRecord, at?: Date): TokenCost;
207
226
  //# sourceMappingURL=token-cost.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"token-cost.d.ts","sourceRoot":"","sources":["../../../src/utils/token-cost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAkDhE;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,gFAAgF;IAChF,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;;;;OAQG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;;;OAOG;IACH,SAAS,EAAE,kBAAkB,CAAC;CAC/B;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAC;IAClB,sDAAsD;IACtD,YAAY,EAAE,MAAM,CAAC;IACrB;;;;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AAe,EAAE,MAAM,CAAC;IACxB,wEAAwE;IACxE,gBAAgB,EAAE,MAAM,CAAC;IACzB;;;;;;;;;OASG;IACH,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,gBAAgB,EACvB,KAAK,EAAE,oBAAoB,GAC1B,SAAS,CAiCX;AAMD;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,SAAU,CAAC;AAErD;;;;;;;;;GASG;AACH,eAAO,MAAM,8BAA8B,MAAM,CAAC;AAElD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gCAAgC,QAAqC,CAAC;AAEnF;;;;;;;;GAQG;AACH,eAAO,MAAM,+BAA+B,QAAqC,CAAC;AAoElF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,aAAa,EACpB,YAAY,EAAE,MAAM,EACpB,EAAE,GAAE,IAAiB,GACpB,UAAU,CASZ;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,iBAAiB;IAChC,kFAAkF;IAClF,YAAY,EAAE,MAAM,CAAC;IACrB,4CAA4C;IAC5C,eAAe,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB,+EAA+E;IAC/E,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,aAAa,EACpB,KAAK,EAAE,iBAAiB,EACxB,EAAE,GAAE,IAAiB,GACpB,SAAS,CAuBX"}
@@ -58,10 +58,10 @@ const AI_NO_RESPONSE_TIMEOUT_MS = 300000;
58
58
  * The models are the ones Genesis Create has been running these tiers on in production — except
59
59
  * Anthropic's `reasoning`, moved to `claude-opus-4-8` (see its entry) — and they are a
60
60
  * **benchmark result, not a preference**: re-bench before moving one. Two of the Gemini
61
- * defaults carry a caveat recorded beside them, a preview model and an introductory rate. Two dates
62
- * are already on the calendar for that: `gemini-3.8-flash` sits on an introductory rate that
63
- * doubles on 2027-01-01 (at which point it is dearer on input than the model it replaced),
64
- * and `token-cost.test.ts` fails the build that day; `ai-tiers.test.ts` fails alongside it
61
+ * defaults carry a caveat recorded beside them, a preview model and an introductory rate. One date
62
+ * is already on the calendar for that: `gemini-3.8-flash` sits on an introductory rate that
63
+ * doubles on 2027-01-01 (at which point it no longer undercuts the model it replaced on input).
64
+ * Its price switches on its own that day; `ai-tiers.test.ts` fails the build on the same day,
65
65
  * saying the High tier is the thing to re-bench.
66
66
  *
67
67
  * Every model here must be in `SUPPORTED_*_MODEL_IDS` with a context limit and a price —
@@ -106,7 +106,7 @@ export const DEFAULT_AI_TIERS = Object.freeze({
106
106
  timeoutMs: AI_NO_RESPONSE_TIMEOUT_MS,
107
107
  }),
108
108
  // On an INTRODUCTORY rate that doubles to $1.50 / $7.50 on 2027-01-01, from which point it
109
- // is dearer on input than the gemini-3.5-flash it replaced. Chosen at the introductory rate
109
+ // no longer undercuts the gemini-3.5-flash it replaced on input. Chosen at the introductory rate
110
110
  // knowingly; `ai-tiers.test.ts` fails that day to force the re-bench.
111
111
  high: Object.freeze({
112
112
  model: 'gemini-3.8-flash',
@@ -21,6 +21,7 @@ const GEMINI_CONTEXT_LIMITS = {
21
21
  'gemini-2.5-pro': 1048576,
22
22
  'gemini-2.5-flash': 1048576,
23
23
  'gemini-2.5-flash-lite': 1048576,
24
+ 'gemini-4-argon': 1048576,
24
25
  'gemini-3.8-flash': 1048576,
25
26
  'gemini-3.5-flash': 1048576,
26
27
  'gemini-3.1-flash-lite': 1048576,
@@ -56,10 +57,15 @@ const GEMINI_MODEL_WARNINGS = {
56
57
  'gemini-2.5-flash': 'GeminiTransport: using gemini-2.5-flash — higher cost than flash-lite; use for harder reasoning or agent tasks.',
57
58
  'gemini-2.5-pro': 'GeminiTransport: using gemini-2.5-pro — significantly higher, prompt-size-tiered cost; reserve for tasks where flash reliability is insufficient.',
58
59
  'gemini-3.5-flash': 'GeminiTransport: using gemini-3.5-flash — frontier model, materially higher cost than flash-lite; use for harder reasoning or agent tasks.',
59
- // Warns despite currently costing LESS than gemini-3.5-flash, because that is temporary: the
60
- // rate doubles on 2027-01-01 (see GEMINI_PRICING). A caller that picks this tier on today's
61
- // price and never revisits the choice gets twice the bill in January without changing a line.
62
- 'gemini-3.8-flash': 'GeminiTransport: using gemini-3.8-flash — frontier model, materially higher cost than flash-lite. Its $0.75/$3.75 per-MTok rate is introductory and DOUBLES to $1.50/$7.50 on 2027-01-01; re-check this tier choice before then.',
60
+ // Warns despite costing LESS than gemini-3.5-flash until 2027-01-01, because that is temporary:
61
+ // the rate doubles that day (see GEMINI_PRICING, which switches on its own). A caller that picks
62
+ // this tier on the introductory price and never revisits the choice gets twice the bill in
63
+ // January without changing a line. Worded to stay true after the switch.
64
+ 'gemini-3.8-flash': 'GeminiTransport: using gemini-3.8-flash — frontier model, materially higher cost than flash-lite. Billed at an introductory $0.75/$3.75 per MTok through 2026-12-31 and $1.50/$7.50 from 2027-01-01; weigh a tier choice against the later rate.',
65
+ // Like gemini-3.8-flash, warns about a scheduled rate change: $2/$10 per MTok until 2026-11-30,
66
+ // then $4/$20 (see GEMINI_PRICING, which switches on its own). Worded to stay true after the
67
+ // switch, so the message needs no edit on the day.
68
+ 'gemini-4-argon': 'GeminiTransport: using gemini-4-argon — premium reasoning model, materially higher cost than the flash tiers. Billed at $2/$10 per MTok through 2026-11-30 and $4/$20 from 2026-12-01; weigh a tier choice against the later rate.',
63
69
  'gemini-3.1-pro-preview': 'GeminiTransport: using gemini-3.1-pro-preview — PREVIEW model (no stability guarantee, may be withdrawn) with significantly higher, prompt-size-tiered cost; reserve for tasks where flash reliability is insufficient.',
64
70
  };
65
71
  /**
@@ -87,13 +93,29 @@ const GEMINI_THINKING_DISABLEABLE = [
87
93
  'gemini-2.5-flash',
88
94
  'gemini-2.5-flash-lite',
89
95
  ];
90
- /** Tiers that accept `generationConfig.mediaResolution`. Gemini 3 only, like `thinkingLevel`. */
96
+ /**
97
+ * Tiers that accept `generationConfig.mediaResolution`. Gemini 3 only, like `thinkingLevel`.
98
+ * `gemini-4-argon` is deliberately omitted until Google's docs confirm it accepts the field.
99
+ */
91
100
  const GEMINI_MEDIA_RESOLUTION_TIERS = [
92
101
  'gemini-3.8-flash',
93
102
  'gemini-3.5-flash',
94
103
  'gemini-3.1-flash-lite',
95
104
  'gemini-3.1-pro-preview',
96
105
  ];
106
+ /**
107
+ * Tiers whose `responseSchema` can ride alongside function declarations. An explicit list rather
108
+ * than a `gemini-3` prefix test: a prefix silently drops the schema for any model that does not
109
+ * share the name (`gemini-4-argon` supports it), and the drop is invisible until a structured
110
+ * turn comes back as free text.
111
+ */
112
+ const GEMINI_SCHEMA_WITH_TOOLS_TIERS = [
113
+ 'gemini-4-argon',
114
+ 'gemini-3.8-flash',
115
+ 'gemini-3.5-flash',
116
+ 'gemini-3.1-flash-lite',
117
+ 'gemini-3.1-pro-preview',
118
+ ];
97
119
  const GEMINI_LEVEL_LADDER = ['minimal', 'low', 'medium', 'high'];
98
120
  /**
99
121
  * The `thinkingLevel` values each Gemini 3 tier accepts, weakest first — and, by carrying an entry
@@ -132,6 +154,9 @@ const GEMINI_LEVEL_LADDER = ['minimal', 'low', 'medium', 'high'];
132
154
  * four). Re-measure with the probe rather than re-reading the docs when a tier is added.
133
155
  */
134
156
  const GEMINI_THINKING_LEVELS = {
157
+ // Same accepted set as gemini-3.8-flash (Google docs, 2026-10-29: low/medium/high, default
158
+ // medium, no `minimal`) — documented rather than probed, so re-measure when convenient.
159
+ 'gemini-4-argon': ['low', 'medium', 'high'],
135
160
  'gemini-3.8-flash': ['low', 'medium', 'high'],
136
161
  'gemini-3.5-flash': ['minimal', 'low', 'medium', 'high'],
137
162
  'gemini-3.1-flash-lite': ['minimal', 'low', 'medium', 'high'],
@@ -292,8 +317,8 @@ export class GeminiTransport {
292
317
  * default posture. Without this, a caller asking for `high` on `gemini-2.5-pro` and quietly
293
318
  * getting the default is left to wonder why.
294
319
  * - A graded depth whose DIALECT a Gemini 3 tier speaks but whose particular value it does not
295
- * accept — `minimal` on `gemini-3.8-flash` or `gemini-3.1-pro-preview`, the two tiers that
296
- * reject it outright. Nothing is dropped here; `clampThinkingLevel` MOVES the level onto the
320
+ * accept — `minimal` on `gemini-4-argon`, `gemini-3.8-flash` or `gemini-3.1-pro-preview`, the tiers
321
+ * that reject it outright. Nothing is dropped here; `clampThinkingLevel` MOVES the level onto the
297
322
  * nearest one the tier takes, and since ties resolve upward the move is usually to something
298
323
  * DEARER than the caller chose. A cost decision reversed on the wire in the expensive
299
324
  * direction is exactly what this warning exists for — without it the only trace is the bill.
@@ -484,7 +509,7 @@ export class GeminiTransport {
484
509
  // otherwise drop it (the caller keeps a prompt-instruction + validator fallback). Passed as a
485
510
  // top-level `responseSchema` that `toDirectPayload` maps to `generationConfig.responseMimeType`
486
511
  // + `responseSchema` on the direct path (the proxy forwards it).
487
- const schemaCoexistsWithTools = this.model.startsWith('gemini-3');
512
+ const schemaCoexistsWithTools = GEMINI_SCHEMA_WITH_TOOLS_TIERS.includes(this.model);
488
513
  const applyResponseSchema = (options === null || options === void 0 ? void 0 : options.responseSchema) != null && (!tools || schemaCoexistsWithTools);
489
514
  const response = yield this.post(Object.assign({ model: this.model, contents,
490
515
  tools,
@@ -3,6 +3,7 @@ export const SUPPORTED_GEMINI_MODEL_IDS = [
3
3
  'gemini-2.5-pro',
4
4
  'gemini-2.5-flash',
5
5
  'gemini-2.5-flash-lite',
6
+ 'gemini-4-argon',
6
7
  'gemini-3.8-flash',
7
8
  'gemini-3.5-flash',
8
9
  'gemini-3.1-flash-lite',
@@ -164,17 +164,26 @@ export const GEMINI_CACHED_INPUT_MULTIPLIER = 0.1;
164
164
  /**
165
165
  * The day `gemini-3.8-flash` leaves its introductory rate (see `GEMINI_PRICING` below).
166
166
  *
167
- * A constant rather than a literal in the test that enforces it, because a SECOND dated
168
- * assertion now hangs off the same day: the High tier picked that model while it was the
169
- * cheaper one, so the flip is also the trigger to re-bench the tier (`tiers/ai-tiers.test.ts`).
170
- * Two hand-copied dates would drift the moment either is corrected, and a re-bench reminder
171
- * that fires on the wrong day is no reminder at all.
167
+ * One constant shared by the price switch and the dated assertion in `tiers/ai-tiers.test.ts`:
168
+ * the High tier picked that model while it was the cheaper one, so the switch is also the
169
+ * trigger to re-bench the tier. Two hand-copied dates would drift the moment either is
170
+ * corrected, and a re-bench reminder that fires on the wrong day is no reminder at all.
172
171
  *
173
- * Not part of the package's public surface — it exists for those two tests.
172
+ * Not part of the package's public surface.
174
173
  *
175
174
  * @internal
176
175
  */
177
176
  export const GEMINI_3_8_FLASH_INTRO_RATE_ENDS = Date.parse('2027-01-01T00:00:00Z');
177
+ /**
178
+ * The instant `gemini-4-argon` moves from its $2/$10 launch rate to $4/$20 (see `GEMINI_PRICING`).
179
+ * Google publishes the $2/$10 rate "until 30 Nov 2026", so the launch rate applies through 30 Nov
180
+ * inclusive and this is the first instant of 1 Dec UTC. Source:
181
+ * https://ai.google.dev/gemini-api/docs/pricing — re-check the boundary interpretation (timezone
182
+ * and inclusivity) against that page; the docs give a date, not an instant.
183
+ *
184
+ * @internal
185
+ */
186
+ export const GEMINI_4_ARGON_LAUNCH_RATE_ENDS = Date.parse('2026-12-01T00:00:00Z');
178
187
  /**
179
188
  * Paid Standard tier rates (USD per million tokens) —
180
189
  * https://ai.google.dev/gemini-api/docs/pricing
@@ -195,22 +204,32 @@ const GEMINI_PRICING = {
195
204
  rate: { promptPerMillion: 0.25, candidatePerMillion: 1.5 },
196
205
  },
197
206
  'gemini-3.5-flash': { kind: 'flat', rate: { promptPerMillion: 1.5, candidatePerMillion: 9.0 } },
198
- // INTRODUCTORY RATE, and the only dated entry in this file. Google publishes
199
- // $0.75 / $3.75 per MTok **through 2026-12-31**, rising to $1.50 / $7.50 on 2027-01-01 —
200
- // so today this model is CHEAPER than gemini-3.5-flash above and in January it is not.
201
- //
202
- // The listed figure is the one in force, not the one coming. That is the lesson the
203
- // `claude-sonnet-5` entry records from the other direction: charging a scheduled future
204
- // rate early over-billed every request by 50% for as long as nobody noticed. A rate that
205
- // has not taken effect is not a price, and `GeminiPricing` deliberately has no time
206
- // dimension to express one — flip these two numbers on 2027-01-01 instead.
207
+ // INTRODUCTORY RATE. Google publishes $0.75 / $3.75 per MTok **through 2026-12-31**, rising
208
+ // to $1.50 / $7.50 on 2027-01-01 — so until then this model is CHEAPER than gemini-3.5-flash
209
+ // above, and from then it is not.
207
210
  //
208
- // That flip is ENFORCED, not remembered: `token-cost.test.ts` carries a dated assertion that
209
- // turns the build red on 2027-01-01 and names the three-line edit (these two rates, plus the
210
- // now-false `< gemini-3.5-flash` comparison in that same test — both models are $1.50 input
211
- // from that date). There is no ticket to lose.
211
+ // `dated`, carrying BOTH rates and the switch instant, rather than today's rate plus a test
212
+ // that goes red on the day. Each request is priced at the rate in force when it is made, so a
213
+ // scheduled future rate is never charged early — the trap the `claude-sonnet-5` entry records,
214
+ // where that over-billed every request by 50% — and the switch needs no edit and no release.
215
+ // That second half is the point: a failing test only reaches our own CI, while every version
216
+ // already published would keep billing the old rate until a fix shipped and apps upgraded.
217
+ // https://ai.google.dev/gemini-api/docs/pricing
218
+ 'gemini-3.8-flash': {
219
+ kind: 'dated',
220
+ before: { promptPerMillion: 0.75, candidatePerMillion: 3.75 },
221
+ after: { promptPerMillion: 1.5, candidatePerMillion: 7.5 },
222
+ switchAtMs: GEMINI_3_8_FLASH_INTRO_RATE_ENDS,
223
+ },
224
+ // Launch rate $2 / $10 per MTok until 30 Nov 2026, then $4 / $20 — `dated`, like
225
+ // gemini-3.8-flash above. Selected by the `at` argument of `geminiRatesFor` (default: now).
212
226
  // https://ai.google.dev/gemini-api/docs/pricing
213
- 'gemini-3.8-flash': { kind: 'flat', rate: { promptPerMillion: 0.75, candidatePerMillion: 3.75 } },
227
+ 'gemini-4-argon': {
228
+ kind: 'dated',
229
+ before: { promptPerMillion: 2, candidatePerMillion: 10 },
230
+ after: { promptPerMillion: 4, candidatePerMillion: 20 },
231
+ switchAtMs: GEMINI_4_ARGON_LAUNCH_RATE_ENDS,
232
+ },
214
233
  'gemini-3.1-pro-preview': {
215
234
  kind: 'tiered',
216
235
  standard: { promptPerMillion: 2.0, candidatePerMillion: 12.0 },
@@ -230,23 +249,36 @@ const GEMINI_PRICING = {
230
249
  * Unlike Anthropic's, this accessor is not a pure function of the model, which is
231
250
  * why there is no single `ratesFor(model)` across both providers.
232
251
  *
252
+ * `at` is the instant the request is priced at, and only matters for a `dated` model (one with a
253
+ * scheduled rate change); every other model ignores it. Defaults to now, which is right
254
+ * for pricing a request as it happens — pass the request's own timestamp when re-pricing history.
255
+ *
233
256
  * @beta
234
257
  */
235
- export function geminiRatesFor(model, promptTokens) {
258
+ export function geminiRatesFor(model, promptTokens, at = new Date()) {
236
259
  const pricing = GEMINI_PRICING[model];
237
260
  if (pricing.kind === 'flat') {
238
261
  return pricing.rate;
239
262
  }
263
+ if (pricing.kind === 'dated') {
264
+ return at.getTime() < pricing.switchAtMs ? pricing.before : pricing.after;
265
+ }
240
266
  return promptTokens > GEMINI_LONG_CONTEXT_THRESHOLD ? pricing.longContext : pricing.standard;
241
267
  }
242
268
  /**
243
269
  * Cost one Gemini request.
244
270
  *
271
+ * @remarks
272
+ * `at` is the instant the request is priced at, and only matters for a `dated` model (one with a
273
+ * scheduled rate change). It defaults to now, which is right for costing a request as it
274
+ * happens — pass the request's own timestamp when re-pricing stored usage, or the rate in force
275
+ * today is applied to historical requests.
276
+ *
245
277
  * @beta
246
278
  */
247
- export function geminiTokenCost(model, usage) {
279
+ export function geminiTokenCost(model, usage, at = new Date()) {
248
280
  // The pricing TIER is chosen on the full prompt size, BEFORE the cache split.
249
- const { promptPerMillion, candidatePerMillion } = geminiRatesFor(model, usage.promptTokens);
281
+ const { promptPerMillion, candidatePerMillion } = geminiRatesFor(model, usage.promptTokens, at);
250
282
  const m = TOKENS_PER_MILLION;
251
283
  const uncachedPromptTokens = Math.max(0, usage.promptTokens - usage.cachedTokens);
252
284
  const promptCost = (uncachedPromptTokens / m) * promptPerMillion;
@@ -10959,7 +10959,7 @@
10959
10959
  {
10960
10960
  "kind": "Variable",
10961
10961
  "canonicalReference": "@genesislcap/foundation-ai!DEFAULT_AI_TIERS:var",
10962
- "docComment": "/**\n * The platform's default tier table.\n *\n * @remarks\n *\n * Frozen, because it is shared by every app in the process: {@link resolveAITiers} returns a fresh object for callers that override, and hands this back untouched for callers that do not.\n *\n * The models are the ones Genesis Create has been running these tiers on in production — except Anthropic's `reasoning`, moved to `claude-opus-4-8` (see its entry) — and they are a **benchmark result, not a preference**: re-bench before moving one. Two of the Gemini defaults carry a caveat recorded beside them, a preview model and an introductory rate. Two dates are already on the calendar for that: `gemini-3.8-flash` sits on an introductory rate that doubles on 2027-01-01 (at which point it is dearer on input than the model it replaced), and `token-cost.test.ts` fails the build that day; `ai-tiers.test.ts` fails alongside it saying the High tier is the thing to re-bench.\n *\n * Every model here must be in `SUPPORTED_*_MODEL_IDS` with a context limit and a price — pinned by tests, because an unpriced model silently bills at nothing.\n *\n * @beta\n */\n",
10962
+ "docComment": "/**\n * The platform's default tier table.\n *\n * @remarks\n *\n * Frozen, because it is shared by every app in the process: {@link resolveAITiers} returns a fresh object for callers that override, and hands this back untouched for callers that do not.\n *\n * The models are the ones Genesis Create has been running these tiers on in production — except Anthropic's `reasoning`, moved to `claude-opus-4-8` (see its entry) — and they are a **benchmark result, not a preference**: re-bench before moving one. Two of the Gemini defaults carry a caveat recorded beside them, a preview model and an introductory rate. One date is already on the calendar for that: `gemini-3.8-flash` sits on an introductory rate that doubles on 2027-01-01 (at which point it no longer undercuts the model it replaced on input). Its price switches on its own that day; `ai-tiers.test.ts` fails the build on the same day, saying the High tier is the thing to re-bench.\n *\n * Every model here must be in `SUPPORTED_*_MODEL_IDS` with a context limit and a price — pinned by tests, because an unpriced model silently bills at nothing.\n *\n * @beta\n */\n",
10963
10963
  "excerptTokens": [
10964
10964
  {
10965
10965
  "kind": "Content",
@@ -11285,7 +11285,7 @@
11285
11285
  },
11286
11286
  {
11287
11287
  "kind": "Content",
11288
- "text": "'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-lite' | 'gemini-3.8-flash' | 'gemini-3.5-flash' | 'gemini-3.1-flash-lite' | 'gemini-3.1-pro-preview'"
11288
+ "text": "'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-lite' | 'gemini-4-argon' | 'gemini-3.8-flash' | 'gemini-3.5-flash' | 'gemini-3.1-flash-lite' | 'gemini-3.1-pro-preview'"
11289
11289
  },
11290
11290
  {
11291
11291
  "kind": "Content",
@@ -11780,7 +11780,7 @@
11780
11780
  {
11781
11781
  "kind": "Function",
11782
11782
  "canonicalReference": "@genesislcap/foundation-ai!geminiRatesFor:function(1)",
11783
- "docComment": "/**\n * Resolve the per-million-token rates for a model given the request's prompt size, selecting the long-context tier for tiered models when the prompt exceeds {@link GEMINI_LONG_CONTEXT_THRESHOLD}.\n *\n * @remarks\n *\n * `promptTokens` must be the **full** prompt size, cached slice included — the tier is chosen on what was sent, not on what was billed at full rate. A mostly-cached long prompt is still a long prompt.\n *\n * Unlike Anthropic's, this accessor is not a pure function of the model, which is why there is no single `ratesFor(model)` across both providers.\n *\n * @beta\n */\n",
11783
+ "docComment": "/**\n * Resolve the per-million-token rates for a model given the request's prompt size, selecting the long-context tier for tiered models when the prompt exceeds {@link GEMINI_LONG_CONTEXT_THRESHOLD}.\n *\n * @remarks\n *\n * `promptTokens` must be the **full** prompt size, cached slice included — the tier is chosen on what was sent, not on what was billed at full rate. A mostly-cached long prompt is still a long prompt.\n *\n * Unlike Anthropic's, this accessor is not a pure function of the model, which is why there is no single `ratesFor(model)` across both providers.\n *\n * `at` is the instant the request is priced at, and only matters for a `dated` model (one with a scheduled rate change); every other model ignores it. Defaults to now, which is right for pricing a request as it happens — pass the request's own timestamp when re-pricing history.\n *\n * @beta\n */\n",
11784
11784
  "excerptTokens": [
11785
11785
  {
11786
11786
  "kind": "Content",
@@ -11799,6 +11799,15 @@
11799
11799
  "kind": "Content",
11800
11800
  "text": "number"
11801
11801
  },
11802
+ {
11803
+ "kind": "Content",
11804
+ "text": ", at?: "
11805
+ },
11806
+ {
11807
+ "kind": "Reference",
11808
+ "text": "Date",
11809
+ "canonicalReference": "!Date:interface"
11810
+ },
11802
11811
  {
11803
11812
  "kind": "Content",
11804
11813
  "text": "): "
@@ -11815,8 +11824,8 @@
11815
11824
  ],
11816
11825
  "fileUrlPath": "src/utils/token-cost.ts",
11817
11826
  "returnTypeTokenRange": {
11818
- "startIndex": 5,
11819
- "endIndex": 6
11827
+ "startIndex": 7,
11828
+ "endIndex": 8
11820
11829
  },
11821
11830
  "releaseTag": "Beta",
11822
11831
  "overloadIndex": 1,
@@ -11836,6 +11845,14 @@
11836
11845
  "endIndex": 4
11837
11846
  },
11838
11847
  "isOptional": false
11848
+ },
11849
+ {
11850
+ "parameterName": "at",
11851
+ "parameterTypeTokenRange": {
11852
+ "startIndex": 5,
11853
+ "endIndex": 6
11854
+ },
11855
+ "isOptional": true
11839
11856
  }
11840
11857
  ],
11841
11858
  "name": "geminiRatesFor"
@@ -11943,7 +11960,7 @@
11943
11960
  {
11944
11961
  "kind": "Function",
11945
11962
  "canonicalReference": "@genesislcap/foundation-ai!geminiTokenCost:function(1)",
11946
- "docComment": "/**\n * Cost one Gemini request.\n *\n * @beta\n */\n",
11963
+ "docComment": "/**\n * Cost one Gemini request.\n *\n * @remarks\n *\n * `at` is the instant the request is priced at, and only matters for a `dated` model (one with a scheduled rate change). It defaults to now, which is right for costing a request as it happens — pass the request's own timestamp when re-pricing stored usage, or the rate in force today is applied to historical requests.\n *\n * @beta\n */\n",
11947
11964
  "excerptTokens": [
11948
11965
  {
11949
11966
  "kind": "Content",
@@ -11963,6 +11980,15 @@
11963
11980
  "text": "GeminiUsageRecord",
11964
11981
  "canonicalReference": "@genesislcap/foundation-ai!GeminiUsageRecord:interface"
11965
11982
  },
11983
+ {
11984
+ "kind": "Content",
11985
+ "text": ", at?: "
11986
+ },
11987
+ {
11988
+ "kind": "Reference",
11989
+ "text": "Date",
11990
+ "canonicalReference": "!Date:interface"
11991
+ },
11966
11992
  {
11967
11993
  "kind": "Content",
11968
11994
  "text": "): "
@@ -11979,8 +12005,8 @@
11979
12005
  ],
11980
12006
  "fileUrlPath": "src/utils/token-cost.ts",
11981
12007
  "returnTypeTokenRange": {
11982
- "startIndex": 5,
11983
- "endIndex": 6
12008
+ "startIndex": 7,
12009
+ "endIndex": 8
11984
12010
  },
11985
12011
  "releaseTag": "Beta",
11986
12012
  "overloadIndex": 1,
@@ -12000,6 +12026,14 @@
12000
12026
  "endIndex": 4
12001
12027
  },
12002
12028
  "isOptional": false
12029
+ },
12030
+ {
12031
+ "parameterName": "at",
12032
+ "parameterTypeTokenRange": {
12033
+ "startIndex": 5,
12034
+ "endIndex": 6
12035
+ },
12036
+ "isOptional": true
12003
12037
  }
12004
12038
  ],
12005
12039
  "name": "geminiTokenCost"
@@ -2967,10 +2967,10 @@ export declare const DEFAULT_AI_SERVICE_ERROR_MESSAGES: Readonly<Record<AIServic
2967
2967
  * The models are the ones Genesis Create has been running these tiers on in production — except
2968
2968
  * Anthropic's `reasoning`, moved to `claude-opus-4-8` (see its entry) — and they are a
2969
2969
  * **benchmark result, not a preference**: re-bench before moving one. Two of the Gemini
2970
- * defaults carry a caveat recorded beside them, a preview model and an introductory rate. Two dates
2971
- * are already on the calendar for that: `gemini-3.8-flash` sits on an introductory rate that
2972
- * doubles on 2027-01-01 (at which point it is dearer on input than the model it replaced),
2973
- * and `token-cost.test.ts` fails the build that day; `ai-tiers.test.ts` fails alongside it
2970
+ * defaults carry a caveat recorded beside them, a preview model and an introductory rate. One date
2971
+ * is already on the calendar for that: `gemini-3.8-flash` sits on an introductory rate that
2972
+ * doubles on 2027-01-01 (at which point it no longer undercuts the model it replaced on input).
2973
+ * Its price switches on its own that day; `ai-tiers.test.ts` fails the build on the same day,
2974
2974
  * saying the High tier is the thing to re-bench.
2975
2975
  *
2976
2976
  * Every model here must be in `SUPPORTED_*_MODEL_IDS` with a context limit and a price —
@@ -3094,7 +3094,7 @@ export declare interface GeminiAIConfig extends AIProviderConfig {
3094
3094
  *
3095
3095
  * @beta
3096
3096
  */
3097
- export declare type GeminiModelId = 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-lite' | 'gemini-3.8-flash' | 'gemini-3.5-flash' | 'gemini-3.1-flash-lite' | 'gemini-3.1-pro-preview';
3097
+ export declare type GeminiModelId = 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-lite' | 'gemini-4-argon' | 'gemini-3.8-flash' | 'gemini-3.5-flash' | 'gemini-3.1-flash-lite' | 'gemini-3.1-pro-preview';
3098
3098
 
3099
3099
  /**
3100
3100
  * Gemini AI provider. Uses {@link GeminiTransport} to handle requests.
@@ -3130,9 +3130,13 @@ declare interface GeminiProviderConfig {
3130
3130
  * Unlike Anthropic's, this accessor is not a pure function of the model, which is
3131
3131
  * why there is no single `ratesFor(model)` across both providers.
3132
3132
  *
3133
+ * `at` is the instant the request is priced at, and only matters for a `dated` model (one with a
3134
+ * scheduled rate change); every other model ignores it. Defaults to now, which is right
3135
+ * for pricing a request as it happens — pass the request's own timestamp when re-pricing history.
3136
+ *
3133
3137
  * @beta
3134
3138
  */
3135
- export declare function geminiRatesFor(model: GeminiModelId, promptTokens: number): TokenRates;
3139
+ export declare function geminiRatesFor(model: GeminiModelId, promptTokens: number, at?: Date): TokenRates;
3136
3140
 
3137
3141
  /**
3138
3142
  * What one tier is worth on Gemini.
@@ -3153,9 +3157,15 @@ export declare interface GeminiTierConfig {
3153
3157
  /**
3154
3158
  * Cost one Gemini request.
3155
3159
  *
3160
+ * @remarks
3161
+ * `at` is the instant the request is priced at, and only matters for a `dated` model (one with a
3162
+ * scheduled rate change). It defaults to now, which is right for costing a request as it
3163
+ * happens — pass the request's own timestamp when re-pricing stored usage, or the rate in force
3164
+ * today is applied to historical requests.
3165
+ *
3156
3166
  * @beta
3157
3167
  */
3158
- export declare function geminiTokenCost(model: GeminiModelId, usage: GeminiUsageRecord): TokenCost;
3168
+ export declare function geminiTokenCost(model: GeminiModelId, usage: GeminiUsageRecord, at?: Date): TokenCost;
3159
3169
 
3160
3170
  /**
3161
3171
  * Transport for Gemini. Calls the Gemini REST API directly when `apiKey` is
@@ -3204,8 +3214,8 @@ export declare class GeminiTransport implements AITransport, ChatTransport, Cost
3204
3214
  * default posture. Without this, a caller asking for `high` on `gemini-2.5-pro` and quietly
3205
3215
  * getting the default is left to wonder why.
3206
3216
  * - A graded depth whose DIALECT a Gemini 3 tier speaks but whose particular value it does not
3207
- * accept — `minimal` on `gemini-3.8-flash` or `gemini-3.1-pro-preview`, the two tiers that
3208
- * reject it outright. Nothing is dropped here; `clampThinkingLevel` MOVES the level onto the
3217
+ * accept — `minimal` on `gemini-4-argon`, `gemini-3.8-flash` or `gemini-3.1-pro-preview`, the tiers
3218
+ * that reject it outright. Nothing is dropped here; `clampThinkingLevel` MOVES the level onto the
3209
3219
  * nearest one the tier takes, and since ties resolve upward the move is usually to something
3210
3220
  * DEARER than the caller chose. A cost decision reversed on the wire in the expensive
3211
3221
  * direction is exactly what this warning exists for — without it the only trace is the bill.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/foundation-ai",
3
3
  "description": "Genesis Foundation AI - Provider-agnostic AI configuration and shared utilities",
4
- "version": "15.88.1",
4
+ "version": "15.89.0",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -49,16 +49,16 @@
49
49
  }
50
50
  },
51
51
  "devDependencies": {
52
- "@genesislcap/foundation-testing": "15.88.1",
53
- "@genesislcap/genx": "15.88.1",
54
- "@genesislcap/ts-builder": "15.88.1",
55
- "@genesislcap/uvu-playwright-builder": "15.88.1",
56
- "@genesislcap/vite-builder": "15.88.1",
57
- "@genesislcap/webpack-builder": "15.88.1"
52
+ "@genesislcap/foundation-testing": "15.89.0",
53
+ "@genesislcap/genx": "15.89.0",
54
+ "@genesislcap/ts-builder": "15.89.0",
55
+ "@genesislcap/uvu-playwright-builder": "15.89.0",
56
+ "@genesislcap/vite-builder": "15.89.0",
57
+ "@genesislcap/webpack-builder": "15.89.0"
58
58
  },
59
59
  "dependencies": {
60
- "@genesislcap/foundation-logger": "15.88.1",
61
- "@genesislcap/foundation-utils": "15.88.1",
60
+ "@genesislcap/foundation-logger": "15.89.0",
61
+ "@genesislcap/foundation-utils": "15.89.0",
62
62
  "@microsoft/fast-foundation": "2.50.0"
63
63
  },
64
64
  "repository": {