@molecule/api-resource-ai-models 1.0.2 → 1.2.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/dist/types.d.ts CHANGED
@@ -232,6 +232,60 @@ export interface ModelDefinition {
232
232
  }[];
233
233
  multiplier: number;
234
234
  };
235
+ /**
236
+ * A price change the provider has ANNOUNCED with a dated effective instant,
237
+ * staged ahead of time. Until `effectiveFrom` the model bills at the base
238
+ * rates above; from that instant on, these rates replace them.
239
+ *
240
+ * This exists because the freshness gate can only ever see prices that are
241
+ * ALREADY live: it diffs the catalog against models.dev's *current* rates, so
242
+ * a change announced today and effective in three days is invisible to it
243
+ * until after it lands — and the cron runs every 8h, so the catalog would
244
+ * under-meter for up to a third of a day at whatever the new rate is. Landing
245
+ * the new numbers early is not an option either: that over-bills every turn
246
+ * until the switch (the exact mistake the removed DeepSeek peak windows made
247
+ * for weeks against the free-tier default model). Staging with a timestamp is
248
+ * the only form that is correct on BOTH sides of the instant, and it needs no
249
+ * one awake at the switch.
250
+ *
251
+ * Applies to the BASE rates only — a `regionPricing` entry is a different
252
+ * host's rate card (a US re-host does not reprice because the native provider
253
+ * did) and is never touched by a scheduled change.
254
+ *
255
+ * `peakPricing` here, when declared, replaces the model's peak windows from
256
+ * the same instant; when omitted, the model's existing windows carry through
257
+ * unchanged. To schedule the END of peak pricing, declare an explicit
258
+ * `{ windows: [], multiplier: 1 }`.
259
+ *
260
+ * Resolution is `effectiveBaseRates()` / `effectivePeakPricing()`, and every
261
+ * consumer reaches it through `modelRegionRates()` / `priceMultiplierAt()` /
262
+ * the `withEffectivePricing()` projection the list handler serves — so a
263
+ * scheduled change lands everywhere at once with no follow-up edit. Once the
264
+ * instant has passed, fold the rates into the base fields and delete this
265
+ * (the freshness gate now verifies them against models.dev normally).
266
+ */
267
+ scheduledPricing?: {
268
+ /** ISO-8601 UTC instant the new rates take effect. */
269
+ effectiveFrom: string;
270
+ /** Input price per million *uncached* tokens in USD, from `effectiveFrom`. */
271
+ inputPricePerMTok: number;
272
+ /** Output price per million tokens in USD, from `effectiveFrom`. */
273
+ outputPricePerMTok: number;
274
+ /** Prompt-cache *read* price per million tokens in USD, from `effectiveFrom`. */
275
+ cacheReadPricePerMTok: number;
276
+ /** Prompt-cache *write* price per million tokens in USD, from `effectiveFrom`. */
277
+ cacheWritePricePerMTok: number;
278
+ /** Peak-hour pricing from `effectiveFrom` (omitted → existing windows carry through). */
279
+ peakPricing?: {
280
+ windows: {
281
+ startMinuteUtc: number;
282
+ endMinuteUtc: number;
283
+ }[];
284
+ multiplier: number;
285
+ };
286
+ /** Where the change was announced, for the re-verify pass after it lands. */
287
+ source?: string;
288
+ };
235
289
  /**
236
290
  * Fast-mode ("priority speed") pricing — the per-MTok rates billed when a
237
291
  * request runs with the provider's fast/priority tier (e.g. Anthropic's
@@ -282,6 +336,35 @@ export interface ModelDefinition {
282
336
  * or its past usage silently meters as free. Omit entirely for active models.
283
337
  */
284
338
  disabled?: boolean;
