@trazum/core 2.7.12 → 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 (65) hide show
  1. package/dist/advisories.d.ts +14 -7
  2. package/dist/advisories.d.ts.map +1 -1
  3. package/dist/advisories.js +27 -20
  4. package/dist/advisories.js.map +1 -1
  5. package/dist/i18n/en.js +2 -2
  6. package/dist/i18n/en.js.map +1 -1
  7. package/dist/i18n/es.js +2 -2
  8. package/dist/i18n/es.js.map +1 -1
  9. package/dist/i18n/types.d.ts +2 -1
  10. package/dist/i18n/types.d.ts.map +1 -1
  11. package/dist/index.d.ts +3 -1
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +2 -1
  14. package/dist/index.js.map +1 -1
  15. package/dist/openrouter.d.ts +1 -1
  16. package/dist/openrouter.d.ts.map +1 -1
  17. package/dist/openrouter.js +1 -2
  18. package/dist/openrouter.js.map +1 -1
  19. package/dist/pricing-overlay.d.ts +1 -1
  20. package/dist/pricing-overlay.d.ts.map +1 -1
  21. package/dist/pricing-overlay.js +19 -9
  22. package/dist/pricing-overlay.js.map +1 -1
  23. package/dist/pricing.d.ts +8 -5
  24. package/dist/pricing.d.ts.map +1 -1
  25. package/dist/pricing.js +11 -99
  26. package/dist/pricing.js.map +1 -1
  27. package/dist/review.js +2 -1
  28. package/dist/review.js.map +1 -1
  29. package/dist/segment.d.ts +31 -1
  30. package/dist/segment.d.ts.map +1 -1
  31. package/dist/segment.js +52 -4
  32. package/dist/segment.js.map +1 -1
  33. package/dist/structure.d.ts +34 -0
  34. package/dist/structure.d.ts.map +1 -1
  35. package/dist/structure.js +143 -12
  36. package/dist/structure.js.map +1 -1
  37. package/dist/types.d.ts +6 -6
  38. package/dist/types.d.ts.map +1 -1
  39. package/dist/usage.js +11 -11
  40. package/dist/watch.d.ts +11 -1
  41. package/dist/watch.d.ts.map +1 -1
  42. package/dist/watch.js.map +1 -1
  43. package/dist/weekly.d.ts +140 -0
  44. package/dist/weekly.d.ts.map +1 -0
  45. package/dist/weekly.js +176 -0
  46. package/dist/weekly.js.map +1 -0
  47. package/dist/write.js +2 -2
  48. package/dist/write.js.map +1 -1
  49. package/package.json +1 -1
  50. package/src/advisories.ts +41 -25
  51. package/src/i18n/en.ts +2 -2
  52. package/src/i18n/es.ts +2 -2
  53. package/src/i18n/types.ts +2 -1
  54. package/src/index.ts +4 -2
  55. package/src/openrouter.ts +1 -2
  56. package/src/pricing-overlay.ts +21 -12
  57. package/src/pricing.ts +13 -101
  58. package/src/review.ts +1 -1
  59. package/src/segment.ts +50 -6
  60. package/src/structure.ts +152 -13
  61. package/src/types.ts +6 -6
  62. package/src/usage.ts +11 -11
  63. package/src/watch.ts +12 -1
  64. package/src/weekly.ts +281 -0
  65. 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).
@@ -439,7 +439,6 @@ export const MODELS: ModelPricing[] = [
439
439
  */
440
440
  tiers: [{ id: 'fast', when: { kind: 'speed', speed: 'fast' }, inputPerMTok: 16, outputPerMTok: 80 }],
441
441
  capability: 'frontier',
442
- tier: 'frontier',
443
442
  notes: 'Cache hits cost 2.5% of the input price ($0.20). Fast mode (usage.speed "fast") bills $16/$80.'
444
443
  + ' Requires 30-day data retention.',
445
444
  },
