@trazum/core 2.7.11 → 3.0.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.
Files changed (115) hide show
  1. package/README.md +1 -1
  2. package/dist/advisories.d.ts +14 -7
  3. package/dist/advisories.d.ts.map +1 -1
  4. package/dist/advisories.js +27 -20
  5. package/dist/advisories.js.map +1 -1
  6. package/dist/budget.d.ts.map +1 -1
  7. package/dist/budget.js +2 -1
  8. package/dist/budget.js.map +1 -1
  9. package/dist/connector.js +1 -1
  10. package/dist/connector.js.map +1 -1
  11. package/dist/conversation.d.ts.map +1 -1
  12. package/dist/conversation.js +4 -2
  13. package/dist/conversation.js.map +1 -1
  14. package/dist/i18n/en.js +2 -2
  15. package/dist/i18n/en.js.map +1 -1
  16. package/dist/i18n/es.js +2 -2
  17. package/dist/i18n/es.js.map +1 -1
  18. package/dist/i18n/types.d.ts +2 -1
  19. package/dist/i18n/types.d.ts.map +1 -1
  20. package/dist/index.d.ts +3 -1
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +2 -1
  23. package/dist/index.js.map +1 -1
  24. package/dist/input-shape.d.ts.map +1 -1
  25. package/dist/input-shape.js +4 -2
  26. package/dist/input-shape.js.map +1 -1
  27. package/dist/openrouter.d.ts +1 -1
  28. package/dist/openrouter.d.ts.map +1 -1
  29. package/dist/openrouter.js +1 -2
  30. package/dist/openrouter.js.map +1 -1
  31. package/dist/phrases.d.ts +39 -0
  32. package/dist/phrases.d.ts.map +1 -1
  33. package/dist/phrases.js +130 -0
  34. package/dist/phrases.js.map +1 -1
  35. package/dist/pricing-overlay.d.ts +1 -1
  36. package/dist/pricing-overlay.d.ts.map +1 -1
  37. package/dist/pricing-overlay.js +21 -11
  38. package/dist/pricing-overlay.js.map +1 -1
  39. package/dist/pricing.d.ts +33 -6
  40. package/dist/pricing.d.ts.map +1 -1
  41. package/dist/pricing.js +77 -115
  42. package/dist/pricing.js.map +1 -1
  43. package/dist/repeats.d.ts.map +1 -1
  44. package/dist/repeats.js +4 -2
  45. package/dist/repeats.js.map +1 -1
  46. package/dist/reprice.js +1 -1
  47. package/dist/reprice.js.map +1 -1
  48. package/dist/review.js +2 -1
  49. package/dist/review.js.map +1 -1
  50. package/dist/rules.d.ts.map +1 -1
  51. package/dist/rules.js +119 -3
  52. package/dist/rules.js.map +1 -1
  53. package/dist/segment.d.ts +31 -1
  54. package/dist/segment.d.ts.map +1 -1
  55. package/dist/segment.js +128 -2
  56. package/dist/segment.js.map +1 -1
  57. package/dist/session-cost.d.ts.map +1 -1
  58. package/dist/session-cost.js +4 -2
  59. package/dist/session-cost.js.map +1 -1
  60. package/dist/session-ledger.d.ts.map +1 -1
  61. package/dist/session-ledger.js +4 -2
  62. package/dist/session-ledger.js.map +1 -1
  63. package/dist/structure.d.ts +34 -0
  64. package/dist/structure.d.ts.map +1 -1
  65. package/dist/structure.js +143 -12
  66. package/dist/structure.js.map +1 -1
  67. package/dist/truncation-retry.d.ts.map +1 -1
  68. package/dist/truncation-retry.js +4 -2
  69. package/dist/truncation-retry.js.map +1 -1
  70. package/dist/ttl-fit.d.ts.map +1 -1
  71. package/dist/ttl-fit.js +4 -2
  72. package/dist/ttl-fit.js.map +1 -1
  73. package/dist/types.d.ts +17 -7
  74. package/dist/types.d.ts.map +1 -1
  75. package/dist/usage.d.ts.map +1 -1
  76. package/dist/usage.js +13 -12
  77. package/dist/usage.js.map +1 -1
  78. package/dist/watch.d.ts +11 -1
  79. package/dist/watch.d.ts.map +1 -1
  80. package/dist/watch.js.map +1 -1
  81. package/dist/weekly.d.ts +140 -0
  82. package/dist/weekly.d.ts.map +1 -0
  83. package/dist/weekly.js +176 -0
  84. package/dist/weekly.js.map +1 -0
  85. package/dist/write.js +2 -2
  86. package/dist/write.js.map +1 -1
  87. package/package.json +1 -1
  88. package/src/advisories.ts +41 -25
  89. package/src/budget.ts +2 -1
  90. package/src/connector.ts +1 -1
  91. package/src/conversation.ts +4 -2
  92. package/src/i18n/en.ts +2 -2
  93. package/src/i18n/es.ts +2 -2
  94. package/src/i18n/types.ts +2 -1
  95. package/src/index.ts +4 -2
  96. package/src/input-shape.ts +4 -2
  97. package/src/openrouter.ts +1 -2
  98. package/src/phrases.ts +134 -0
  99. package/src/pricing-overlay.ts +23 -14
  100. package/src/pricing.ts +82 -120
  101. package/src/repeats.ts +4 -2
  102. package/src/reprice.ts +1 -1
  103. package/src/review.ts +1 -1
  104. package/src/rules.ts +135 -2
  105. package/src/segment.ts +131 -3
  106. package/src/session-cost.ts +4 -2
  107. package/src/session-ledger.ts +4 -2
  108. package/src/structure.ts +152 -13
  109. package/src/truncation-retry.ts +4 -2
  110. package/src/ttl-fit.ts +4 -2
  111. package/src/types.ts +18 -7
  112. package/src/usage.ts +13 -12
  113. package/src/watch.ts +12 -1
  114. package/src/weekly.ts +281 -0
  115. package/src/write.ts +2 -2
package/src/pricing.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { InferenceGeo, ModelPricing, PricingTier, ServiceTier, TierCondition } from './types.js';
1
+ import type { Capability, InferenceGeo, ModelPricing, PricingTier, ServiceTier, TierCondition } from './types.js';
2
2
 
3
3
  /**
4
4
  * Model and pricing catalogue (USD per million tokens).
@@ -122,10 +122,17 @@ export const PROVIDER_REVIEWED: Readonly<Record<string, string>> = Object.freeze
122
122
  * target's rates. 2.5 Pro carries that as a second period; 2.5 Flash's text
123
123
  * rates are 3.5 Flash-Lite's, so its price does not move. The Gemini 4
124
124
  * family and 3.5 Flash-Lite are priced in their own rows, from the same
125
- * read; the page's other models are still unpriced. Not modelled: the
126
- * Batch tabs of 3.1 Pro Preview and both
127
- * 2.5 models charge the standard cache price, and this table bills a batch
128
- * call's cache reads at half of it, as it does every other rate.
125
+ * read; the page's other models are still unpriced.
126
+ *
127
+ * Batch tabs read again 2026-11-17, for the cache price alone. Six of the
128
+ * nine rows print a batch cache price that is half the standard one, as
129
+ * the batch input is: 4 Carbon, Argon and Hydrogen, 3.8 and 3.6 Flash and
130
+ * 3.5 Flash-Lite. Three do not. 3.1 Pro Preview's reads "Same as Standard",
131
+ * $0.20 and $0.40, and 2.5 Pro's and 2.5 Flash's print the standard figures
132
+ * ($0.125 and $0.25; $0.03). Those three carry `batchCacheRead: 0.2`: the
133
+ * cache price over the batch input, where a standard call reads at 0.1.
134
+ * For the two 2.5 models it ends on 2026-12-01, when they are billed at
135
+ * the rates of 3.8 Flash and 3.5 Flash-Lite, whose Batch tabs halve it.
129
136
  */