339
+ /**
340
+ * The id of the NEWER-generation model that replaces this one, set on the
341
+ * OLDER entry and naming its successor (e.g. `qwen3.7-max` carries
342
+ * `supersededBy: 'qwen3.8-max'`).
343
+ *
344
+ * A superseded model is NOT selectable — like {@link disabled} it is excluded
345
+ * from `MODEL_IDS`, `getAvailableModels()`, the `GET /ai/models` listing and
346
+ * the client-side picker partitions, so a user is only ever offered the
347
+ * newest generation of a family. It differs from `disabled` in *why* and in
348
+ * what it points at: a disabled model is one the provider retired (it can no
349
+ * longer answer), whereas a superseded model is usually still served upstream
350
+ * and simply has nothing to offer over its successor — and the successor id
351
+ * is a real migration target, so a saved selection can resolve forward
352
+ * (`resolveSelectableModelId`) instead of silently falling back to the
353
+ * platform default.
354
+ *
355
+ * `getModel(id)` STILL returns a superseded entry — historical usage must stay
356
+ * priceable, so NEVER delete one.
357
+ *
358
+ * Set this ONLY when the successor covers the same TIER. A cheaper or
359
+ * specialist tier with no newer equivalent is NOT superseded merely because
360
+ * its version number is lower (Google's sole pro tier `gemini-3.1-pro-preview`
361
+ * alongside the newer flash flagship; `qwen3-coder-plus`; `kimi-k2.7-code`) —
362
+ * hiding those would leave a provider with no cheap option. Mark those
363
+ * {@link deprecatedAt} at most. The invariant is enforced by
364
+ * `__tests__/lookup.test.ts`: two selectable models of the same family at
365
+ * different versions fail unless listed there as a documented exception.
366
+ */
367
+ supersededBy?: string;
285
368
  }
286
369
  /**
287
370
  * The model ids the SERVER falls back to per mode/job when the user hasn't
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GACpB,WAAW,GACX,QAAQ,GACR,QAAQ,GACR,KAAK,GACL,UAAU,GACV,MAAM,GACN,UAAU,GACV,SAAS,GACT,SAAS,GACT,OAAO;AACT;;;;;GAKG;GACD,QAAQ,CAAA;AAEZ;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAA;AAEhC;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,8DAA8D;IAC9D,EAAE,EAAE,MAAM,CAAA;IACV,2CAA2C;IAC3C,QAAQ,EAAE,YAAY,CAAA;IACtB,yDAAyD;IACzD,KAAK,EAAE,MAAM,CAAA;IACb,wCAAwC;IACxC,WAAW,EAAE,MAAM,CAAA;IACnB,8CAA8C;IAC9C,aAAa,EAAE,MAAM,CAAA;IACrB,0CAA0C;IAC1C,eAAe,EAAE,MAAM,CAAA;IACvB,uEAAuE;IACvE,gBAAgB,EAAE,OAAO,CAAA;IACzB,yFAAyF;IACzF,oBAAoB,EAAE,MAAM,CAAA;IAC5B;;;OAGG;IACH,oBAAoB,EAAE,OAAO,CAAA;IAC7B;;;;;;;;;;;;;;;;;;;OAmBG;IACH,qBAAqB,CAAC,EAAE,WAAW,EAAE,CAAA;IACrC;;;;OAIG;IACH,kBAAkB,CAAC,EAAE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CAAC,EAAE;QACZ,gEAAgE;QAChE,iBAAiB,EAAE,MAAM,CAAA;QACzB,wDAAwD;QACxD,kBAAkB,EAAE,MAAM,CAAA;QAC1B,mEAAmE;QACnE,qBAAqB,EAAE,MAAM,CAAA;QAC7B,oEAAoE;QACpE,sBAAsB,EAAE,MAAM,CAAA;KAC/B,CAAA;IACD,mDAAmD;IACnD,eAAe,EAAE,MAAM,CAAA;IACvB;;;;;;;;;OASG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,6DAA6D;IAC7D,IAAI,EAAE,MAAM,CAAA;IACZ,gEAAgE;IAChE,OAAO,EAAE,MAAM,CAAA;IACf,8EAA8E;IAC9E,MAAM,EAAE,MAAM,CAAA;IACd,4EAA4E;IAC5E,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,eAAe,EAAE,CAAA;IACzB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,iBAAiB,CAAA;CAC7B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/api-resource-ai-models",
3
- "version": "1.0.2",
3
+ "version": "1.2.0",
4
4
  "description": "AI model catalog — server-side source of truth plus an authentication-gated discovery endpoint",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",