@@ -466,7 +465,6 @@ export const MODELS: ModelPricing[] = [
466
465
  multipliers: { cacheRead: 0.025, cacheWrite5m: 1.25, cacheWrite1h: 2, batch: 0.5 },
467
466
  tiers: [{ id: 'fast', when: { kind: 'speed', speed: 'fast' }, inputPerMTok: 16, outputPerMTok: 80 }],
468
467
  capability: 'frontier',
469
- tier: 'frontier',
470
468
  notes:
471
469
  'Available only to organizations verified through Anthropic\'s verification programs.'
472
470
  + ' Fast mode (usage.speed "fast") bills $16/$80. Requires 30-day data retention.',
@@ -494,7 +492,6 @@ export const MODELS: ModelPricing[] = [
494
492
  cacheMinTokens: 512,
495
493
  multipliers: { cacheRead: 0.025, cacheWrite5m: 1.25, cacheWrite1h: 2, batch: 0.5 },
496
494
  capability: 'frontier',
497
- tier: 'frontier',
498
495
  notes: 'Legacy: superseded by Claude Fable 5.2, which costs less ($8/$40). Cache hits cost 2.5% of the input'
499
496
  + ' price ($0.25). Requires 30-day data retention.',
500
497
  },
@@ -516,7 +513,6 @@ export const MODELS: ModelPricing[] = [
516
513
  cacheMinTokens: 512,
517
514
  multipliers: { cacheRead: 0.025, cacheWrite5m: 1.25, cacheWrite1h: 2, batch: 0.5 },
518
515
  capability: 'frontier',
519
- tier: 'frontier',
520
516
  notes:
521
517
  'Available only to organizations verified through Anthropic\'s verification programs.'
522
518
  + ' Requires 30-day data retention.',
@@ -532,7 +528,6 @@ export const MODELS: ModelPricing[] = [
532
528
  contextWindow: 1_000_000,
533
529
  cacheMinTokens: 512,
534
530
  capability: 'frontier',
535
- tier: 'frontier',
536
531
  notes: 'Legacy: superseded by Claude Fable 5.1 at the same prices. Requires 30-day data retention.',
537
532
  },
538
533
  {
@@ -547,7 +542,6 @@ export const MODELS: ModelPricing[] = [
547
542
  contextWindow: 1_000_000,
548
543
  cacheMinTokens: 512,
549
544
  capability: 'frontier',
550
- tier: 'frontier',
551
545
  notes:
552
546
  'Available only to organizations verified through Anthropic\'s verification programs.'
553
547
  + ' Requires 30-day data retention.',
@@ -578,7 +572,6 @@ export const MODELS: ModelPricing[] = [
578
572
  */
579
573
  tiers: [{ id: 'fast', when: { kind: 'speed', speed: 'fast' }, inputPerMTok: 8, outputPerMTok: 40 }],
580
574
  capability: 'large',
581
- tier: 'opus',
582
575
  notes: 'Cache hits cost 5% of the input price ($0.20), against 10% on Opus 5 and earlier.'
583
576
  + ' Fast mode (usage.speed "fast") bills $8/$40.',
584
577
  },
@@ -595,7 +588,6 @@ export const MODELS: ModelPricing[] = [
595
588
  // Fast mode in research preview, $10/$50; same sources as Opus 5.5's.
596
589
  tiers: [{ id: 'fast', when: { kind: 'speed', speed: 'fast' }, inputPerMTok: 10, outputPerMTok: 50 }],
597
590
  capability: 'large',
598
- tier: 'opus',
599
591
  notes: '512-token cache minimum: caches prompts that would miss on Opus 4.6. Fast mode bills $10/$50.',
600
592
  },
601
593
  {
@@ -615,7 +607,6 @@ export const MODELS: ModelPricing[] = [
615
607
  */
616
608
  tiers: [{ id: 'fast', when: { kind: 'speed', speed: 'fast' }, inputPerMTok: 10, outputPerMTok: 50 }],
617
609
  capability: 'large',
618
- tier: 'opus',
619
610
  notes: 'Fast mode bills $10/$50 until it is removed from this model on 2026-11-30.',
620
611
  },
621
612
  {
@@ -629,7 +620,6 @@ export const MODELS: ModelPricing[] = [
629
620
  contextWindow: 1_000_000,
630
621
  cacheMinTokens: 2048,
631
622
  capability: 'large',
632
- tier: 'opus',
633
623
  },
634
624
  {
635
625
  id: 'claude-opus-4-6',
@@ -642,7 +632,6 @@ export const MODELS: ModelPricing[] = [
642
632
  contextWindow: 1_000_000,
643
633
  cacheMinTokens: 4096,
644
634
  capability: 'large',
645
- tier: 'opus',
646
635
  },
647
636
  {
648
637
  /*
@@ -663,7 +652,6 @@ export const MODELS: ModelPricing[] = [
663
652
  contextWindow: 200_000,
664
653
  cacheMinTokens: 4096,
665
654
  capability: 'large',
666
- tier: 'opus',
667
655
  notes: '200K context window and a 64K output cap.',
668
656
  },
669
657
  {
@@ -689,7 +677,6 @@ export const MODELS: ModelPricing[] = [
689
677
  contextWindow: 200_000,
690
678
  cacheMinTokens: 1024,
691
679
  capability: 'large',
692
- tier: 'opus',
693
680
  notes:
694
681
  'Retired on the Claude API on 2026-08-05; still served on Google Cloud (Google managed) and Bedrock.'
695
682
  + ' Anthropic names Claude Opus 4.8 as the replacement.',
@@ -710,7 +697,6 @@ export const MODELS: ModelPricing[] = [
710
697
  contextWindow: 200_000,
711
698
  cacheMinTokens: 1024,
712
699
  capability: 'large',
713
- tier: 'opus',
714
700
  notes:
715
701
  'Retired on the Claude API on 2026-06-15; still served on Google Cloud (Google managed).'
716
702
  + ' Anthropic names Claude Opus 4.8 as the replacement.',
@@ -732,7 +718,6 @@ export const MODELS: ModelPricing[] = [
732
718
  cacheMinTokens: 512,
733
719
  multipliers: { cacheRead: 0.05, cacheWrite5m: 1.25, cacheWrite1h: 2, batch: 0.5 },
734
720
  capability: 'mid',
735
- tier: 'sonnet',
736
721
  notes: 'Cache hits cost 5% of the input price ($0.10), against 10% ($0.20) on Sonnet 5.',
737
722
  },
738
723
  {
@@ -746,7 +731,6 @@ export const MODELS: ModelPricing[] = [
746
731
  contextWindow: 1_000_000,
747
732
  cacheMinTokens: 1024,
748
733
  capability: 'mid',
749
- tier: 'sonnet',
750
734
  notes:
751
735
  'Launched with 2/10 as introductory pricing through 2026-08-31; the scheduled'
752
736
  + ' increase to 3/15 on 2026-09-01 was cancelled and 2/10 is the standard price.',
@@ -762,7 +746,6 @@ export const MODELS: ModelPricing[] = [
762
746
  contextWindow: 1_000_000,
763
747
  cacheMinTokens: 1024,
764
748
  capability: 'mid',
765
- tier: 'sonnet',
766
749
  },
767
750
  {
768
751
  /*
@@ -785,7 +768,6 @@ export const MODELS: ModelPricing[] = [
785
768
  contextWindow: 200_000,
786
769
  cacheMinTokens: 1024,
787
770
  capability: 'mid',
788
- tier: 'sonnet',
789
771
  notes: 'Deprecated; retires 2026-11-30. Recommended replacement: Claude Sonnet 5.5.',
790
772
  },
791
773
  {
@@ -808,7 +790,6 @@ export const MODELS: ModelPricing[] = [
808
790
  contextWindow: 200_000,
809
791
  cacheMinTokens: 1024,
810
792
  capability: 'mid',
811
- tier: 'sonnet',
812
793
  notes:
813
794
  'Retired on the Claude API on 2026-06-15; still served on Google Cloud (Google managed) and Bedrock.'
814
795
  + ' Anthropic names Claude Sonnet 5.5 as the replacement.',
@@ -849,7 +830,6 @@ export const MODELS: ModelPricing[] = [
849
830
  },
850
831
  ],
851
832
  capability: 'small',
852
- tier: 'haiku',
853
833
  notes:
854
834
  'Priced per request by prompt length: $0.10/$0.50 up to 100,000 input tokens, cache reads'
855
835
  + ' and writes included, and $0.50/$2.50 over it.',
@@ -868,7 +848,6 @@ export const MODELS: ModelPricing[] = [
868
848
  contextWindow: 200_000,
869
849
  cacheMinTokens: 4096,
870
850
  capability: 'small',
871
- tier: 'haiku',
872
851
  notes: '200K context window and a 64K output cap, smaller than the rest.',
873
852
  },
874
853
  {
@@ -890,7 +869,6 @@ export const MODELS: ModelPricing[] = [
890
869
  contextWindow: 200_000,
891
870
  cacheMinTokens: 2048,
892
871
  capability: 'small',
893
- tier: 'haiku',
894
872
  notes:
895
873
  'Retired on the Claude API on 2026-02-19; still served on Google Cloud (Google managed).'
896
874
  + ' Anthropic names Claude Haiku 4.5 as the replacement.',
@@ -961,7 +939,6 @@ export const MODELS: ModelPricing[] = [
961
939
  ultrafast: { inputPerMTok: 60, outputPerMTok: 300, tiers: openAiLongBand(120, 450) },
962
940
  },
963
941
  capability: 'frontier',
964
- tier: 'frontier',
965
942
  notes: OPENAI_CURRENT_NOTE,
966
943
  },
967
944
  {
@@ -989,7 +966,6 @@ export const MODELS: ModelPricing[] = [
989
966
  ultrafast: { inputPerMTok: 12, outputPerMTok: 60, tiers: openAiLongBand(24, 90) },
990
967
  },
991
968
  capability: 'large',
992
- tier: 'opus',
993
969
  notes: OPENAI_CURRENT_NOTE,
994
970
  },
995
971
  {
@@ -1022,7 +998,6 @@ export const MODELS: ModelPricing[] = [
1022
998
  fast: { inputPerMTok: 2, outputPerMTok: 10, tiers: openAiLongBand(4, 15) },
1023
999
  },
1024
1000
  capability: 'mid',
1025
- tier: 'sonnet',
1026
1001
  notes: OPENAI_CURRENT_NOTE,
1027
1002
  },
1028
1003
  {
@@ -1049,7 +1024,6 @@ export const MODELS: ModelPricing[] = [
1049
1024
  fast: { inputPerMTok: 4, outputPerMTok: 20, tiers: openAiLongBand(8, 30) },
1050
1025
  },
1051
1026
  capability: 'large',
1052
- tier: 'opus',
1053
1027
  notes: OPENAI_CURRENT_NOTE,
1054
1028
  },
1055
1029
  {
@@ -1076,7 +1050,6 @@ export const MODELS: ModelPricing[] = [
1076
1050
  fast: { inputPerMTok: 0.2, outputPerMTok: 1, tiers: openAiLongBand(0.4, 1.5) },
1077
1051
  },
1078
1052
  capability: 'small',
1079
- tier: 'haiku',
1080
1053
  notes: OPENAI_CURRENT_NOTE,
1081
1054
  },
1082
1055
  {
@@ -1117,7 +1090,6 @@ export const MODELS: ModelPricing[] = [
1117
1090
  fast: { inputPerMTok: 8, outputPerMTok: 40, tiers: openAiLongBand(16, 60) },
1118
1091
  },
1119
1092
  capability: 'large',
1120
- tier: 'opus',
1121
1093
  notes:
1122
1094
  OPENAI_CURRENT_NOTE
1123
1095
  + ' $4/$20 is promotional until 2026-11-30, and OpenAI has not published the price after it as a figure.',
@@ -1146,7 +1118,6 @@ export const MODELS: ModelPricing[] = [
1146
1118
  fast: { inputPerMTok: 4, outputPerMTok: 24, tiers: openAiLongBand(8, 36) },
1147
1119
  },
1148
1120
  capability: 'mid',
1149
- tier: 'sonnet',
1150
1121
  notes: OPENAI_CURRENT_NOTE,
1151
1122
  },
1152
1123
  {
@@ -1173,7 +1144,6 @@ export const MODELS: ModelPricing[] = [
1173
1144
  fast: { inputPerMTok: 0.4, outputPerMTok: 2.4, tiers: openAiLongBand(0.8, 3.6) },
1174
1145
  },
1175
1146
  capability: 'small',
1176
- tier: 'haiku',
1177
1147
  notes: OPENAI_CURRENT_NOTE,
1178
1148
  },
1179
1149
  {
@@ -1204,7 +1174,6 @@ export const MODELS: ModelPricing[] = [
1204
1174
  multipliers: { cacheRead: 0.1, cacheWrite5m: 1.25, cacheWrite1h: 2.5, batch: null },
1205
1175
  cacheTtl: OPENAI_CACHE_TTL,
1206
1176
  capability: 'large',
1207
- tier: 'opus',
1208
1177
  notes:
1209
1178
  'Needs approval through the Daybreak programme. At most 272,000 input tokens, Responses API only, no batch.'
1210
1179
  + ' Cache writes cost 1.25x input for the default 30-minute entry and 2.5x for a 12-hour one.',
@@ -1232,7 +1201,6 @@ export const MODELS: ModelPricing[] = [
1232
1201
  fast: { inputPerMTok: 2.5, outputPerMTok: 20 },
1233
1202
  },
1234
1203
  capability: 'frontier',
1235
- tier: 'frontier',
1236
1204
  notes: OPENAI_GPT5_NOTE + OPENAI_DEPRECATED_SUFFIX,
1237
1205
  },
1238
1206
  {
@@ -1252,7 +1220,6 @@ export const MODELS: ModelPricing[] = [
1252
1220
  fast: { inputPerMTok: 0.45, outputPerMTok: 3.6 },
1253
1221
  },
1254
1222
  capability: 'mid',
1255
- tier: 'sonnet',
1256
1223
  notes: OPENAI_GPT5_NOTE + OPENAI_DEPRECATED_SUFFIX,
1257
1224
  },
1258
1225
  {
@@ -1271,7 +1238,6 @@ export const MODELS: ModelPricing[] = [
1271
1238
  flex: { inputPerMTok: 0.025, outputPerMTok: 0.2 },
1272
1239
  },
1273
1240
  capability: 'small',
1274
- tier: 'haiku',
1275
1241
  notes: OPENAI_GPT5_NOTE + OPENAI_DEPRECATED_SUFFIX,
1276
1242
  },
1277
1243
 
@@ -1315,7 +1281,6 @@ export const MODELS: ModelPricing[] = [
1315
1281
  fast: { inputPerMTok: 12.5, outputPerMTok: 75 },
1316
1282
  },
1317
1283
  capability: 'frontier',
1318
- tier: 'frontier',
1319
1284
  notes: OPENAI_EARLIER_LONG_NOTE,
1320
1285
  },
1321
1286
  {
@@ -1341,7 +1306,6 @@ export const MODELS: ModelPricing[] = [
1341
1306
  flex: { inputPerMTok: 15, outputPerMTok: 90 },
1342
1307
  },
1343
1308
  capability: 'frontier',
1344
- tier: 'frontier',
1345
1309
  notes: OPENAI_EARLIER_LONG_NOTE,
1346
1310
  },
1347
1311
  {
@@ -1368,7 +1332,6 @@ export const MODELS: ModelPricing[] = [
1368
1332
  fast: { inputPerMTok: 5, outputPerMTok: 30 },
1369
1333
  },
1370
1334
  capability: 'frontier',
1371
- tier: 'frontier',
1372
1335
  notes: OPENAI_EARLIER_LONG_NOTE,
1373
1336
  },
1374
1337
  {
@@ -1394,7 +1357,6 @@ export const MODELS: ModelPricing[] = [
1394
1357
  flex: { inputPerMTok: 15, outputPerMTok: 90, tiers: openAiLongBand(30, 135) },
1395
1358
  },
1396
1359
  capability: 'frontier',
1397
- tier: 'frontier',
1398
1360
  notes: OPENAI_EARLIER_LONG_NOTE,
1399
1361
  },
1400
1362
  {
@@ -1413,7 +1375,6 @@ export const MODELS: ModelPricing[] = [
1413
1375
  fast: { inputPerMTok: 1.5, outputPerMTok: 9 },
1414
1376
  },
1415
1377
  capability: 'mid',
1416
- tier: 'sonnet',
1417
1378
  notes: OPENAI_EARLIER_NOTE,
1418
1379
  },
1419
1380
  {
@@ -1432,7 +1393,6 @@ export const MODELS: ModelPricing[] = [
1432
1393
  flex: { inputPerMTok: 0.1, outputPerMTok: 0.625 },
1433
1394
  },
1434
1395
  capability: 'small',
1435
- tier: 'haiku',
1436
1396
  notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
1437
1397
  },
1438
1398
  {
@@ -1451,7 +1411,6 @@ export const MODELS: ModelPricing[] = [
1451
1411
  fast: { inputPerMTok: 3.5, outputPerMTok: 28 },
1452
1412
  },
1453
1413
  capability: 'frontier',
1454
- tier: 'frontier',
1455
1414
  notes: OPENAI_EARLIER_NOTE,
1456
1415
  },
1457
1416
  {
@@ -1466,7 +1425,6 @@ export const MODELS: ModelPricing[] = [
1466
1425
  caching: 'none',
1467
1426
  multipliers: { batch: 0.5 },
1468
1427
  capability: 'frontier',
1469
- tier: 'frontier',
1470
1428
  notes: OPENAI_EARLIER_NO_CACHE_NOTE,
1471
1429
  },
1472
1430
  {
@@ -1486,7 +1444,6 @@ export const MODELS: ModelPricing[] = [
1486
1444
  fast: { inputPerMTok: 2.5, outputPerMTok: 20 },
1487
1445
  },
1488
1446
  capability: 'frontier',
1489
- tier: 'frontier',
1490
1447
  notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
1491
1448
  },
1492
1449
  {
@@ -1502,7 +1459,6 @@ export const MODELS: ModelPricing[] = [
1502
1459
  caching: 'none',
1503
1460
  multipliers: { batch: 0.5 },
1504
1461
  capability: 'frontier',
1505
- tier: 'frontier',
1506
1462
  notes: OPENAI_EARLIER_NO_CACHE_NOTE + OPENAI_DEPRECATED_SUFFIX,
1507
1463
  },
1508
1464
  {
@@ -1521,7 +1477,6 @@ export const MODELS: ModelPricing[] = [
1521
1477
  fast: { inputPerMTok: 3.5, outputPerMTok: 14 },
1522
1478
  },
1523
1479
  capability: 'large',
1524
- tier: 'opus',
1525
1480
  notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
1526
1481
  },
1527
1482
  {
@@ -1540,7 +1495,6 @@ export const MODELS: ModelPricing[] = [
1540
1495
  fast: { inputPerMTok: 0.7, outputPerMTok: 2.8 },
1541
1496
  },
1542
1497
  capability: 'mid',
1543
- tier: 'sonnet',
1544
1498
  notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
1545
1499
  },
1546
1500
  {
@@ -1559,7 +1513,6 @@ export const MODELS: ModelPricing[] = [
1559
1513
  fast: { inputPerMTok: 4.25, outputPerMTok: 17 },
1560
1514
  },
1561
1515
  capability: 'large',
1562
- tier: 'opus',
1563
1516
  notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
1564
1517
  },
1565
1518
  {
@@ -1578,7 +1531,6 @@ export const MODELS: ModelPricing[] = [
1578
1531
  fast: { inputPerMTok: 0.25, outputPerMTok: 1 },
1579
1532
  },
1580
1533
  capability: 'small',
1581
- tier: 'haiku',
1582
1534
  notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
1583
1535
  },
1584
1536
  {
@@ -1598,7 +1550,6 @@ export const MODELS: ModelPricing[] = [
1598
1550
  fast: { inputPerMTok: 3.5, outputPerMTok: 14 },
1599
1551
  },
1600
1552
  capability: 'frontier',
1601
- tier: 'frontier',
1602
1553
  notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
1603
1554
  },
1604
1555
  {
@@ -1614,7 +1565,6 @@ export const MODELS: ModelPricing[] = [
1614
1565
  caching: 'none',
1615
1566
  multipliers: { batch: 0.5 },
1616
1567
  capability: 'frontier',
1617
- tier: 'frontier',
1618
1568
  notes: OPENAI_EARLIER_NO_CACHE_NOTE + OPENAI_DEPRECATED_SUFFIX,
1619
1569
  },
1620
1570
  // ------------------------------------------------------------------------
@@ -1646,7 +1596,6 @@ export const MODELS: ModelPricing[] = [
1646
1596
  // The pricing page's specialized "Fast" table: $3.50/$28, cached $0.35.
1647
1597
  serviceTiers: { fast: { inputPerMTok: 3.5, outputPerMTok: 28 } },
1648
1598
  capability: 'frontier',
1649
- tier: 'frontier',
1650
1599
  notes: OPENAI_CODEX_NOTE + ' At most 272,000 input tokens.' + OPENAI_DEPRECATED_SUFFIX,
1651
1600
  },
1652
1601
  {
@@ -1661,7 +1610,6 @@ export const MODELS: ModelPricing[] = [
1661
1610
  caching: 'automatic',
1662
1611
  multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
1663
1612
  capability: 'frontier',
1664
- tier: 'frontier',
1665
1613
  notes: OPENAI_CODEX_NOTE + ' At most 272,000 input tokens.' + OPENAI_SHUT_DOWN_SUFFIX,
1666
1614
  },
1667
1615
  {
@@ -1676,7 +1624,6 @@ export const MODELS: ModelPricing[] = [
1676
1624
  caching: 'automatic',
1677
1625
  multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
1678
1626
  capability: 'frontier',
1679
- tier: 'frontier',
1680
1627
  notes: OPENAI_CODEX_NOTE + OPENAI_SHUT_DOWN_SUFFIX,
1681
1628
  },
1682
1629
  {
@@ -1691,7 +1638,6 @@ export const MODELS: ModelPricing[] = [
1691
1638
  caching: 'automatic',
1692
1639
  multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
1693
1640
  capability: 'frontier',
1694
- tier: 'frontier',
1695
1641
  notes: OPENAI_CODEX_NOTE + OPENAI_SHUT_DOWN_SUFFIX,
1696
1642
  },
1697
1643
  {
@@ -1706,7 +1652,6 @@ export const MODELS: ModelPricing[] = [
1706
1652
  caching: 'automatic',
1707
1653
  multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
1708
1654
  capability: 'mid',
1709
- tier: 'sonnet',
1710
1655
  notes: OPENAI_CODEX_NOTE + OPENAI_SHUT_DOWN_SUFFIX,
1711
1656
  },
1712
1657
  {
@@ -1721,7 +1666,6 @@ export const MODELS: ModelPricing[] = [
1721
1666
  caching: 'automatic',
1722
1667
  multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
1723
1668
  capability: 'frontier',
1724
- tier: 'frontier',
1725
1669
  notes: OPENAI_CODEX_NOTE + ' At most 272,000 input tokens.' + OPENAI_SHUT_DOWN_SUFFIX,
1726
1670
  },
1727
1671
  {
@@ -1736,7 +1680,6 @@ export const MODELS: ModelPricing[] = [
1736
1680
  caching: 'automatic',
1737
1681
  multipliers: { cacheRead: 0.25, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
1738
1682
  capability: 'mid',
1739
- tier: 'sonnet',
1740
1683
  notes: OPENAI_CODEX_NOTE + ' A cache read costs 0.25x input.' + OPENAI_SHUT_DOWN_SUFFIX,
1741
1684
  },
1742
1685
  {
@@ -1751,7 +1694,6 @@ export const MODELS: ModelPricing[] = [
1751
1694
  caching: 'automatic',
1752
1695
  multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
1753
1696
  capability: 'large',
1754
- tier: 'opus',
1755
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.',
1756
1698
  },
1757
1699
 
@@ -1805,7 +1747,6 @@ export const MODELS: ModelPricing[] = [
1805
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.',
1806
1748
  },
1807
1749
  capability: 'large',
1808
- tier: 'opus',
1809
1750
  notes:
1810
1751
  'From 2026-12-01 Google routes this id to Gemini 3.8 Flash and bills it at 3.8 Flash rates.'
1811
1752
  + ' Before then it bills $1.25/$10, and $2.50/$15.00 for a prompt over 200k tokens; this row prices every prompt'
@@ -1854,7 +1795,6 @@ export const MODELS: ModelPricing[] = [
1854
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.',
1855
1796
  },
1856
1797
  capability: 'mid',
1857
- tier: 'sonnet',
1858
1798
  notes:
1859
1799
  'From 2026-12-01 Google routes this id to Gemini 3.5 Flash-Lite and bills it at 3.5 Flash-Lite rates,'
1860
1800
  + ' which for text are the $0.30/$2.50 and $0.03 cached this row carries.',
@@ -1898,7 +1838,6 @@ export const MODELS: ModelPricing[] = [
1898
1838
  */
1899
1839
  multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
1900
1840
  capability: 'mid',
1901
- tier: 'sonnet',
1902
1841
  notes:
1903
1842
  'Implicit caching is automatic above 4,096 tokens. Explicit caching is also billed for storage:'
1904
1843
  + ' $0.50 per 1M tokens per hour through 2026-12-31, $1.00 after.',
@@ -1927,7 +1866,6 @@ export const MODELS: ModelPricing[] = [
1927
1866
  /* $0.075 / $0.75 = 0.1 (and $0.15 / $1.50); batch $0.375 / $0.75 = 0.5 (and $1.875 / $3.75). */
1928
1867
  multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
1929
1868
  capability: 'mid',
1930
- tier: 'sonnet',
1931
1869
  notes:
1932
1870
  'Implicit caching is automatic above 4,096 tokens. Explicit caching is also billed for storage:'
1933
1871
  + ' $0.50 per 1M tokens per hour through 2026-12-31, $1.00 after.',
@@ -1972,7 +1910,6 @@ export const MODELS: ModelPricing[] = [
1972
1910
  },
1973
1911
  ],
1974
1912
  capability: 'large',
1975
- tier: 'opus',
1976
1913
  notes:
1977
1914
  'Priced per request by prompt length: $2/$12 up to 200,000 input tokens and $4/$18 over it.'
1978
1915
  + ' Implicit caching is automatic above 4,096 tokens; explicit caching is also billed for storage,'
@@ -2018,7 +1955,6 @@ export const MODELS: ModelPricing[] = [
2018
1955
  caching: 'automatic',
2019
1956
  multipliers: { cacheRead: 0.05, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
2020
1957
  capability: 'frontier',
2021
- tier: 'frontier',
2022
1958
  notes: GEMINI_4_NOTE,
2023
1959
  },
2024
1960
  {
@@ -2033,7 +1969,6 @@ export const MODELS: ModelPricing[] = [
2033
1969
  caching: 'automatic',
2034
1970
  multipliers: { cacheRead: 0.05, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
2035
1971
  capability: 'frontier',
2036
- tier: 'frontier',
2037
1972
  notes: GEMINI_4_NOTE,
2038
1973
  },
2039
1974
  {
@@ -2047,7 +1982,6 @@ export const MODELS: ModelPricing[] = [
2047
1982
  caching: 'automatic',
2048
1983
  multipliers: { cacheRead: 0.05, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
2049
1984
  capability: 'mid',
2050
- tier: 'sonnet',
2051
1985
  notes: GEMINI_4_NOTE,
2052
1986
  },
2053
1987
  {
@@ -2072,7 +2006,6 @@ export const MODELS: ModelPricing[] = [
2072
2006
  caching: 'automatic',
2073
2007
  multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
2074
2008
  capability: 'small',
2075
- tier: 'haiku',
2076
2009
  notes:
2077
2010
  'Implicit caching is automatic, and no minimum prefix length is published for this model. Explicit caching is'
2078
2011
  + ' also billed for storage, $1.00 per 1M tokens per hour.',
@@ -2114,7 +2047,6 @@ export const MODELS: ModelPricing[] = [
2114
2047
  caching: 'automatic',
2115
2048
  multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 2, batch: 0.6 },
2116
2049
  capability: 'frontier',
2117
- tier: 'frontier',
2118
2050
  notes:
2119
2051
  'Cache writes are billed as their own line: 1x input for a 5-minute entry, 2x for an hour.'
2120
2052
  + ` ${NO_PUBLISHED_CACHE_MINIMUM}`,
@@ -2134,7 +2066,6 @@ export const MODELS: ModelPricing[] = [
2134
2066
  caching: 'automatic',
2135
2067
  multipliers: { cacheRead: 0.05, cacheWrite5m: 1, cacheWrite1h: 2, batch: null },
2136
2068
  capability: 'frontier',
2137
- tier: 'frontier',
2138
2069
  notes:
2139
2070
  'Cache writes are billed as their own line: 1x input for a 5-minute entry, 2x for an hour.'
2140
2071
  + ` No batch API for this model. ${NO_PUBLISHED_CACHE_MINIMUM}`,
@@ -2150,7 +2081,6 @@ export const MODELS: ModelPricing[] = [
2150
2081
  caching: 'automatic',
2151
2082
  multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 2, batch: 0.6 },
2152
2083
  capability: 'frontier',
2153
- tier: 'frontier',
2154
2084
  notes:
2155
2085
  'Cache writes are billed as their own line: 1x input for a 5-minute entry, 2x for an hour.'
2156
2086
  + ` Batch at 60% since the batch page listed it (read 2026-11-05). ${NO_PUBLISHED_CACHE_MINIMUM}`,
@@ -2169,7 +2099,6 @@ export const MODELS: ModelPricing[] = [
2169
2099
  /* $0.19 on a hit against $0.95; batch $0.57 / $2.40, 60%. */
2170
2100
  multipliers: { cacheRead: 0.2, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.6 },
2171
2101
  capability: 'mid',
2172
- tier: 'sonnet',
2173
2102
  notes: NO_PUBLISHED_CACHE_MINIMUM,
2174
2103
  },
2175
2104
  {
@@ -2186,7 +2115,6 @@ export const MODELS: ModelPricing[] = [
2186
2115
  /* $0.38 on a hit against $1.90; no batch API for this variant. */
2187
2116
  multipliers: { cacheRead: 0.2, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
2188
2117
  capability: 'mid',
2189
- tier: 'sonnet',
2190
2118
  notes: NO_PUBLISHED_CACHE_MINIMUM,
2191
2119
  },
2192
2120
  {
@@ -2203,7 +2131,6 @@ export const MODELS: ModelPricing[] = [
2203
2131
  /* $0.16 on a hit against $0.95, written as the ratio so the product is the page's figure. */
2204
2132
  multipliers: { cacheRead: 0.16 / 0.95, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.6 },
2205
2133
  capability: 'mid',
2206
- tier: 'sonnet',
2207
2134
  notes: NO_PUBLISHED_CACHE_MINIMUM,
2208
2135
  },
2209
2136
  {
@@ -2226,7 +2153,6 @@ export const MODELS: ModelPricing[] = [
2226
2153
  */
2227
2154
  recommendable: false,
2228
2155
  capability: 'mid',
2229
- tier: 'sonnet',
2230
2156
  notes:
2231
2157
  'Discontinued by Moonshot on 2026-05-25; priced at the last rate it published. No batch API.'
2232
2158
  + ` ${NO_PUBLISHED_CACHE_MINIMUM}`,
@@ -2252,7 +2178,6 @@ export const MODELS: ModelPricing[] = [
2252
2178
  'The supported API model names are deepseek-v4-pro, deepseek-v4-flash, and deepseek-v4-flash-vision-exp, but you passed deepseek-v3.',
2253
2179
  },
2254
2180
  capability: 'mid',
2255
- tier: 'sonnet',
2256
2181
  },
2257
2182
  {
2258
2183
  /*
@@ -2309,7 +2234,6 @@ export const MODELS: ModelPricing[] = [
2309
2234
  /* $0.003 cache hit against $0.15 input off-peak, $0.006 against $0.30 at peak. */
2310
2235
  multipliers: { cacheRead: 0.02, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
2311
2236
  capability: 'mid',
2312
- tier: 'sonnet',
2313
2237
  notes:
2314
2238
  'Retired 2026-09-10: the id is still accepted, served by V4.1 Flash and billed at the deepseek-flash price.'
2315
2239
  + ' Maximum output 384K tokens. Peak excludes Chinese public holidays, which this table cannot express.',
@@ -2343,7 +2267,6 @@ export const MODELS: ModelPricing[] = [
2343
2267
  caching: 'automatic',
2344
2268
  multipliers: { cacheRead: 0.02, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
2345
2269
  capability: 'mid',
2346
- tier: 'sonnet',
2347
2270
  notes:
2348
2271
  'Maximum output 384K tokens. Peak excludes Chinese public holidays, which this table cannot express:'
2349
2272
  + ' on a weekday holiday it charges peak where DeepSeek charges off-peak.',
@@ -2369,7 +2292,6 @@ export const MODELS: ModelPricing[] = [
2369
2292
  /* $0.022 cache hit against $0.66 input off-peak. */
2370
2293
  multipliers: { cacheRead: 0.0333, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
2371
2294
  capability: 'large',
2372
- tier: 'opus',
2373
2295
  notes: 'Maximum output 384K tokens.',
2374
2296
  },
2375
2297
 
@@ -2398,7 +2320,6 @@ export const MODELS: ModelPricing[] = [
2398
2320
  multipliers: { cacheRead: 0.25, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
2399
2321
  tiers: [GROK_LONG(4, 12)],
2400
2322
  capability: 'frontier',
2401
- tier: 'frontier',
2402
2323
  notes: NO_PUBLISHED_CACHE_MINIMUM,
2403
2324
  },
2404
2325
  {
@@ -2413,7 +2334,6 @@ export const MODELS: ModelPricing[] = [
2413
2334
  multipliers: { cacheRead: 0.25, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
2414
2335
  tiers: [GROK_LONG(4, 12)],
2415
2336
  capability: 'large',
2416
- tier: 'opus',
2417
2337
  notes: NO_PUBLISHED_CACHE_MINIMUM,
2418
2338
  },
2419
2339
  {
@@ -2429,7 +2349,6 @@ export const MODELS: ModelPricing[] = [
2429
2349
  multipliers: { cacheRead: 0.15, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
2430
2350
  tiers: [GROK_LONG(4, 12)],
2431
2351
  capability: 'large',
2432
- tier: 'opus',
2433
2352
  notes: NO_PUBLISHED_CACHE_MINIMUM,
2434
2353
  },
2435
2354
  {
@@ -2445,7 +2364,6 @@ export const MODELS: ModelPricing[] = [
2445
2364
  multipliers: { cacheRead: 0.16, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.8 },
2446
2365
  tiers: [GROK_LONG(2.5, 5)],
2447
2366
  capability: 'mid',
2448
- tier: 'sonnet',
2449
2367
  notes: NO_PUBLISHED_CACHE_MINIMUM,
2450
2368
  },
2451
2369
  {
@@ -2461,7 +2379,6 @@ export const MODELS: ModelPricing[] = [
2461
2379
  multipliers: { cacheRead: 0.16, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.8 },
2462
2380
  tiers: [GROK_LONG(2.5, 5)],
2463
2381
  capability: 'mid',
2464
- tier: 'sonnet',
2465
2382
  notes: NO_PUBLISHED_CACHE_MINIMUM,
2466
2383
  },
2467
2384
  {
@@ -2477,7 +2394,6 @@ export const MODELS: ModelPricing[] = [
2477
2394
  multipliers: { cacheRead: 0.16, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.8 },
2478
2395
  tiers: [GROK_LONG(2.5, 5)],
2479
2396
  capability: 'mid',
2480
- tier: 'sonnet',
2481
2397
  notes: NO_PUBLISHED_CACHE_MINIMUM,
2482
2398
  },
2483
2399
  {
@@ -2493,7 +2409,6 @@ export const MODELS: ModelPricing[] = [
2493
2409
  multipliers: { cacheRead: 0.16, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.8 },
2494
2410
  tiers: [GROK_LONG(2.5, 5)],
2495
2411
  capability: 'mid',
2496
- tier: 'sonnet',
2497
2412
  notes: NO_PUBLISHED_CACHE_MINIMUM,
2498
2413
  },
2499
2414
  {
@@ -2508,7 +2423,6 @@ export const MODELS: ModelPricing[] = [
2508
2423
  multipliers: { cacheRead: 0.2, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
2509
2424
  tiers: [GROK_LONG(2, 4)],
2510
2425
  capability: 'mid',
2511
- tier: 'sonnet',
2512
2426
  notes: NO_PUBLISHED_CACHE_MINIMUM,
2513
2427
  },
2514
2428
  {
@@ -2541,7 +2455,6 @@ export const MODELS: ModelPricing[] = [
2541
2455
  ],
2542
2456
  recommendable: false,
2543
2457
  capability: 'large',
2544
- tier: 'opus',
2545
2458
  notes:
2546
2459
  'Retired by xAI on 2026-05-15 and redirected to Grok 4.3, whose price it bills at from then;'
2547
2460
  + ` $3/$15 before. ${NO_PUBLISHED_CACHE_MINIMUM}`,
@@ -2567,7 +2480,6 @@ export const MODELS: ModelPricing[] = [
2567
2480
  'Invalid model: mistral-large-2',
2568
2481
  },
2569
2482
  capability: 'large',
2570
- tier: 'opus',
2571
2483
  notes: 'No prompt caching: reordering still helps readability but saves nothing here.',
2572
2484
  },
2573
2485
  {
@@ -2598,7 +2510,6 @@ export const MODELS: ModelPricing[] = [
2598
2510
  caching: 'unknown',
2599
2511
  multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
2600
2512
  capability: 'large',
2601
- tier: 'opus',
2602
2513
  notes: MISTRAL_CACHE_NOTE,
2603
2514
  },
2604
2515
  {
@@ -2626,7 +2537,6 @@ export const MODELS: ModelPricing[] = [
2626
2537
  caching: 'unknown',
2627
2538
  multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
2628
2539
  capability: 'mid',
2629
- tier: 'sonnet',
2630
2540
  notes: MISTRAL_CACHE_NOTE,
2631
2541
  },
2632
2542
  {
@@ -2642,7 +2552,6 @@ export const MODELS: ModelPricing[] = [
2642
2552
  caching: 'unknown',
2643
2553
  multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
2644
2554
  capability: 'small',
2645
- tier: 'haiku',
2646
2555
  notes: MISTRAL_CACHE_NOTE,
2647
2556
  },
2648
2557
  ];
@@ -2745,14 +2654,17 @@ export function modelFrom(catalogue: PricingCatalogue, id: string): ModelPricing
2745
2654
  }
2746
2655
 
2747
2656
  /**
2748
- * 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.
2749
2661
  *
2750
2662
  * Compared on the **effective** price, so a model in a promotional window is
2751
2663
  * ranked at what it actually costs today rather than at its list price.
2752
2664
  */
2753
- export function cheapestOfTierIn(
2665
+ export function cheapestOfCapabilityIn(
2754
2666
  catalogue: PricingCatalogue,
2755
- tier: ModelPricing['tier'],
2667
+ capability: Capability,
2756
2668
  on: Date = new Date(),
2757
2669
  /**
2758
2670
  * Restrict to one provider. Omit to search the whole catalogue, which is what
@@ -2764,12 +2676,12 @@ export function cheapestOfTierIn(
2764
2676
  ): ModelPricing {
2765
2677
  const candidates = catalogue.models.filter(
2766
2678
  (m) =>
2767
- m.tier === tier &&
2679
+ m.capability === capability &&
2768
2680
  isOffered(m) &&
2769
2681
  (provider === undefined || m.provider === provider),
2770
2682
  );
2771
2683
  const first = candidates[0];
2772
- if (!first) throw new Error(`No models for tier "${tier}"`);
2684
+ if (!first) throw new Error(`No models for capability "${capability}"`);
2773
2685
  return candidates.reduce(
2774
2686
  (best, m) =>
2775
2687
  effectivePricing(m, on).inputPerMTok < effectivePricing(best, on).inputPerMTok ? m : best,
@@ -3258,11 +3170,11 @@ export function reviewedForModels(
3258
3170
  return oldest ?? catalogue.lastReviewed;
3259
3171
  }
3260
3172
 
3261
- /** Cheapest model of each capability tier, for recommendations. */
3262
- export function cheapestOfTier(tier: ModelPricing['tier']): ModelPricing {
3263
- 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));
3264
3176
  const first = candidates[0];
3265
- if (!first) throw new Error(`No models for tier "${tier}"`);
3177
+ if (!first) throw new Error(`No models for capability "${capability}"`);
3266
3178
  return candidates.reduce((best, m) => (m.inputPerMTok < best.inputPerMTok ? m : best), first);
3267
3179
  }
3268
3180