130
137
  google: '2026-11-16',
131
138
  /*
@@ -236,25 +243,39 @@ export const COST_MULTIPLIERS = {
236
243
  * should fall back to the default.
237
244
  */
238
245
  /** Memoised for the same reason as `effectivePricing`: once per record. */
239
- const multipliersMemo = new WeakMap<
240
- ModelPricing,
241
- { cacheWrite5m: number; cacheWrite1h: number; cacheRead: number; batch: number | null }
242
- >();
246
+ type Multipliers = { cacheWrite5m: number; cacheWrite1h: number; cacheRead: number; batch: number | null };
247
+ const multipliersMemo = new WeakMap<ModelPricing, Multipliers>();
248
+ const batchMultipliersMemo = new WeakMap<ModelPricing, Multipliers>();
243
249
 
244
- export function multipliersFor(model: ModelPricing, on?: Date): {
245
- cacheWrite5m: number;
246
- cacheWrite1h: number;
247
- cacheRead: number;
248
- batch: number | null;
249
- } {
250
+ /**
251
+ * The cache and batch ratios of a row, at a date and for a kind of call.
252
+ *
253
+ * `how` is the same context `effectivePricing` is given, and it matters for
254
+ * one figure. Every ratio here multiplies the input rate `effectivePricing`
255
+ * returned, which for a batch call is already the batch rate. Where a
256
+ * provider's Batch table charges the cache at something other than the
257
+ * standard share of that halved input, the row says so in `batchCacheRead`,
258
+ * and a batch call gets that as its `cacheRead`. Until 2.7.12 nothing asked
259
+ * how the call ran: Google's Batch tab for Gemini 3.1 Pro Preview and both
260
+ * 2.5 models prints "Same as Standard" for the cache, and a batch call's
261
+ * cache reads on them were billed at half of what the page charges.
262
+ */
263
+ export function multipliersFor(model: ModelPricing, on?: Date, how?: { batch?: boolean }): Multipliers {
250
264
  // A dated question about a repriced model asks the period in force then.
251
265
  if (on !== undefined && model.history !== undefined) {
252
266
  const period = pricedAt(model, on);
253
- if (period !== model) return multipliersFor(period);
267
+ if (period !== model) return multipliersFor(period, undefined, how);
268
+ }
269
+ const m = model.multipliers ?? {};
270
+ if (how?.batch === true && m.batchCacheRead !== undefined && m.batch !== null) {
271
+ const cached = batchMultipliersMemo.get(model);
272
+ if (cached !== undefined) return cached;
273
+ const result = Object.freeze({ ...multipliersFor(model), cacheRead: m.batchCacheRead });
274
+ batchMultipliersMemo.set(model, result);
275
+ return result;
254
276
  }
255
277
  const cached = multipliersMemo.get(model);
256
278
  if (cached !== undefined) return cached;
257
- const m = model.multipliers ?? {};
258
279
  const result = Object.freeze({
259
280
  cacheWrite5m: m.cacheWrite5m ?? COST_MULTIPLIERS.cacheWrite5m,
260
281
  cacheWrite1h: m.cacheWrite1h ?? COST_MULTIPLIERS.cacheWrite1h,
@@ -418,7 +439,6 @@ export const MODELS: ModelPricing[] = [
418
439
  */
419
440
  tiers: [{ id: 'fast', when: { kind: 'speed', speed: 'fast' }, inputPerMTok: 16, outputPerMTok: 80 }],
420
441
  capability: 'frontier',
421
- tier: 'frontier',
422
442
  notes: 'Cache hits cost 2.5% of the input price ($0.20). Fast mode (usage.speed "fast") bills $16/$80.'
423
443
  + ' Requires 30-day data retention.',
424
444
  },
@@ -445,7 +465,6 @@ export const MODELS: ModelPricing[] = [
445
465
  multipliers: { cacheRead: 0.025, cacheWrite5m: 1.25, cacheWrite1h: 2, batch: 0.5 },
446
466
  tiers: [{ id: 'fast', when: { kind: 'speed', speed: 'fast' }, inputPerMTok: 16, outputPerMTok: 80 }],
447
467
  capability: 'frontier',
448
- tier: 'frontier',
449
468
  notes:
450
469
  'Available only to organizations verified through Anthropic\'s verification programs.'
451
470
  + ' Fast mode (usage.speed "fast") bills $16/$80. Requires 30-day data retention.',
@@ -473,7 +492,6 @@ export const MODELS: ModelPricing[] = [
473
492
  cacheMinTokens: 512,
474
493
  multipliers: { cacheRead: 0.025, cacheWrite5m: 1.25, cacheWrite1h: 2, batch: 0.5 },
475
494
  capability: 'frontier',
476
- tier: 'frontier',
477
495
  notes: 'Legacy: superseded by Claude Fable 5.2, which costs less ($8/$40). Cache hits cost 2.5% of the input'
478
496
  + ' price ($0.25). Requires 30-day data retention.',
479
497
  },
@@ -495,7 +513,6 @@ export const MODELS: ModelPricing[] = [
495
513
  cacheMinTokens: 512,
496
514
  multipliers: { cacheRead: 0.025, cacheWrite5m: 1.25, cacheWrite1h: 2, batch: 0.5 },
497
515
  capability: 'frontier',
498
- tier: 'frontier',
499
516
  notes:
500
517
  'Available only to organizations verified through Anthropic\'s verification programs.'
501
518
  + ' Requires 30-day data retention.',
@@ -511,7 +528,6 @@ export const MODELS: ModelPricing[] = [
511
528
  contextWindow: 1_000_000,
512
529
  cacheMinTokens: 512,
513
530
  capability: 'frontier',
514
- tier: 'frontier',
515
531
  notes: 'Legacy: superseded by Claude Fable 5.1 at the same prices. Requires 30-day data retention.',
516
532
  },
517
533
  {
@@ -526,7 +542,6 @@ export const MODELS: ModelPricing[] = [
526
542
  contextWindow: 1_000_000,
527
543
  cacheMinTokens: 512,
528
544
  capability: 'frontier',
529
- tier: 'frontier',
530
545
  notes:
531
546
  'Available only to organizations verified through Anthropic\'s verification programs.'
532
547
  + ' Requires 30-day data retention.',
@@ -557,7 +572,6 @@ export const MODELS: ModelPricing[] = [
557
572
  */
558
573
  tiers: [{ id: 'fast', when: { kind: 'speed', speed: 'fast' }, inputPerMTok: 8, outputPerMTok: 40 }],
559
574
  capability: 'large',
560
- tier: 'opus',
561
575
  notes: 'Cache hits cost 5% of the input price ($0.20), against 10% on Opus 5 and earlier.'
562
576
  + ' Fast mode (usage.speed "fast") bills $8/$40.',
563
577
  },
@@ -574,7 +588,6 @@ export const MODELS: ModelPricing[] = [
574
588
  // Fast mode in research preview, $10/$50; same sources as Opus 5.5's.
575
589
  tiers: [{ id: 'fast', when: { kind: 'speed', speed: 'fast' }, inputPerMTok: 10, outputPerMTok: 50 }],
576
590
  capability: 'large',
577
- tier: 'opus',
578
591
  notes: '512-token cache minimum: caches prompts that would miss on Opus 4.6. Fast mode bills $10/$50.',
579
592
  },
580
593
  {
@@ -594,7 +607,6 @@ export const MODELS: ModelPricing[] = [
594
607
  */
595
608
  tiers: [{ id: 'fast', when: { kind: 'speed', speed: 'fast' }, inputPerMTok: 10, outputPerMTok: 50 }],
596
609
  capability: 'large',
597
- tier: 'opus',
598
610
  notes: 'Fast mode bills $10/$50 until it is removed from this model on 2026-11-30.',
599
611
  },
600
612
  {
@@ -608,7 +620,6 @@ export const MODELS: ModelPricing[] = [
608
620
  contextWindow: 1_000_000,
609
621
  cacheMinTokens: 2048,
610
622
  capability: 'large',
611
- tier: 'opus',
612
623
  },
613
624
  {
614
625
  id: 'claude-opus-4-6',
@@ -621,7 +632,6 @@ export const MODELS: ModelPricing[] = [
621
632
  contextWindow: 1_000_000,
622
633
  cacheMinTokens: 4096,
623
634
  capability: 'large',
624
- tier: 'opus',
625
635
  },
626
636
  {
627
637
  /*
@@ -642,7 +652,6 @@ export const MODELS: ModelPricing[] = [
642
652
  contextWindow: 200_000,
643
653
  cacheMinTokens: 4096,
644
654
  capability: 'large',
645
- tier: 'opus',
646
655
  notes: '200K context window and a 64K output cap.',
647
656
  },
648
657
  {
@@ -668,7 +677,6 @@ export const MODELS: ModelPricing[] = [
668
677
  contextWindow: 200_000,
669
678
  cacheMinTokens: 1024,
670
679
  capability: 'large',
671
- tier: 'opus',
672
680
  notes:
673
681
  'Retired on the Claude API on 2026-08-05; still served on Google Cloud (Google managed) and Bedrock.'
674
682
  + ' Anthropic names Claude Opus 4.8 as the replacement.',
@@ -689,7 +697,6 @@ export const MODELS: ModelPricing[] = [
689
697
  contextWindow: 200_000,
690
698
  cacheMinTokens: 1024,
691
699
  capability: 'large',
692
- tier: 'opus',
693
700
  notes:
694
701
  'Retired on the Claude API on 2026-06-15; still served on Google Cloud (Google managed).'
695
702
  + ' Anthropic names Claude Opus 4.8 as the replacement.',
@@ -711,7 +718,6 @@ export const MODELS: ModelPricing[] = [
711
718
  cacheMinTokens: 512,
712
719
  multipliers: { cacheRead: 0.05, cacheWrite5m: 1.25, cacheWrite1h: 2, batch: 0.5 },
713
720
  capability: 'mid',
714
- tier: 'sonnet',
715
721
  notes: 'Cache hits cost 5% of the input price ($0.10), against 10% ($0.20) on Sonnet 5.',
716
722
  },
717
723
  {
@@ -725,7 +731,6 @@ export const MODELS: ModelPricing[] = [
725
731
  contextWindow: 1_000_000,
726
732
  cacheMinTokens: 1024,
727
733
  capability: 'mid',
728
- tier: 'sonnet',
729
734
  notes:
730
735
  'Launched with 2/10 as introductory pricing through 2026-08-31; the scheduled'
731
736
  + ' increase to 3/15 on 2026-09-01 was cancelled and 2/10 is the standard price.',
@@ -741,7 +746,6 @@ export const MODELS: ModelPricing[] = [
741
746
  contextWindow: 1_000_000,
742
747
  cacheMinTokens: 1024,
743
748
  capability: 'mid',
744
- tier: 'sonnet',
745
749
  },
746
750
  {
747
751
  /*
@@ -764,7 +768,6 @@ export const MODELS: ModelPricing[] = [
764
768
  contextWindow: 200_000,
765
769
  cacheMinTokens: 1024,
766
770
  capability: 'mid',
767
- tier: 'sonnet',
768
771
  notes: 'Deprecated; retires 2026-11-30. Recommended replacement: Claude Sonnet 5.5.',
769
772
  },
770
773
  {
@@ -787,7 +790,6 @@ export const MODELS: ModelPricing[] = [
787
790
  contextWindow: 200_000,
788
791
  cacheMinTokens: 1024,
789
792
  capability: 'mid',
790
- tier: 'sonnet',
791
793
  notes:
792
794
  'Retired on the Claude API on 2026-06-15; still served on Google Cloud (Google managed) and Bedrock.'
793
795
  + ' Anthropic names Claude Sonnet 5.5 as the replacement.',
@@ -828,7 +830,6 @@ export const MODELS: ModelPricing[] = [
828
830
  },
829
831
  ],
830
832
  capability: 'small',
831
- tier: 'haiku',
832
833
  notes:
833
834
  'Priced per request by prompt length: $0.10/$0.50 up to 100,000 input tokens, cache reads'
834
835
  + ' and writes included, and $0.50/$2.50 over it.',
@@ -847,7 +848,6 @@ export const MODELS: ModelPricing[] = [
847
848
  contextWindow: 200_000,
848
849
  cacheMinTokens: 4096,
849
850
  capability: 'small',
850
- tier: 'haiku',
851
851
  notes: '200K context window and a 64K output cap, smaller than the rest.',
852
852
  },
853
853
  {
@@ -869,7 +869,6 @@ export const MODELS: ModelPricing[] = [
869
869
  contextWindow: 200_000,
870
870
  cacheMinTokens: 2048,
871
871
  capability: 'small',
872
- tier: 'haiku',
873
872
  notes:
874
873
  'Retired on the Claude API on 2026-02-19; still served on Google Cloud (Google managed).'
875
874
  + ' Anthropic names Claude Haiku 4.5 as the replacement.',
@@ -940,7 +939,6 @@ export const MODELS: ModelPricing[] = [
940
939
  ultrafast: { inputPerMTok: 60, outputPerMTok: 300, tiers: openAiLongBand(120, 450) },
941
940
  },
942
941
  capability: 'frontier',
943
- tier: 'frontier',
944
942
  notes: OPENAI_CURRENT_NOTE,
945
943
  },
946
944
  {
@@ -968,7 +966,6 @@ export const MODELS: ModelPricing[] = [
968
966
  ultrafast: { inputPerMTok: 12, outputPerMTok: 60, tiers: openAiLongBand(24, 90) },
969
967
  },
970
968
  capability: 'large',
971
- tier: 'opus',
972
969
  notes: OPENAI_CURRENT_NOTE,
973
970
  },
974
971
  {
@@ -1001,7 +998,6 @@ export const MODELS: ModelPricing[] = [
1001
998
  fast: { inputPerMTok: 2, outputPerMTok: 10, tiers: openAiLongBand(4, 15) },
1002
999
  },
1003
1000
  capability: 'mid',
1004
- tier: 'sonnet',
1005
1001
  notes: OPENAI_CURRENT_NOTE,
1006
1002
  },
1007
1003
  {
@@ -1028,7 +1024,6 @@ export const MODELS: ModelPricing[] = [
1028
1024
  fast: { inputPerMTok: 4, outputPerMTok: 20, tiers: openAiLongBand(8, 30) },
1029
1025
  },
1030
1026
  capability: 'large',
1031
- tier: 'opus',
1032
1027
  notes: OPENAI_CURRENT_NOTE,
1033
1028
  },
1034
1029
  {
@@ -1055,7 +1050,6 @@ export const MODELS: ModelPricing[] = [
1055
1050
  fast: { inputPerMTok: 0.2, outputPerMTok: 1, tiers: openAiLongBand(0.4, 1.5) },
1056
1051
  },
1057
1052
  capability: 'small',
1058
- tier: 'haiku',
1059
1053
  notes: OPENAI_CURRENT_NOTE,
1060
1054
  },
1061
1055
  {
@@ -1096,7 +1090,6 @@ export const MODELS: ModelPricing[] = [
1096
1090
  fast: { inputPerMTok: 8, outputPerMTok: 40, tiers: openAiLongBand(16, 60) },
1097
1091
  },
1098
1092
  capability: 'large',
1099
- tier: 'opus',
1100
1093
  notes:
1101
1094
  OPENAI_CURRENT_NOTE
1102
1095
  + ' $4/$20 is promotional until 2026-11-30, and OpenAI has not published the price after it as a figure.',
@@ -1125,7 +1118,6 @@ export const MODELS: ModelPricing[] = [
1125
1118
  fast: { inputPerMTok: 4, outputPerMTok: 24, tiers: openAiLongBand(8, 36) },
1126
1119
  },
1127
1120
  capability: 'mid',
1128
- tier: 'sonnet',
1129
1121
  notes: OPENAI_CURRENT_NOTE,
1130
1122
  },
1131
1123
  {
@@ -1152,7 +1144,6 @@ export const MODELS: ModelPricing[] = [
1152
1144
  fast: { inputPerMTok: 0.4, outputPerMTok: 2.4, tiers: openAiLongBand(0.8, 3.6) },
1153
1145
  },
1154
1146
  capability: 'small',
1155
- tier: 'haiku',
1156
1147
  notes: OPENAI_CURRENT_NOTE,
1157
1148
  },
1158
1149
  {
@@ -1183,7 +1174,6 @@ export const MODELS: ModelPricing[] = [
1183
1174
  multipliers: { cacheRead: 0.1, cacheWrite5m: 1.25, cacheWrite1h: 2.5, batch: null },
1184
1175
  cacheTtl: OPENAI_CACHE_TTL,
1185
1176
  capability: 'large',
1186
- tier: 'opus',
1187
1177
  notes:
1188
1178
  'Needs approval through the Daybreak programme. At most 272,000 input tokens, Responses API only, no batch.'
1189
1179
  + ' Cache writes cost 1.25x input for the default 30-minute entry and 2.5x for a 12-hour one.',
@@ -1211,7 +1201,6 @@ export const MODELS: ModelPricing[] = [
1211
1201
  fast: { inputPerMTok: 2.5, outputPerMTok: 20 },
1212
1202
  },
1213
1203
  capability: 'frontier',
1214
- tier: 'frontier',
1215
1204
  notes: OPENAI_GPT5_NOTE + OPENAI_DEPRECATED_SUFFIX,
1216
1205
  },
1217
1206
  {
@@ -1231,7 +1220,6 @@ export const MODELS: ModelPricing[] = [
1231
1220
  fast: { inputPerMTok: 0.45, outputPerMTok: 3.6 },
1232
1221
  },
1233
1222
  capability: 'mid',
1234
- tier: 'sonnet',
1235
1223
  notes: OPENAI_GPT5_NOTE + OPENAI_DEPRECATED_SUFFIX,
1236
1224
  },
1237
1225
  {
@@ -1250,7 +1238,6 @@ export const MODELS: ModelPricing[] = [
1250
1238
  flex: { inputPerMTok: 0.025, outputPerMTok: 0.2 },
1251
1239
  },
1252
1240
  capability: 'small',
1253
- tier: 'haiku',
1254
1241
  notes: OPENAI_GPT5_NOTE + OPENAI_DEPRECATED_SUFFIX,
1255
1242
  },
1256
1243
 
@@ -1294,7 +1281,6 @@ export const MODELS: ModelPricing[] = [
1294
1281
  fast: { inputPerMTok: 12.5, outputPerMTok: 75 },
1295
1282
  },
1296
1283
  capability: 'frontier',
1297
- tier: 'frontier',
1298
1284
  notes: OPENAI_EARLIER_LONG_NOTE,
1299
1285
  },
1300
1286
  {
@@ -1320,7 +1306,6 @@ export const MODELS: ModelPricing[] = [
1320
1306
  flex: { inputPerMTok: 15, outputPerMTok: 90 },
1321
1307
  },
1322
1308
  capability: 'frontier',
1323
- tier: 'frontier',
1324
1309
  notes: OPENAI_EARLIER_LONG_NOTE,
1325
1310
  },
1326
1311
  {
@@ -1347,7 +1332,6 @@ export const MODELS: ModelPricing[] = [
1347
1332
  fast: { inputPerMTok: 5, outputPerMTok: 30 },
1348
1333
  },
1349
1334
  capability: 'frontier',
1350
- tier: 'frontier',
1351
1335
  notes: OPENAI_EARLIER_LONG_NOTE,
1352
1336
  },
1353
1337
  {
@@ -1373,7 +1357,6 @@ export const MODELS: ModelPricing[] = [
1373
1357
  flex: { inputPerMTok: 15, outputPerMTok: 90, tiers: openAiLongBand(30, 135) },
1374
1358
  },
1375
1359
  capability: 'frontier',
1376
- tier: 'frontier',
1377
1360
  notes: OPENAI_EARLIER_LONG_NOTE,
1378
1361
  },
1379
1362
  {
@@ -1392,7 +1375,6 @@ export const MODELS: ModelPricing[] = [
1392
1375
  fast: { inputPerMTok: 1.5, outputPerMTok: 9 },
1393
1376
  },
1394
1377
  capability: 'mid',
1395
- tier: 'sonnet',
1396
1378
  notes: OPENAI_EARLIER_NOTE,
1397
1379
  },
1398
1380
  {
@@ -1411,7 +1393,6 @@ export const MODELS: ModelPricing[] = [
1411
1393
  flex: { inputPerMTok: 0.1, outputPerMTok: 0.625 },
1412
1394
  },
1413
1395
  capability: 'small',
1414
- tier: 'haiku',
1415
1396
  notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
1416
1397
  },
1417
1398
  {
@@ -1430,7 +1411,6 @@ export const MODELS: ModelPricing[] = [
1430
1411
  fast: { inputPerMTok: 3.5, outputPerMTok: 28 },
1431
1412
  },
1432
1413
  capability: 'frontier',
1433
- tier: 'frontier',
1434
1414
  notes: OPENAI_EARLIER_NOTE,
1435
1415
  },
1436
1416
  {
@@ -1445,7 +1425,6 @@ export const MODELS: ModelPricing[] = [
1445
1425
  caching: 'none',
1446
1426
  multipliers: { batch: 0.5 },
1447
1427
  capability: 'frontier',
1448
- tier: 'frontier',
1449
1428
  notes: OPENAI_EARLIER_NO_CACHE_NOTE,
1450
1429
  },
1451
1430
  {
@@ -1465,7 +1444,6 @@ export const MODELS: ModelPricing[] = [
1465
1444
  fast: { inputPerMTok: 2.5, outputPerMTok: 20 },
1466
1445
  },
1467
1446
  capability: 'frontier',
1468
- tier: 'frontier',
1469
1447
  notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
1470
1448
  },
1471
1449
  {
@@ -1481,7 +1459,6 @@ export const MODELS: ModelPricing[] = [
1481
1459
  caching: 'none',
1482
1460
  multipliers: { batch: 0.5 },
1483
1461
  capability: 'frontier',
1484
- tier: 'frontier',
1485
1462
  notes: OPENAI_EARLIER_NO_CACHE_NOTE + OPENAI_DEPRECATED_SUFFIX,
1486
1463
  },
1487
1464
  {
@@ -1500,7 +1477,6 @@ export const MODELS: ModelPricing[] = [
1500
1477
  fast: { inputPerMTok: 3.5, outputPerMTok: 14 },
1501
1478
  },
1502
1479
  capability: 'large',
1503
- tier: 'opus',
1504
1480
  notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
1505
1481
  },
1506
1482
  {
@@ -1519,7 +1495,6 @@ export const MODELS: ModelPricing[] = [
1519
1495
  fast: { inputPerMTok: 0.7, outputPerMTok: 2.8 },
1520
1496
  },
1521
1497
  capability: 'mid',
1522
- tier: 'sonnet',
1523
1498
  notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
1524
1499
  },
1525
1500
  {
@@ -1538,7 +1513,6 @@ export const MODELS: ModelPricing[] = [
1538
1513
  fast: { inputPerMTok: 4.25, outputPerMTok: 17 },
1539
1514
  },
1540
1515
  capability: 'large',
1541
- tier: 'opus',
1542
1516
  notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
1543
1517
  },
1544
1518
  {
@@ -1557,7 +1531,6 @@ export const MODELS: ModelPricing[] = [
1557
1531
  fast: { inputPerMTok: 0.25, outputPerMTok: 1 },
1558
1532
  },
1559
1533
  capability: 'small',
1560
- tier: 'haiku',
1561
1534
  notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
1562
1535
  },
1563
1536
  {
@@ -1577,7 +1550,6 @@ export const MODELS: ModelPricing[] = [
1577
1550
  fast: { inputPerMTok: 3.5, outputPerMTok: 14 },
1578
1551
  },
1579
1552
  capability: 'frontier',
1580
- tier: 'frontier',
1581
1553
  notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
1582
1554
  },
1583
1555
  {
@@ -1593,7 +1565,6 @@ export const MODELS: ModelPricing[] = [
1593
1565
  caching: 'none',
1594
1566
  multipliers: { batch: 0.5 },
1595
1567
  capability: 'frontier',
1596
- tier: 'frontier',
1597
1568
  notes: OPENAI_EARLIER_NO_CACHE_NOTE + OPENAI_DEPRECATED_SUFFIX,
1598
1569
  },
1599
1570
  // ------------------------------------------------------------------------
@@ -1625,7 +1596,6 @@ export const MODELS: ModelPricing[] = [
1625
1596
  // The pricing page's specialized "Fast" table: $3.50/$28, cached $0.35.
1626
1597
  serviceTiers: { fast: { inputPerMTok: 3.5, outputPerMTok: 28 } },
1627
1598
  capability: 'frontier',
1628
- tier: 'frontier',
1629
1599
  notes: OPENAI_CODEX_NOTE + ' At most 272,000 input tokens.' + OPENAI_DEPRECATED_SUFFIX,
1630
1600
  },
1631
1601
  {
@@ -1640,7 +1610,6 @@ export const MODELS: ModelPricing[] = [
1640
1610
  caching: 'automatic',
1641
1611
  multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
1642
1612
  capability: 'frontier',
1643
- tier: 'frontier',
1644
1613
  notes: OPENAI_CODEX_NOTE + ' At most 272,000 input tokens.' + OPENAI_SHUT_DOWN_SUFFIX,
1645
1614
  },
1646
1615
  {
@@ -1655,7 +1624,6 @@ export const MODELS: ModelPricing[] = [
1655
1624
  caching: 'automatic',
1656
1625
  multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
1657
1626
  capability: 'frontier',
1658
- tier: 'frontier',
1659
1627
  notes: OPENAI_CODEX_NOTE + OPENAI_SHUT_DOWN_SUFFIX,
1660
1628
  },
1661
1629
  {
@@ -1670,7 +1638,6 @@ export const MODELS: ModelPricing[] = [
1670
1638
  caching: 'automatic',
1671
1639
  multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
1672
1640
  capability: 'frontier',
1673
- tier: 'frontier',
1674
1641
  notes: OPENAI_CODEX_NOTE + OPENAI_SHUT_DOWN_SUFFIX,
1675
1642
  },
1676
1643
  {
@@ -1685,7 +1652,6 @@ export const MODELS: ModelPricing[] = [
1685
1652
  caching: 'automatic',
1686
1653
  multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
1687
1654
  capability: 'mid',
1688
- tier: 'sonnet',
1689
1655
  notes: OPENAI_CODEX_NOTE + OPENAI_SHUT_DOWN_SUFFIX,
1690
1656
  },
1691
1657
  {
@@ -1700,7 +1666,6 @@ export const MODELS: ModelPricing[] = [
1700
1666
  caching: 'automatic',
1701
1667
  multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
1702
1668
  capability: 'frontier',
1703
- tier: 'frontier',
1704
1669
  notes: OPENAI_CODEX_NOTE + ' At most 272,000 input tokens.' + OPENAI_SHUT_DOWN_SUFFIX,
1705
1670
  },
1706
1671
  {
@@ -1715,7 +1680,6 @@ export const MODELS: ModelPricing[] = [
1715
1680
  caching: 'automatic',
1716
1681
  multipliers: { cacheRead: 0.25, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
1717
1682
  capability: 'mid',
1718
- tier: 'sonnet',
1719
1683
  notes: OPENAI_CODEX_NOTE + ' A cache read costs 0.25x input.' + OPENAI_SHUT_DOWN_SUFFIX,
1720
1684
  },
1721
1685
  {
@@ -1730,7 +1694,6 @@ export const MODELS: ModelPricing[] = [
1730
1694
  caching: 'automatic',
1731
1695
  multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
1732
1696
  capability: 'large',
1733
- tier: 'opus',
1734
1697
  notes: 'Points at the model ChatGPT currently uses, so it is priced and never recommended. Caching is automatic; a write costs what input costs. At most 272,000 input tokens, and no batch.',
1735
1698
  },
1736
1699
 
@@ -1760,8 +1723,17 @@ export const MODELS: ModelPricing[] = [
1760
1723
  outputPerMTok: 7.5,
1761
1724
  promo: { inputPerMTok: 0.75, outputPerMTok: 3.75, until: '2026-12-31', confirmedOn: '2026-11-16' },
1762
1725
  history: [
1763
- /* Its own price: $0.125 cached (10%) and batch half, the ratios 3.8 Flash also has. */
1764
- { until: '2026-12-01T00:00:00Z', inputPerMTok: 1.25, outputPerMTok: 10 },
1726
+ /*
1727
+ * Its own price: $0.125 cached (10%) and batch half. Its Batch tab charges
1728
+ * the cache at the standard $0.125 against a batch input of $0.625 (and
1729
+ * $0.25 against $1.25 above 200k): 0.2 of the batch rate, read 2026-11-17.
1730
+ */
1731
+ {
1732
+ until: '2026-12-01T00:00:00Z',
1733
+ inputPerMTok: 1.25,
1734
+ outputPerMTok: 10,
1735
+ multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5, batchCacheRead: 0.2 },
1736
+ },
1765
1737
  ],
1766
1738
  contextWindow: 1_048_576,
1767
1739
  cacheMinTokens: 2048,
@@ -1775,7 +1747,6 @@ export const MODELS: ModelPricing[] = [
1775
1747
  'This model models/gemini-2.5-pro is no longer available to new users. Please update your code to use models/gemini-3.1-pro-preview for the latest features and improvements. We recommend you to use the Interactions API.',
1776
1748
  },
1777
1749
  capability: 'large',
1778
- tier: 'opus',
1779
1750
  notes:
1780
1751
  'From 2026-12-01 Google routes this id to Gemini 3.8 Flash and bills it at 3.8 Flash rates.'
1781
1752
  + ' Before then it bills $1.25/$10, and $2.50/$15.00 for a prompt over 200k tokens; this row prices every prompt'
@@ -1797,6 +1768,21 @@ export const MODELS: ModelPricing[] = [
1797
1768
  displayName: 'Gemini 2.5 Flash',
1798
1769
  inputPerMTok: 0.3,
1799
1770
  outputPerMTok: 2.5,
1771
+ history: [
1772
+ /*
1773
+ * The same $0.30/$2.50, and one figure that differs until the rerouting:
1774
+ * its own Batch tab charges the cache at the standard $0.03 against a
1775
+ * batch input of $0.15, 0.2 of the batch rate (read 2026-11-17). From
1776
+ * 2026-12-01 it is billed at 3.5 Flash-Lite's rates, whose Batch tab
1777
+ * prints $0.015.
1778
+ */
1779
+ {
1780
+ until: '2026-12-01T00:00:00Z',
1781
+ inputPerMTok: 0.3,
1782
+ outputPerMTok: 2.5,
1783
+ multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5, batchCacheRead: 0.2 },
1784
+ },
1785
+ ],
1800
1786
  contextWindow: 1_048_576,
1801
1787
  cacheMinTokens: 2048,
1802
1788
  caching: 'automatic',
@@ -1809,7 +1795,6 @@ export const MODELS: ModelPricing[] = [
1809
1795
  'This model models/gemini-2.5-flash is no longer available to new users. Please update your code to use models/gemini-3.6-flash for the latest features and improvements. We recommend you to use the Interactions API.',
1810
1796
  },
1811
1797
  capability: 'mid',
1812
- tier: 'sonnet',
1813
1798
  notes:
1814
1799
  'From 2026-12-01 Google routes this id to Gemini 3.5 Flash-Lite and bills it at 3.5 Flash-Lite rates,'
1815
1800
  + ' which for text are the $0.30/$2.50 and $0.03 cached this row carries.',
@@ -1853,7 +1838,6 @@ export const MODELS: ModelPricing[] = [
1853
1838
  */
1854
1839
  multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
1855
1840
  capability: 'mid',
1856
- tier: 'sonnet',
1857
1841
  notes:
1858
1842
  'Implicit caching is automatic above 4,096 tokens. Explicit caching is also billed for storage:'
1859
1843
  + ' $0.50 per 1M tokens per hour through 2026-12-31, $1.00 after.',
@@ -1882,7 +1866,6 @@ export const MODELS: ModelPricing[] = [
1882
1866
  /* $0.075 / $0.75 = 0.1 (and $0.15 / $1.50); batch $0.375 / $0.75 = 0.5 (and $1.875 / $3.75). */
1883
1867
  multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
1884
1868
  capability: 'mid',
1885
- tier: 'sonnet',
1886
1869
  notes:
1887
1870
  'Implicit caching is automatic above 4,096 tokens. Explicit caching is also billed for storage:'
1888
1871
  + ' $0.50 per 1M tokens per hour through 2026-12-31, $1.00 after.',
@@ -1912,7 +1895,12 @@ export const MODELS: ModelPricing[] = [
1912
1895
  contextWindow: 1_048_576,
1913
1896
  cacheMinTokens: 4096,
1914
1897
  caching: 'automatic',
1915
- multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
1898
+ /*
1899
+ * The Batch tab's cache row reads "Same as Standard": $0.20 against a batch
1900
+ * input of $1.00, and $0.40 against $2.00 above 200k. 0.2 of the batch rate
1901
+ * in both bands, where a standard call reads at 0.1 (read 2026-11-17).
1902
+ */
1903
+ multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5, batchCacheRead: 0.2 },
1916
1904
  tiers: [
1917
1905
  {
1918
1906
  id: 'over-200k',
@@ -1922,7 +1910,6 @@ export const MODELS: ModelPricing[] = [
1922
1910
  },
1923
1911
  ],
1924
1912
  capability: 'large',
1925
- tier: 'opus',
1926
1913
  notes:
1927
1914
  'Priced per request by prompt length: $2/$12 up to 200,000 input tokens and $4/$18 over it.'
1928
1915
  + ' Implicit caching is automatic above 4,096 tokens; explicit caching is also billed for storage,'
@@ -1968,7 +1955,6 @@ export const MODELS: ModelPricing[] = [
1968
1955
  caching: 'automatic',
1969
1956
  multipliers: { cacheRead: 0.05, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
1970
1957
  capability: 'frontier',
1971
- tier: 'frontier',
1972
1958
  notes: GEMINI_4_NOTE,
1973
1959
  },
1974
1960
  {
@@ -1983,7 +1969,6 @@ export const MODELS: ModelPricing[] = [
1983
1969
  caching: 'automatic',
1984
1970
  multipliers: { cacheRead: 0.05, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
1985
1971
  capability: 'frontier',
1986
- tier: 'frontier',
1987
1972
  notes: GEMINI_4_NOTE,
1988
1973
  },
1989
1974
  {
@@ -1997,7 +1982,6 @@ export const MODELS: ModelPricing[] = [
1997
1982
  caching: 'automatic',
1998
1983
  multipliers: { cacheRead: 0.05, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
1999
1984
  capability: 'mid',
2000
- tier: 'sonnet',
2001
1985
  notes: GEMINI_4_NOTE,
2002
1986
  },
2003
1987
  {
@@ -2022,7 +2006,6 @@ export const MODELS: ModelPricing[] = [
2022
2006
  caching: 'automatic',
2023
2007
  multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
2024
2008
  capability: 'small',
2025
- tier: 'haiku',
2026
2009
  notes:
2027
2010
  'Implicit caching is automatic, and no minimum prefix length is published for this model. Explicit caching is'
2028
2011
  + ' also billed for storage, $1.00 per 1M tokens per hour.',
@@ -2064,7 +2047,6 @@ export const MODELS: ModelPricing[] = [
2064
2047
  caching: 'automatic',
2065
2048
  multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 2, batch: 0.6 },
2066
2049
  capability: 'frontier',
2067
- tier: 'frontier',
2068
2050
  notes:
2069
2051
  'Cache writes are billed as their own line: 1x input for a 5-minute entry, 2x for an hour.'
2070
2052
  + ` ${NO_PUBLISHED_CACHE_MINIMUM}`,
@@ -2084,7 +2066,6 @@ export const MODELS: ModelPricing[] = [
2084
2066
  caching: 'automatic',
2085
2067
  multipliers: { cacheRead: 0.05, cacheWrite5m: 1, cacheWrite1h: 2, batch: null },
2086
2068
  capability: 'frontier',
2087
- tier: 'frontier',
2088
2069
  notes:
2089
2070
  'Cache writes are billed as their own line: 1x input for a 5-minute entry, 2x for an hour.'
2090
2071
  + ` No batch API for this model. ${NO_PUBLISHED_CACHE_MINIMUM}`,
@@ -2100,7 +2081,6 @@ export const MODELS: ModelPricing[] = [
2100
2081
  caching: 'automatic',
2101
2082
  multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 2, batch: 0.6 },
2102
2083
  capability: 'frontier',
2103
- tier: 'frontier',
2104
2084
  notes:
2105
2085
  'Cache writes are billed as their own line: 1x input for a 5-minute entry, 2x for an hour.'
2106
2086
  + ` Batch at 60% since the batch page listed it (read 2026-11-05). ${NO_PUBLISHED_CACHE_MINIMUM}`,
@@ -2119,7 +2099,6 @@ export const MODELS: ModelPricing[] = [
2119
2099
  /* $0.19 on a hit against $0.95; batch $0.57 / $2.40, 60%. */
2120
2100
  multipliers: { cacheRead: 0.2, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.6 },
2121
2101
  capability: 'mid',
2122
- tier: 'sonnet',
2123
2102
  notes: NO_PUBLISHED_CACHE_MINIMUM,
2124
2103
  },
2125
2104
  {
@@ -2136,7 +2115,6 @@ export const MODELS: ModelPricing[] = [
2136
2115
  /* $0.38 on a hit against $1.90; no batch API for this variant. */
2137
2116
  multipliers: { cacheRead: 0.2, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
2138
2117
  capability: 'mid',
2139
- tier: 'sonnet',
2140
2118
  notes: NO_PUBLISHED_CACHE_MINIMUM,
2141
2119
  },
2142
2120
  {
@@ -2153,7 +2131,6 @@ export const MODELS: ModelPricing[] = [
2153
2131
  /* $0.16 on a hit against $0.95, written as the ratio so the product is the page's figure. */
2154
2132
  multipliers: { cacheRead: 0.16 / 0.95, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.6 },
2155
2133
  capability: 'mid',
2156
- tier: 'sonnet',
2157
2134
  notes: NO_PUBLISHED_CACHE_MINIMUM,
2158
2135
  },
2159
2136
  {
@@ -2176,7 +2153,6 @@ export const MODELS: ModelPricing[] = [
2176
2153
  */
2177
2154
  recommendable: false,
2178
2155
  capability: 'mid',
2179
- tier: 'sonnet',
2180
2156
  notes:
2181
2157
  'Discontinued by Moonshot on 2026-05-25; priced at the last rate it published. No batch API.'
2182
2158
  + ` ${NO_PUBLISHED_CACHE_MINIMUM}`,
@@ -2202,7 +2178,6 @@ export const MODELS: ModelPricing[] = [
2202
2178
  'The supported API model names are deepseek-v4-pro, deepseek-v4-flash, and deepseek-v4-flash-vision-exp, but you passed deepseek-v3.',
2203
2179
  },
2204
2180
  capability: 'mid',
2205
- tier: 'sonnet',
2206
2181
  },
2207
2182
  {
2208
2183
  /*
@@ -2259,7 +2234,6 @@ export const MODELS: ModelPricing[] = [
2259
2234
  /* $0.003 cache hit against $0.15 input off-peak, $0.006 against $0.30 at peak. */
2260
2235
  multipliers: { cacheRead: 0.02, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
2261
2236
  capability: 'mid',
2262
- tier: 'sonnet',
2263
2237
  notes:
2264
2238
  'Retired 2026-09-10: the id is still accepted, served by V4.1 Flash and billed at the deepseek-flash price.'
2265
2239
  + ' Maximum output 384K tokens. Peak excludes Chinese public holidays, which this table cannot express.',
@@ -2293,7 +2267,6 @@ export const MODELS: ModelPricing[] = [
2293
2267
  caching: 'automatic',
2294
2268
  multipliers: { cacheRead: 0.02, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
2295
2269
  capability: 'mid',
2296
- tier: 'sonnet',
2297
2270
  notes:
2298
2271
  'Maximum output 384K tokens. Peak excludes Chinese public holidays, which this table cannot express:'
2299
2272
  + ' on a weekday holiday it charges peak where DeepSeek charges off-peak.',
@@ -2319,7 +2292,6 @@ export const MODELS: ModelPricing[] = [
2319
2292
  /* $0.022 cache hit against $0.66 input off-peak. */
2320
2293
  multipliers: { cacheRead: 0.0333, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
2321
2294
  capability: 'large',
2322
- tier: 'opus',
2323
2295
  notes: 'Maximum output 384K tokens.',
2324
2296
  },
2325
2297
 
@@ -2348,7 +2320,6 @@ export const MODELS: ModelPricing[] = [
2348
2320
  multipliers: { cacheRead: 0.25, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
2349
2321
  tiers: [GROK_LONG(4, 12)],
2350
2322
  capability: 'frontier',
2351
- tier: 'frontier',
2352
2323
  notes: NO_PUBLISHED_CACHE_MINIMUM,
2353
2324
  },
2354
2325
  {
@@ -2363,7 +2334,6 @@ export const MODELS: ModelPricing[] = [
2363
2334
  multipliers: { cacheRead: 0.25, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
2364
2335
  tiers: [GROK_LONG(4, 12)],
2365
2336
  capability: 'large',
2366
- tier: 'opus',
2367
2337
  notes: NO_PUBLISHED_CACHE_MINIMUM,
2368
2338
  },
2369
2339
  {
@@ -2379,7 +2349,6 @@ export const MODELS: ModelPricing[] = [
2379
2349
  multipliers: { cacheRead: 0.15, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
2380
2350
  tiers: [GROK_LONG(4, 12)],
2381
2351
  capability: 'large',
2382
- tier: 'opus',
2383
2352
  notes: NO_PUBLISHED_CACHE_MINIMUM,
2384
2353
  },
2385
2354
  {
@@ -2395,7 +2364,6 @@ export const MODELS: ModelPricing[] = [
2395
2364
  multipliers: { cacheRead: 0.16, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.8 },
2396
2365
  tiers: [GROK_LONG(2.5, 5)],
2397
2366
  capability: 'mid',
2398
- tier: 'sonnet',
2399
2367
  notes: NO_PUBLISHED_CACHE_MINIMUM,
2400
2368
  },
2401
2369
  {
@@ -2411,7 +2379,6 @@ export const MODELS: ModelPricing[] = [
2411
2379
  multipliers: { cacheRead: 0.16, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.8 },
2412
2380
  tiers: [GROK_LONG(2.5, 5)],
2413
2381
  capability: 'mid',
2414
- tier: 'sonnet',
2415
2382
  notes: NO_PUBLISHED_CACHE_MINIMUM,
2416
2383
  },
2417
2384
  {
@@ -2427,7 +2394,6 @@ export const MODELS: ModelPricing[] = [
2427
2394
  multipliers: { cacheRead: 0.16, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.8 },
2428
2395
  tiers: [GROK_LONG(2.5, 5)],
2429
2396
  capability: 'mid',
2430
- tier: 'sonnet',
2431
2397
  notes: NO_PUBLISHED_CACHE_MINIMUM,
2432
2398
  },
2433
2399
  {
@@ -2443,7 +2409,6 @@ export const MODELS: ModelPricing[] = [
2443
2409
  multipliers: { cacheRead: 0.16, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.8 },
2444
2410
  tiers: [GROK_LONG(2.5, 5)],
2445
2411
  capability: 'mid',
2446
- tier: 'sonnet',
2447
2412
  notes: NO_PUBLISHED_CACHE_MINIMUM,
2448
2413
  },
2449
2414
  {
@@ -2458,7 +2423,6 @@ export const MODELS: ModelPricing[] = [
2458
2423
  multipliers: { cacheRead: 0.2, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
2459
2424
  tiers: [GROK_LONG(2, 4)],
2460
2425
  capability: 'mid',
2461
- tier: 'sonnet',
2462
2426
  notes: NO_PUBLISHED_CACHE_MINIMUM,
2463
2427
  },
2464
2428
  {
@@ -2491,7 +2455,6 @@ export const MODELS: ModelPricing[] = [
2491
2455
  ],
2492
2456
  recommendable: false,
2493
2457
  capability: 'large',
2494
- tier: 'opus',
2495
2458
  notes:
2496
2459
  'Retired by xAI on 2026-05-15 and redirected to Grok 4.3, whose price it bills at from then;'
2497
2460
  + ` $3/$15 before. ${NO_PUBLISHED_CACHE_MINIMUM}`,
@@ -2517,7 +2480,6 @@ export const MODELS: ModelPricing[] = [
2517
2480
  'Invalid model: mistral-large-2',
2518
2481
  },
2519
2482
  capability: 'large',
2520
- tier: 'opus',
2521
2483
  notes: 'No prompt caching: reordering still helps readability but saves nothing here.',
2522
2484
  },
2523
2485
  {
@@ -2548,7 +2510,6 @@ export const MODELS: ModelPricing[] = [
2548
2510
  caching: 'unknown',
2549
2511
  multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
2550
2512
  capability: 'large',
2551
- tier: 'opus',
2552
2513
  notes: MISTRAL_CACHE_NOTE,
2553
2514
  },
2554
2515
  {
@@ -2576,7 +2537,6 @@ export const MODELS: ModelPricing[] = [
2576
2537
  caching: 'unknown',
2577
2538
  multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
2578
2539
  capability: 'mid',
2579
- tier: 'sonnet',
2580
2540
  notes: MISTRAL_CACHE_NOTE,
2581
2541
  },
2582
2542
  {
@@ -2592,7 +2552,6 @@ export const MODELS: ModelPricing[] = [
2592
2552
  caching: 'unknown',
2593
2553
  multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
2594
2554
  capability: 'small',
2595
- tier: 'haiku',
2596
2555
  notes: MISTRAL_CACHE_NOTE,
2597
2556
  },
2598
2557
  ];
@@ -2695,14 +2654,17 @@ export function modelFrom(catalogue: PricingCatalogue, id: string): ModelPricing
2695
2654
  }
2696
2655
 
2697
2656
  /**
2698
- * Cheapest model of a tier within a catalogue.
2657
+ * Cheapest model of a capability within a catalogue.
2658
+ *
2659
+ * Takes the names `recommendTier` answers in, which are the names of the
2660
+ * `capability` a model carries.
2699
2661
  *
2700
2662
  * Compared on the **effective** price, so a model in a promotional window is
2701
2663
  * ranked at what it actually costs today rather than at its list price.
2702
2664
  */
2703
- export function cheapestOfTierIn(
2665
+ export function cheapestOfCapabilityIn(
2704
2666
  catalogue: PricingCatalogue,
2705
- tier: ModelPricing['tier'],
2667
+ capability: Capability,
2706
2668
  on: Date = new Date(),
2707
2669
  /**
2708
2670
  * Restrict to one provider. Omit to search the whole catalogue, which is what
@@ -2714,12 +2676,12 @@ export function cheapestOfTierIn(
2714
2676
  ): ModelPricing {
2715
2677
  const candidates = catalogue.models.filter(
2716
2678
  (m) =>
2717
- m.tier === tier &&
2679
+ m.capability === capability &&
2718
2680
  isOffered(m) &&
2719
2681
  (provider === undefined || m.provider === provider),
2720
2682
  );
2721
2683
  const first = candidates[0];
2722
- if (!first) throw new Error(`No models for tier "${tier}"`);
2684
+ if (!first) throw new Error(`No models for capability "${capability}"`);
2723
2685
  return candidates.reduce(
2724
2686
  (best, m) =>
2725
2687
  effectivePricing(m, on).inputPerMTok < effectivePricing(best, on).inputPerMTok ? m : best,
@@ -3208,11 +3170,11 @@ export function reviewedForModels(
3208
3170
  return oldest ?? catalogue.lastReviewed;
3209
3171
  }
3210
3172
 
3211
- /** Cheapest model of each capability tier, for recommendations. */
3212
- export function cheapestOfTier(tier: ModelPricing['tier']): ModelPricing {
3213
- const candidates = MODELS.filter((m) => m.tier === tier && isOffered(m));
3173
+ /** Cheapest model of a capability across the bundled catalogue, for recommendations. */
3174
+ export function cheapestOfCapability(capability: Capability): ModelPricing {
3175
+ const candidates = MODELS.filter((m) => m.capability === capability && isOffered(m));
3214
3176
  const first = candidates[0];
3215
- if (!first) throw new Error(`No models for tier "${tier}"`);
3177
+ if (!first) throw new Error(`No models for capability "${capability}"`);
3216
3178
  return candidates.reduce((best, m) => (m.inputPerMTok < best.inputPerMTok ? m : best), first);
3217
3179
  }
3218
3180