@trazum/core 2.7.0 → 2.7.2

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/pricing.js CHANGED
@@ -33,8 +33,20 @@ export const PROVIDER_REVIEWED = Object.freeze({
33
33
  * each model's own page, read 2026-10-10. Every existing row matched and
34
34
  * five models were added. Claude Haiku 5.5 waited for per-request pricing,
35
35
  * because it bills by prompt length, and was added with it on 2026-10-11.
36
+ *
37
+ * Re-read 2026-11-05 with the fast-mode, deprecations and prompt-caching
38
+ * pages. Every existing price matched. Two things were missing: fast mode,
39
+ * which bills Opus 5.5 at $8/$40 and Opus 5 and 4.8 at $10/$50 and which
40
+ * every response records in `usage.speed`, so fast calls had been priced at
41
+ * half their cost; and Claude Sonnet 4.5, deprecated but still served until
42
+ * 2026-11-30, which read as unpriced. Both are here now. So are the
43
+ * retired Opus 4.1, Opus 4, Sonnet 4 and Haiku 3.5, still on the pricing
44
+ * page and in every log from before their retirement: their own model pages
45
+ * are gone, and the context-windows page gives each the 200k window every
46
+ * Claude model outside its 1M list has. Claude Sonnet 3.7 and Haiku 3 are
47
+ * retired and absent from the pricing page, so they stay unpriced.
36
48
  */
37
- anthropic: '2026-10-10',
49
+ anthropic: '2026-11-05',
38
50
  /*
39
51
  * developers.openai.com/api/docs/pricing, read 2026-08-31.
40
52
  *
@@ -55,8 +67,16 @@ export const PROVIDER_REVIEWED = Object.freeze({
55
67
  * gpt-6-sol, gpt-6-luna and gpt-5.6 sol, terra and luna) waited for
56
68
  * per-request pricing, since each doubles its rates for prompts over 272K
57
69
  * tokens, and was added with it the same day, from each model's own page.
70
+ *
71
+ * Re-read 2026-11-05: pricing.md, prompt-caching.md and every model page
72
+ * named below, in their Markdown form. Every existing price matched. New:
73
+ * GPT-6.1 Terra; a 12-hour cache write at 2.5x input on GPT-5.6 and later,
74
+ * which the usage object splits from the 30-minute kind and which was being
75
+ * priced as one, at half its cost; and sixteen earlier models that are still
76
+ * billed and still in logs (GPT-5.5, 5.4, 5.2, 5.1 and their mini, nano and
77
+ * pro siblings, GPT-5 pro, GPT-4.1, GPT-4o and o3), none of which was priced.
58
78
  */
59
- openai: '2026-10-11',
79
+ openai: '2026-11-05',
60
80
  /*
61
81
  * ai.google.dev/gemini-api/docs/pricing, docs/caching and the model pages,
62
82
  * read 2026-10-10. Every price matched; what changed is how caching starts
@@ -76,8 +96,14 @@ export const PROVIDER_REVIEWED = Object.freeze({
76
96
  * and added nothing. Kimi K3, K2.7 Code (and its high-speed variant) and
77
97
  * K2.6 are priced now. `kimi-k2` was discontinued on 2026-05-25 by the
78
98
  * provider's own notice, so it stays priced and is no longer recommended.
99
+ *
100
+ * Re-read 2026-11-05 from the HTML page's compiled tables, the Markdown
101
+ * form now serving them empty. Every price matched; K3.1 Pro and its
102
+ * high-speed variant are added, K3 gains its 60% batch price, and the K2
103
+ * series, closed to new accounts and retiring in December, is no longer
104
+ * recommended.
79
105
  */
80
- moonshot: '2026-10-11',
106
+ moonshot: '2026-11-05',
81
107
  /*
82
108
  * api-docs.deepseek.com/quick_start/pricing read 2026-10-10, and the
83
109
  * 2026-09-10 announcement (api-docs.deepseek.com/news/news260910) read
@@ -85,8 +111,13 @@ export const PROVIDER_REVIEWED = Object.freeze({
85
111
  * Sept 10, 2026." V4 Flash was retired that day and its id now bills at
86
112
  * the new deepseek-flash price, so the old price lives in its `history`.
87
113
  * V4 Pro matched the page unchanged.
114
+ *
115
+ * Re-read 2026-11-05: every price, the peak window (01:00-04:00 and
116
+ * 06:00-10:00 UTC, Monday to Friday, Chinese public holidays off-peak in
117
+ * full) and the cache-hit prices matched. The Flash version behind
118
+ * `deepseek-flash` is now named DeepSeek-V4.1-Flash-1017, at the same price.
88
119
  */
89
- deepseek: '2026-10-10',
120
+ deepseek: '2026-11-05',
90
121
  /*
91
122
  * docs.x.ai/developers/models, each model's page and the 2026-05-15
92
123
  * retirement notice, read 2026-10-11 in their Markdown form. Grok 4.7, 4.6,
@@ -94,8 +125,11 @@ export const PROVIDER_REVIEWED = Object.freeze({
94
125
  * request pays once its prompt reaches 200k tokens, which per-request
95
126
  * pricing can now express. `grok-4` was retired on 2026-05-15 and its calls
96
127
  * have billed at Grok 4.3's prices since, so it carries both periods.
128
+ *
129
+ * Re-read 2026-11-05 (docs.x.ai/developers/models.md): every model, price,
130
+ * cached price, 200k threshold and context window matched. Nothing new.
97
131
  */
98
- xai: '2026-10-11',
132
+ xai: '2026-11-05',
99
133
  /*
100
134
  * `mistral.ai/pricing`, read 2026-08-28 — by a human, because the page
101
135
  * renders its table in the browser and serves a fetch only an FAQ example
@@ -116,8 +150,13 @@ export const PROVIDER_REVIEWED = Object.freeze({
116
150
  * price as carrying the cache discount. This table said Mistral had no
117
151
  * prompt caching at all. docs.mistral.ai, where a minimum or a mechanism
118
152
  * would be, is not reachable from here, so neither is claimed.
153
+ *
154
+ * Re-read 2026-11-05 from the same three model cards' `data-prices` and
155
+ * mistral.ai/cloud/inference: Large 2512 at $0.50/$1.50, Medium 3.5 at
156
+ * $1.50/$7.50 and Small 2603 at $0.15/$0.60 matched, as did the 90% cached
157
+ * input discount. docs.mistral.ai is still not reachable from here.
119
158
  */
120
- mistral: '2026-10-11',
159
+ mistral: '2026-11-05',
121
160
  });
122
161
  /**
123
162
  * The catalogue's age is its oldest provider's, because a reader asking how
@@ -204,10 +243,36 @@ const GROK_LONG = (inputPerMTok, outputPerMTok) => ({
204
243
  * carrying this sentence, so a forgotten minimum cannot pass as a deliberate one.
205
244
  */
206
245
  const NO_PUBLISHED_CACHE_MINIMUM = 'Caches automatically, but no minimum prefix length is published, so no caching advice is given for it.';
207
- /** OpenAI's GPT-5.6 and later: one cache entry, living at least 30 minutes. */
208
- const OPENAI_CACHE_TTL = Object.freeze({ writeMs: 30 * 60_000, longerMs: null });
246
+ /**
247
+ * OpenAI's GPT-5.6 and later: an entry lives at least 30 minutes by default,
248
+ * and the Responses API sells a 12-hour one (`prompt_cache_options.ttl`). The
249
+ * two write prices are the `cacheWrite5m` and `cacheWrite1h` multipliers: the
250
+ * catalogue's short and long write, whatever each provider's durations.
251
+ */
252
+ const OPENAI_CACHE_TTL = Object.freeze({ writeMs: 30 * 60_000, longerMs: 12 * 60 * 60_000 });
253
+ /**
254
+ * OpenAI's service-tier tables, read from developers.openai.com/api/docs/pricing.md
255
+ * on 2026-11-05: the Flex, Fast and Ultrafast tables beside the Standard one,
256
+ * each model's row as printed, and its "Long context" columns where the table
257
+ * publishes them ("Short context: <=272K input tokens. Long context: >272K").
258
+ * A row whose long columns read "-" gets no long band here: GPT-5.5 and 5.4 in
259
+ * Fast, GPT-5.5 pro in Flex. See `ModelPricing.serviceTiers`.
260
+ */
261
+ const openAiLongBand = (inputPerMTok, outputPerMTok) => [
262
+ { id: 'over-272k', when: { kind: 'input-tokens-above', tokens: 272_000 }, inputPerMTok, outputPerMTok },
263
+ ];
209
264
  const OPENAI_CURRENT_NOTE = 'Priced per request by prompt length: over 272,000 input tokens, 2x input and cache and 1.5x output for'
210
- + ' the whole request. Cache writes cost 1.25x input and an entry lives at least 30 minutes.';
265
+ + ' the whole request. Cache writes cost 1.25x input for the default 30-minute entry and 2.5x for a'
266
+ + ' 12-hour one (Responses API).';
267
+ const OPENAI_EARLIER_NOTE = 'Caching is automatic; a write costs what input costs. OpenAI says the minimum for models before GPT-5.6 varies by'
268
+ + ' request settings, so 1,024 here is the nearest published floor.';
269
+ const OPENAI_EARLIER_LONG_NOTE = 'Priced per request by prompt length: over 272,000 input tokens, 2x input and 1.5x output for the whole request. '
270
+ + OPENAI_EARLIER_NOTE;
271
+ const OPENAI_EARLIER_NO_CACHE_NOTE = 'OpenAI publishes no cached-input price for this model, so caching is not priced.';
272
+ const OPENAI_DEPRECATED_SUFFIX = ' Deprecated by OpenAI: priced for the logs that hold it, never recommended.';
273
+ const OPENAI_SHUT_DOWN_SUFFIX = ' Shut down by OpenAI: priced for the logs that hold it, never recommended.';
274
+ const OPENAI_CODEX_NOTE = 'Caching is automatic; a write costs what input costs. Responses API only, and no batch. OpenAI says the minimum for'
275
+ + ' models before GPT-5.6 varies by request settings, so 1,024 here is the nearest published floor.';
211
276
  const OPENAI_GPT5_NOTE = 'Caching is automatic, with no cache_control to set. OpenAI says the minimum for models before GPT-5.6 varies by'
212
277
  + ' request settings, so 1,024 here is the nearest published floor. The 2025-08-07 snapshot shuts down on'
213
278
  + ' 2026-12-11; OpenAI names the gpt-5.6 models as replacements.';
@@ -295,9 +360,18 @@ export const MODELS = [
295
360
  contextWindow: 1_000_000,
296
361
  cacheMinTokens: 512,
297
362
  multipliers: { cacheRead: 0.05, cacheWrite5m: 1.25, cacheWrite1h: 2, batch: 0.5 },
363
+ /*
364
+ * Fast mode, read 2026-11-05 from platform.claude.com/docs/en/about-claude/
365
+ * pricing#fast-mode-pricing and build-with-claude/fast-mode: $8/$40 "across
366
+ * the full context window", with the caching multipliers "on top", which is
367
+ * how a tier's rate already feeds the cache prices here. The response's
368
+ * `usage.speed` says which speed ran.
369
+ */
370
+ tiers: [{ id: 'fast', when: { kind: 'speed', speed: 'fast' }, inputPerMTok: 8, outputPerMTok: 40 }],
298
371
  capability: 'large',
299
372
  tier: 'opus',
300
- notes: 'Cache hits cost 5% of the input price ($0.20), against 10% on Opus 5 and earlier.',
373
+ notes: 'Cache hits cost 5% of the input price ($0.20), against 10% on Opus 5 and earlier.'
374
+ + ' Fast mode (usage.speed "fast") bills $8/$40.',
301
375
  },
302
376
  {
303
377
  id: 'claude-opus-5',
@@ -307,9 +381,11 @@ export const MODELS = [
307
381
  outputPerMTok: 25,
308
382
  contextWindow: 1_000_000,
309
383
  cacheMinTokens: 512,
384
+ // Fast mode in research preview, $10/$50; same sources as Opus 5.5's.
385
+ tiers: [{ id: 'fast', when: { kind: 'speed', speed: 'fast' }, inputPerMTok: 10, outputPerMTok: 50 }],
310
386
  capability: 'large',
311
387
  tier: 'opus',
312
- notes: '512-token cache minimum: caches prompts that would miss on Opus 4.6.',
388
+ notes: '512-token cache minimum: caches prompts that would miss on Opus 4.6. Fast mode bills $10/$50.',
313
389
  },
314
390
  {
315
391
  id: 'claude-opus-4-8',
@@ -319,8 +395,15 @@ export const MODELS = [
319
395
  outputPerMTok: 25,
320
396
  contextWindow: 1_000_000,
321
397
  cacheMinTokens: 1024,
398
+ /*
399
+ * Fast mode in research preview, $10/$50; same sources as Opus 5.5's. It is
400
+ * deprecated on this model and removed on 2026-11-30, after which no
401
+ * response records it, so the tier only ever prices calls that ran fast.
402
+ */
403
+ tiers: [{ id: 'fast', when: { kind: 'speed', speed: 'fast' }, inputPerMTok: 10, outputPerMTok: 50 }],
322
404
  capability: 'large',
323
405
  tier: 'opus',
406
+ notes: 'Fast mode bills $10/$50 until it is removed from this model on 2026-11-30.',
324
407
  },
325
408
  {
326
409
  id: 'claude-opus-4-7',
@@ -365,6 +448,51 @@ export const MODELS = [
365
448
  tier: 'opus',
366
449
  notes: '200K context window and a 64K output cap.',
367
450
  },
451
+ {
452
+ /*
453
+ * Retired on the Claude API on 2026-08-05 (the deprecations page, read
454
+ * 2026-11-05) and still served on Claude Models on Google Cloud (Google
455
+ * managed) and on Bedrock. Priced because a year of logs carries it and,
456
+ * unpriced, every one of those calls read as a gap. The pricing page, read
457
+ * the same day: $15/$75, writes $18.75 and $30, cache hits $1.50, batch
458
+ * $7.50/$37.50, which are the default multipliers. Its model page is gone;
459
+ * the context-windows page gives every Claude model outside its 1M list a
460
+ * 200k window, and the prompt-caching page a 1,024-token cache minimum.
461
+ * The dated id is the one the deprecations page names and what a log
462
+ * carries; no shorter alias is on any page read, so none is declared.
463
+ */
464
+ id: 'claude-opus-4-1-20250805',
465
+ provider: 'anthropic',
466
+ displayName: 'Claude Opus 4.1',
467
+ recommendable: false,
468
+ inputPerMTok: 15,
469
+ outputPerMTok: 75,
470
+ contextWindow: 200_000,
471
+ cacheMinTokens: 1024,
472
+ capability: 'large',
473
+ tier: 'opus',
474
+ notes: 'Retired on the Claude API on 2026-08-05; still served on Google Cloud (Google managed) and Bedrock.'
475
+ + ' Anthropic names Claude Opus 4.8 as the replacement.',
476
+ },
477
+ {
478
+ /*
479
+ * Retired on the Claude API on 2026-06-15; still served on Claude Models
480
+ * on Google Cloud (Google managed). The same pages and the same figures as
481
+ * Opus 4.1 above: $15/$75, 200k context, a 1,024-token cache minimum.
482
+ */
483
+ id: 'claude-opus-4-20250514',
484
+ provider: 'anthropic',
485
+ displayName: 'Claude Opus 4',
486
+ recommendable: false,
487
+ inputPerMTok: 15,
488
+ outputPerMTok: 75,
489
+ contextWindow: 200_000,
490
+ cacheMinTokens: 1024,
491
+ capability: 'large',
492
+ tier: 'opus',
493
+ notes: 'Retired on the Claude API on 2026-06-15; still served on Google Cloud (Google managed).'
494
+ + ' Anthropic names Claude Opus 4.8 as the replacement.',
495
+ },
368
496
  {
369
497
  /*
370
498
  * The pricing page and the Sonnet 5.5 model page, read 2026-10-10. The
@@ -407,6 +535,52 @@ export const MODELS = [
407
535
  capability: 'mid',
408
536
  tier: 'sonnet',
409
537
  },
538
+ {
539
+ /*
540
+ * Its own model page (platform.claude.com/docs/en/models/sonnet-4-5/
541
+ * overview), the pricing page, the prompt-caching page and the
542
+ * deprecations page, read 2026-11-05. $3/$15, writes $3.75 and $6, cache
543
+ * read $0.30, batch 50% off, 200K context, 1,024-token cache minimum.
544
+ * Deprecated on 2026-09-30 and retiring on 2026-11-30, so it is priced (it
545
+ * is in every log of the last year) and never recommended. It was missing
546
+ * here, so every Sonnet 4.5 call read as an unpriced model.
547
+ */
548
+ id: 'claude-sonnet-4-5',
549
+ aliases: ['claude-sonnet-4-5-20250929'],
550
+ provider: 'anthropic',
551
+ displayName: 'Claude Sonnet 4.5',
552
+ recommendable: false,
553
+ inputPerMTok: 3,
554
+ outputPerMTok: 15,
555
+ contextWindow: 200_000,
556
+ cacheMinTokens: 1024,
557
+ capability: 'mid',
558
+ tier: 'sonnet',
559
+ notes: 'Deprecated; retires 2026-11-30. Recommended replacement: Claude Sonnet 5.5.',
560
+ },
561
+ {
562
+ /*
563
+ * Retired on the Claude API on 2026-06-15 (the deprecations page, read
564
+ * 2026-11-05); still served on Claude Models on Google Cloud (Google
565
+ * managed) and on Bedrock. The pricing page, read the same day: $3/$15,
566
+ * writes $3.75 and $6, cache hits $0.30, batch $1.50/$7.50. 200k context
567
+ * from the context-windows page, a 1,024-token cache minimum from the
568
+ * prompt-caching page. The pricing page publishes one rate for it and no
569
+ * long-context band, so every call is priced at that rate.
570
+ */
571
+ id: 'claude-sonnet-4-20250514',
572
+ provider: 'anthropic',
573
+ displayName: 'Claude Sonnet 4',
574
+ recommendable: false,
575
+ inputPerMTok: 3,
576
+ outputPerMTok: 15,
577
+ contextWindow: 200_000,
578
+ cacheMinTokens: 1024,
579
+ capability: 'mid',
580
+ tier: 'sonnet',
581
+ notes: 'Retired on the Claude API on 2026-06-15; still served on Google Cloud (Google managed) and Bedrock.'
582
+ + ' Anthropic names Claude Sonnet 5.5 as the replacement.',
583
+ },
410
584
  {
411
585
  /*
412
586
  * The pricing page, the models overview and the prompt-caching page, read
@@ -461,6 +635,28 @@ export const MODELS = [
461
635
  tier: 'haiku',
462
636
  notes: '200K context window and a 64K output cap, smaller than the rest.',
463
637
  },
638
+ {
639
+ /*
640
+ * Retired on the Claude API on 2026-02-19 (the deprecations page, read
641
+ * 2026-11-05); still served on Claude Models on Google Cloud (Google
642
+ * managed). The pricing page, read the same day: $0.80/$4, writes $1 and
643
+ * $1.60, cache hits $0.08, batch $0.40/$2, the default multipliers. 200k
644
+ * context from the context-windows page, and the prompt-caching page's
645
+ * 2,048-token cache minimum.
646
+ */
647
+ id: 'claude-3-5-haiku-20241022',
648
+ provider: 'anthropic',
649
+ displayName: 'Claude Haiku 3.5',
650
+ recommendable: false,
651
+ inputPerMTok: 0.8,
652
+ outputPerMTok: 4,
653
+ contextWindow: 200_000,
654
+ cacheMinTokens: 2048,
655
+ capability: 'small',
656
+ tier: 'haiku',
657
+ notes: 'Retired on the Claude API on 2026-02-19; still served on Google Cloud (Google managed).'
658
+ + ' Anthropic names Claude Haiku 4.5 as the replacement.',
659
+ },
464
660
  // ------------------------------------------------------------------------
465
661
  // OpenAI
466
662
  //
@@ -483,8 +679,17 @@ export const MODELS = [
483
679
  // - **Cache writes are billed**, at 1.25x the uncached input rate, and the
484
680
  // usage object reports them (`cache_write_tokens`). Reads are 10% of input,
485
681
  // 5% on GPT-6.1 Sol.
486
- // - **An entry lives at least 30 minutes** after its last write or read, and
487
- // there is no longer one to buy: `cacheTtl`.
682
+ // - **An entry lives at least 30 minutes** after its last write or read:
683
+ // `cacheTtl`. On 2026-10-11 there was no longer one to buy.
684
+ //
685
+ // Re-read 2026-11-05 (pricing.md, prompt-caching.md and the GPT-6.1 pages,
686
+ // in their Markdown form). Every price matched. Two things are new: GPT-6.1
687
+ // Terra, and a **12-hour cache write** in the Responses API at 2.5x input
688
+ // (`prompt_cache_options.ttl: "12h"`), reported in
689
+ // `input_tokens_details.cache_write_tokens_details` as `ttl_30m_tokens` and
690
+ // `ttl_12h_tokens`, "both fields returned, including when one is zero". A
691
+ // 12-hour write is the long write here; read as a 30-minute one, it was
692
+ // priced at half its cost.
488
693
  //
489
694
  // Caching is implicit by default (a breakpoint at the end of the latest
490
695
  // eligible message) from a 1,024-token minimum. Batch and Flex are half
@@ -501,7 +706,7 @@ export const MODELS = [
501
706
  contextWindow: 1_050_000,
502
707
  cacheMinTokens: 1024,
503
708
  caching: 'automatic',
504
- multipliers: { cacheRead: 0.1, cacheWrite5m: 1.25, cacheWrite1h: 1.25, batch: 0.5 },
709
+ multipliers: { cacheRead: 0.1, cacheWrite5m: 1.25, cacheWrite1h: 2.5, batch: 0.5 },
505
710
  cacheTtl: OPENAI_CACHE_TTL,
506
711
  tiers: [
507
712
  {
@@ -511,6 +716,11 @@ export const MODELS = [
511
716
  outputPerMTok: 75,
512
717
  },
513
718
  ],
719
+ serviceTiers: {
720
+ flex: { inputPerMTok: 5, outputPerMTok: 25, tiers: openAiLongBand(10, 37.5) },
721
+ fast: { inputPerMTok: 20, outputPerMTok: 100, tiers: openAiLongBand(40, 150) },
722
+ ultrafast: { inputPerMTok: 60, outputPerMTok: 300, tiers: openAiLongBand(120, 450) },
723
+ },
514
724
  capability: 'frontier',
515
725
  tier: 'frontier',
516
726
  notes: OPENAI_CURRENT_NOTE,
@@ -524,7 +734,7 @@ export const MODELS = [
524
734
  contextWindow: 1_050_000,
525
735
  cacheMinTokens: 1024,
526
736
  caching: 'automatic',
527
- multipliers: { cacheRead: 0.05, cacheWrite5m: 1.25, cacheWrite1h: 1.25, batch: 0.5 },
737
+ multipliers: { cacheRead: 0.05, cacheWrite5m: 1.25, cacheWrite1h: 2.5, batch: 0.5 },
528
738
  cacheTtl: OPENAI_CACHE_TTL,
529
739
  tiers: [
530
740
  {
@@ -534,10 +744,48 @@ export const MODELS = [
534
744
  outputPerMTok: 15,
535
745
  },
536
746
  ],
747
+ serviceTiers: {
748
+ flex: { inputPerMTok: 1, outputPerMTok: 5, tiers: openAiLongBand(2, 7.5) },
749
+ fast: { inputPerMTok: 4, outputPerMTok: 20, tiers: openAiLongBand(8, 30) },
750
+ ultrafast: { inputPerMTok: 12, outputPerMTok: 60, tiers: openAiLongBand(24, 90) },
751
+ },
537
752
  capability: 'large',
538
753
  tier: 'opus',
539
754
  notes: OPENAI_CURRENT_NOTE,
540
755
  },
756
+ {
757
+ /*
758
+ * developers.openai.com/api/docs/models/gpt-6.1-terra.md, read 2026-11-05:
759
+ * $1/$5, cached input $0.05 ("5% of the uncached input token rate"), cache
760
+ * writes $1.25 for 30 minutes and $2.50 for 12 hours, the same 272K band,
761
+ * 1,050,000 context, 922,000 input and 128,000 output.
762
+ */
763
+ id: 'gpt-6.1-terra',
764
+ provider: 'openai',
765
+ displayName: 'GPT-6.1 Terra',
766
+ inputPerMTok: 1,
767
+ outputPerMTok: 5,
768
+ contextWindow: 1_050_000,
769
+ cacheMinTokens: 1024,
770
+ caching: 'automatic',
771
+ multipliers: { cacheRead: 0.05, cacheWrite5m: 1.25, cacheWrite1h: 2.5, batch: 0.5 },
772
+ cacheTtl: OPENAI_CACHE_TTL,
773
+ tiers: [
774
+ {
775
+ id: 'over-272k',
776
+ when: { kind: 'input-tokens-above', tokens: 272_000 },
777
+ inputPerMTok: 2,
778
+ outputPerMTok: 7.5,
779
+ },
780
+ ],
781
+ serviceTiers: {
782
+ flex: { inputPerMTok: 0.5, outputPerMTok: 2.5, tiers: openAiLongBand(1, 3.75) },
783
+ fast: { inputPerMTok: 2, outputPerMTok: 10, tiers: openAiLongBand(4, 15) },
784
+ },
785
+ capability: 'mid',
786
+ tier: 'sonnet',
787
+ notes: OPENAI_CURRENT_NOTE,
788
+ },
541
789
  {
542
790
  id: 'gpt-6-sol',
543
791
  provider: 'openai',
@@ -547,7 +795,7 @@ export const MODELS = [
547
795
  contextWindow: 1_050_000,
548
796
  cacheMinTokens: 1024,
549
797
  caching: 'automatic',
550
- multipliers: { cacheRead: 0.1, cacheWrite5m: 1.25, cacheWrite1h: 1.25, batch: 0.5 },
798
+ multipliers: { cacheRead: 0.1, cacheWrite5m: 1.25, cacheWrite1h: 2.5, batch: 0.5 },
551
799
  cacheTtl: OPENAI_CACHE_TTL,
552
800
  tiers: [
553
801
  {
@@ -557,6 +805,10 @@ export const MODELS = [
557
805
  outputPerMTok: 15,
558
806
  },
559
807
  ],
808
+ serviceTiers: {
809
+ flex: { inputPerMTok: 1, outputPerMTok: 5, tiers: openAiLongBand(2, 7.5) },
810
+ fast: { inputPerMTok: 4, outputPerMTok: 20, tiers: openAiLongBand(8, 30) },
811
+ },
560
812
  capability: 'large',
561
813
  tier: 'opus',
562
814
  notes: OPENAI_CURRENT_NOTE,
@@ -570,7 +822,7 @@ export const MODELS = [
570
822
  contextWindow: 1_050_000,
571
823
  cacheMinTokens: 1024,
572
824
  caching: 'automatic',
573
- multipliers: { cacheRead: 0.1, cacheWrite5m: 1.25, cacheWrite1h: 1.25, batch: 0.5 },
825
+ multipliers: { cacheRead: 0.1, cacheWrite5m: 1.25, cacheWrite1h: 2.5, batch: 0.5 },
574
826
  cacheTtl: OPENAI_CACHE_TTL,
575
827
  tiers: [
576
828
  {
@@ -580,12 +832,30 @@ export const MODELS = [
580
832
  outputPerMTok: 0.75,
581
833
  },
582
834
  ],
835
+ serviceTiers: {
836
+ flex: { inputPerMTok: 0.05, outputPerMTok: 0.25, tiers: openAiLongBand(0.1, 0.375) },
837
+ fast: { inputPerMTok: 0.2, outputPerMTok: 1, tiers: openAiLongBand(0.4, 1.5) },
838
+ },
583
839
  capability: 'small',
584
840
  tier: 'haiku',
585
841
  notes: OPENAI_CURRENT_NOTE,
586
842
  },
587
843
  {
844
+ /*
845
+ * Its model page, read 2026-11-05: "The `gpt-5.6` alias routes requests
846
+ * to GPT-5.6 Sol", so a log that names the alias is this model; and
847
+ * "$4 per million input tokens and $20 per million output tokens, a 20%
848
+ * reduction in input pricing and a 33% reduction in output pricing ...
849
+ * promotional pricing is available until November 30, 2026". The price
850
+ * after the promotion is not published as a figure, and deriving one
851
+ * from two rounded percentages would be a price nobody quoted, so the row
852
+ * carries what the page charges today. When the page changes,
853
+ * `scripts/price-drift.mjs` reports it on the next weekly run; until a
854
+ * person reads the new figure, a call after 2026-11-30 may be priced low,
855
+ * and the note says so to anyone reading the row.
856
+ */
588
857
  id: 'gpt-5.6-sol',
858
+ aliases: ['gpt-5.6'],
589
859
  provider: 'openai',
590
860
  displayName: 'GPT-5.6 Sol',
591
861
  inputPerMTok: 4,
@@ -593,7 +863,7 @@ export const MODELS = [
593
863
  contextWindow: 1_050_000,
594
864
  cacheMinTokens: 1024,
595
865
  caching: 'automatic',
596
- multipliers: { cacheRead: 0.1, cacheWrite5m: 1.25, cacheWrite1h: 1.25, batch: 0.5 },
866
+ multipliers: { cacheRead: 0.1, cacheWrite5m: 1.25, cacheWrite1h: 2.5, batch: 0.5 },
597
867
  cacheTtl: OPENAI_CACHE_TTL,
598
868
  tiers: [
599
869
  {
@@ -603,9 +873,14 @@ export const MODELS = [
603
873
  outputPerMTok: 30,
604
874
  },
605
875
  ],
876
+ serviceTiers: {
877
+ flex: { inputPerMTok: 2, outputPerMTok: 10, tiers: openAiLongBand(4, 15) },
878
+ fast: { inputPerMTok: 8, outputPerMTok: 40, tiers: openAiLongBand(16, 60) },
879
+ },
606
880
  capability: 'large',
607
881
  tier: 'opus',
608
- notes: OPENAI_CURRENT_NOTE,
882
+ notes: OPENAI_CURRENT_NOTE
883
+ + ' $4/$20 is promotional until 2026-11-30, and OpenAI has not published the price after it as a figure.',
609
884
  },
610
885
  {
611
886
  id: 'gpt-5.6-terra',
@@ -616,7 +891,7 @@ export const MODELS = [
616
891
  contextWindow: 1_050_000,
617
892
  cacheMinTokens: 1024,
618
893
  caching: 'automatic',
619
- multipliers: { cacheRead: 0.1, cacheWrite5m: 1.25, cacheWrite1h: 1.25, batch: 0.5 },
894
+ multipliers: { cacheRead: 0.1, cacheWrite5m: 1.25, cacheWrite1h: 2.5, batch: 0.5 },
620
895
  cacheTtl: OPENAI_CACHE_TTL,
621
896
  tiers: [
622
897
  {
@@ -626,6 +901,10 @@ export const MODELS = [
626
901
  outputPerMTok: 18,
627
902
  },
628
903
  ],
904
+ serviceTiers: {
905
+ flex: { inputPerMTok: 1, outputPerMTok: 6, tiers: openAiLongBand(2, 9) },
906
+ fast: { inputPerMTok: 4, outputPerMTok: 24, tiers: openAiLongBand(8, 36) },
907
+ },
629
908
  capability: 'mid',
630
909
  tier: 'sonnet',
631
910
  notes: OPENAI_CURRENT_NOTE,
@@ -639,7 +918,7 @@ export const MODELS = [
639
918
  contextWindow: 1_050_000,
640
919
  cacheMinTokens: 1024,
641
920
  caching: 'automatic',
642
- multipliers: { cacheRead: 0.1, cacheWrite5m: 1.25, cacheWrite1h: 1.25, batch: 0.5 },
921
+ multipliers: { cacheRead: 0.1, cacheWrite5m: 1.25, cacheWrite1h: 2.5, batch: 0.5 },
643
922
  cacheTtl: OPENAI_CACHE_TTL,
644
923
  tiers: [
645
924
  {
@@ -649,55 +928,588 @@ export const MODELS = [
649
928
  outputPerMTok: 1.8,
650
929
  },
651
930
  ],
931
+ serviceTiers: {
932
+ flex: { inputPerMTok: 0.1, outputPerMTok: 0.6, tiers: openAiLongBand(0.2, 0.9) },
933
+ fast: { inputPerMTok: 0.4, outputPerMTok: 2.4, tiers: openAiLongBand(0.8, 3.6) },
934
+ },
652
935
  capability: 'small',
653
936
  tier: 'haiku',
654
937
  notes: OPENAI_CURRENT_NOTE,
655
938
  },
939
+ {
940
+ /*
941
+ * The pricing page's "Cyber models" table and the model's own page
942
+ * (developers.openai.com/api/docs/models/gpt-5.6-cyber.md), read
943
+ * 2026-11-05: $12.50/$75, cached input $1.25, the 30-minute write $15.625
944
+ * and the 12-hour one $31.25, the same 0.1x, 1.25x and 2.5x as the rest of
945
+ * GPT-5.6. A 400,000-token context window with at most 272,000 input
946
+ * tokens, so the long-prompt band the model page mentions can never be
947
+ * reached and none is modelled; the pricing page lists none either. The
948
+ * Batch endpoint is "Not supported", so there is no batch price.
949
+ *
950
+ * Found by `scripts/price-drift.mjs` on its first run, as a model on the
951
+ * pricing page that read as unpriced. It needs Daybreak programme
952
+ * approval, so it is priced for the logs of people who have it and never
953
+ * recommended to anyone else.
954
+ */
955
+ id: 'gpt-5.6-cyber',
956
+ provider: 'openai',
957
+ displayName: 'GPT-5.6 Cyber',
958
+ recommendable: false,
959
+ inputPerMTok: 12.5,
960
+ outputPerMTok: 75,
961
+ contextWindow: 400_000,
962
+ cacheMinTokens: 1024,
963
+ caching: 'automatic',
964
+ multipliers: { cacheRead: 0.1, cacheWrite5m: 1.25, cacheWrite1h: 2.5, batch: null },
965
+ cacheTtl: OPENAI_CACHE_TTL,
966
+ capability: 'large',
967
+ tier: 'opus',
968
+ notes: 'Needs approval through the Daybreak programme. At most 272,000 input tokens, Responses API only, no batch.'
969
+ + ' Cache writes cost 1.25x input for the default 30-minute entry and 2.5x for a 12-hour one.',
970
+ },
656
971
  // ------------------------------------------------------------------------
972
+ // GPT-5, mini and nano. Each model page, read 2026-11-05, opens with
973
+ // "Status: Deprecated", and the catalogue still offered all three as
974
+ // cheaper alternatives, nano as the cheapest OpenAI model there is. Priced
975
+ // for the logs that hold them; never recommended.
657
976
  {
658
977
  id: 'gpt-5',
659
978
  aliases: ['gpt-5-2025-08-07'],
660
979
  provider: 'openai',
661
980
  displayName: 'GPT-5',
981
+ recommendable: false,
662
982
  inputPerMTok: 1.25,
663
983
  outputPerMTok: 10,
664
984
  contextWindow: 400_000,
665
985
  cacheMinTokens: 1024,
666
986
  caching: 'automatic',
667
987
  multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
988
+ serviceTiers: {
989
+ flex: { inputPerMTok: 0.625, outputPerMTok: 5 },
990
+ fast: { inputPerMTok: 2.5, outputPerMTok: 20 },
991
+ },
668
992
  capability: 'frontier',
669
993
  tier: 'frontier',
670
- notes: OPENAI_GPT5_NOTE,
994
+ notes: OPENAI_GPT5_NOTE + OPENAI_DEPRECATED_SUFFIX,
671
995
  },
672
996
  {
673
997
  id: 'gpt-5-mini',
674
998
  aliases: ['gpt-5-mini-2025-08-07'],
675
999
  provider: 'openai',
676
1000
  displayName: 'GPT-5 mini',
1001
+ recommendable: false,
677
1002
  inputPerMTok: 0.25,
678
1003
  outputPerMTok: 2,
679
1004
  contextWindow: 400_000,
680
1005
  cacheMinTokens: 1024,
681
1006
  caching: 'automatic',
682
1007
  multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
1008
+ serviceTiers: {
1009
+ flex: { inputPerMTok: 0.125, outputPerMTok: 1 },
1010
+ fast: { inputPerMTok: 0.45, outputPerMTok: 3.6 },
1011
+ },
683
1012
  capability: 'mid',
684
1013
  tier: 'sonnet',
685
- notes: OPENAI_GPT5_NOTE,
1014
+ notes: OPENAI_GPT5_NOTE + OPENAI_DEPRECATED_SUFFIX,
686
1015
  },
687
1016
  {
688
1017
  id: 'gpt-5-nano',
689
1018
  aliases: ['gpt-5-nano-2025-08-07'],
690
1019
  provider: 'openai',
691
1020
  displayName: 'GPT-5 nano',
1021
+ recommendable: false,
692
1022
  inputPerMTok: 0.05,
693
1023
  outputPerMTok: 0.4,
694
1024
  contextWindow: 400_000,
695
1025
  cacheMinTokens: 1024,
696
1026
  caching: 'automatic',
697
1027
  multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
1028
+ serviceTiers: {
1029
+ flex: { inputPerMTok: 0.025, outputPerMTok: 0.2 },
1030
+ },
698
1031
  capability: 'small',
699
1032
  tier: 'haiku',
700
- notes: OPENAI_GPT5_NOTE,
1033
+ notes: OPENAI_GPT5_NOTE + OPENAI_DEPRECATED_SUFFIX,
1034
+ },
1035
+ // ------------------------------------------------------------------------
1036
+ // OpenAI's earlier models, still billed and still in logs.
1037
+ //
1038
+ // developers.openai.com/api/docs/pricing.md (Standard and Batch tables) and
1039
+ // each model's own page (models/<id>.md), read 2026-11-05 in their Markdown
1040
+ // form. None was priced here, so every call to gpt-4o, gpt-4.1, o3 or a
1041
+ // GPT-5.x before 5.6 read as an unpriced model. Prices, cached-input prices
1042
+ // and context windows are each page's own; the dated snapshot ids are the
1043
+ // ones each page lists, except gpt-4o-2024-05-13, which is shut down and
1044
+ // priced differently from the current gpt-4o. A cached read costs what the
1045
+ // page says (10% of input on GPT-5.x, 25% on GPT-4.1 and o3, 50% on GPT-4o);
1046
+ // a write costs what input costs, as on GPT-5. The pro models publish no
1047
+ // cached price and are not cached. Models whose page says "Status:
1048
+ // Deprecated" are priced and never recommended. GPT-5.5, GPT-5.5 pro, GPT-5.4
1049
+ // and GPT-5.4 pro bill a prompt over 272K at 2x input and 1.5x output.
1050
+ // ------------------------------------------------------------------------
1051
+ {
1052
+ id: 'gpt-5.5',
1053
+ aliases: ['gpt-5.5-2026-04-23'],
1054
+ provider: 'openai',
1055
+ displayName: 'GPT-5.5',
1056
+ inputPerMTok: 5,
1057
+ outputPerMTok: 30,
1058
+ contextWindow: 1_050_000,
1059
+ cacheMinTokens: 1024,
1060
+ caching: 'automatic',
1061
+ multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
1062
+ tiers: [
1063
+ {
1064
+ id: 'over-272k',
1065
+ when: { kind: 'input-tokens-above', tokens: 272_000 },
1066
+ inputPerMTok: 10,
1067
+ outputPerMTok: 45,
1068
+ },
1069
+ ],
1070
+ serviceTiers: {
1071
+ flex: { inputPerMTok: 2.5, outputPerMTok: 15, tiers: openAiLongBand(5, 22.5) },
1072
+ fast: { inputPerMTok: 12.5, outputPerMTok: 75 },
1073
+ },
1074
+ capability: 'frontier',
1075
+ tier: 'frontier',
1076
+ notes: OPENAI_EARLIER_LONG_NOTE,
1077
+ },
1078
+ {
1079
+ id: 'gpt-5.5-pro',
1080
+ aliases: ['gpt-5.5-pro-2026-04-23'],
1081
+ provider: 'openai',
1082
+ displayName: 'GPT-5.5 pro',
1083
+ inputPerMTok: 30,
1084
+ outputPerMTok: 180,
1085
+ contextWindow: 1_050_000,
1086
+ cacheMinTokens: 0,
1087
+ caching: 'none',
1088
+ multipliers: { batch: 0.5 },
1089
+ tiers: [
1090
+ {
1091
+ id: 'over-272k',
1092
+ when: { kind: 'input-tokens-above', tokens: 272_000 },
1093
+ inputPerMTok: 60,
1094
+ outputPerMTok: 270,
1095
+ },
1096
+ ],
1097
+ serviceTiers: {
1098
+ flex: { inputPerMTok: 15, outputPerMTok: 90 },
1099
+ },
1100
+ capability: 'frontier',
1101
+ tier: 'frontier',
1102
+ notes: OPENAI_EARLIER_LONG_NOTE,
1103
+ },
1104
+ {
1105
+ id: 'gpt-5.4',
1106
+ aliases: ['gpt-5.4-2026-03-05'],
1107
+ provider: 'openai',
1108
+ displayName: 'GPT-5.4',
1109
+ inputPerMTok: 2.5,
1110
+ outputPerMTok: 15,
1111
+ contextWindow: 1_050_000,
1112
+ cacheMinTokens: 1024,
1113
+ caching: 'automatic',
1114
+ multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
1115
+ tiers: [
1116
+ {
1117
+ id: 'over-272k',
1118
+ when: { kind: 'input-tokens-above', tokens: 272_000 },
1119
+ inputPerMTok: 5,
1120
+ outputPerMTok: 22.5,
1121
+ },
1122
+ ],
1123
+ serviceTiers: {
1124
+ flex: { inputPerMTok: 1.25, outputPerMTok: 7.5, tiers: openAiLongBand(2.5, 11.25) },
1125
+ fast: { inputPerMTok: 5, outputPerMTok: 30 },
1126
+ },
1127
+ capability: 'frontier',
1128
+ tier: 'frontier',
1129
+ notes: OPENAI_EARLIER_LONG_NOTE,
1130
+ },
1131
+ {
1132
+ id: 'gpt-5.4-pro',
1133
+ aliases: ['gpt-5.4-pro-2026-03-05'],
1134
+ provider: 'openai',
1135
+ displayName: 'GPT-5.4 pro',
1136
+ inputPerMTok: 30,
1137
+ outputPerMTok: 180,
1138
+ contextWindow: 1_050_000,
1139
+ cacheMinTokens: 0,
1140
+ caching: 'none',
1141
+ multipliers: { batch: 0.5 },
1142
+ tiers: [
1143
+ {
1144
+ id: 'over-272k',
1145
+ when: { kind: 'input-tokens-above', tokens: 272_000 },
1146
+ inputPerMTok: 60,
1147
+ outputPerMTok: 270,
1148
+ },
1149
+ ],
1150
+ serviceTiers: {
1151
+ flex: { inputPerMTok: 15, outputPerMTok: 90, tiers: openAiLongBand(30, 135) },
1152
+ },
1153
+ capability: 'frontier',
1154
+ tier: 'frontier',
1155
+ notes: OPENAI_EARLIER_LONG_NOTE,
1156
+ },
1157
+ {
1158
+ id: 'gpt-5.4-mini',
1159
+ aliases: ['gpt-5.4-mini-2026-03-17'],
1160
+ provider: 'openai',
1161
+ displayName: 'GPT-5.4 mini',
1162
+ inputPerMTok: 0.75,
1163
+ outputPerMTok: 4.5,
1164
+ contextWindow: 400_000,
1165
+ cacheMinTokens: 1024,
1166
+ caching: 'automatic',
1167
+ multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
1168
+ serviceTiers: {
1169
+ flex: { inputPerMTok: 0.375, outputPerMTok: 2.25 },
1170
+ fast: { inputPerMTok: 1.5, outputPerMTok: 9 },
1171
+ },
1172
+ capability: 'mid',
1173
+ tier: 'sonnet',
1174
+ notes: OPENAI_EARLIER_NOTE,
1175
+ },
1176
+ {
1177
+ id: 'gpt-5.4-nano',
1178
+ aliases: ['gpt-5.4-nano-2026-03-17'],
1179
+ provider: 'openai',
1180
+ displayName: 'GPT-5.4 nano',
1181
+ recommendable: false,
1182
+ inputPerMTok: 0.2,
1183
+ outputPerMTok: 1.25,
1184
+ contextWindow: 400_000,
1185
+ cacheMinTokens: 1024,
1186
+ caching: 'automatic',
1187
+ multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
1188
+ serviceTiers: {
1189
+ flex: { inputPerMTok: 0.1, outputPerMTok: 0.625 },
1190
+ },
1191
+ capability: 'small',
1192
+ tier: 'haiku',
1193
+ notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
1194
+ },
1195
+ {
1196
+ id: 'gpt-5.2',
1197
+ aliases: ['gpt-5.2-2025-12-11'],
1198
+ provider: 'openai',
1199
+ displayName: 'GPT-5.2',
1200
+ inputPerMTok: 1.75,
1201
+ outputPerMTok: 14,
1202
+ contextWindow: 400_000,
1203
+ cacheMinTokens: 1024,
1204
+ caching: 'automatic',
1205
+ multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
1206
+ serviceTiers: {
1207
+ flex: { inputPerMTok: 0.875, outputPerMTok: 7 },
1208
+ fast: { inputPerMTok: 3.5, outputPerMTok: 28 },
1209
+ },
1210
+ capability: 'frontier',
1211
+ tier: 'frontier',
1212
+ notes: OPENAI_EARLIER_NOTE,
1213
+ },
1214
+ {
1215
+ id: 'gpt-5.2-pro',
1216
+ aliases: ['gpt-5.2-pro-2025-12-11'],
1217
+ provider: 'openai',
1218
+ displayName: 'GPT-5.2 pro',
1219
+ inputPerMTok: 21,
1220
+ outputPerMTok: 168,
1221
+ contextWindow: 400_000,
1222
+ cacheMinTokens: 0,
1223
+ caching: 'none',
1224
+ multipliers: { batch: 0.5 },
1225
+ capability: 'frontier',
1226
+ tier: 'frontier',
1227
+ notes: OPENAI_EARLIER_NO_CACHE_NOTE,
1228
+ },
1229
+ {
1230
+ id: 'gpt-5.1',
1231
+ aliases: ['gpt-5.1-2025-11-13'],
1232
+ provider: 'openai',
1233
+ displayName: 'GPT-5.1',
1234
+ recommendable: false,
1235
+ inputPerMTok: 1.25,
1236
+ outputPerMTok: 10,
1237
+ contextWindow: 400_000,
1238
+ cacheMinTokens: 1024,
1239
+ caching: 'automatic',
1240
+ multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
1241
+ serviceTiers: {
1242
+ flex: { inputPerMTok: 0.625, outputPerMTok: 5 },
1243
+ fast: { inputPerMTok: 2.5, outputPerMTok: 20 },
1244
+ },
1245
+ capability: 'frontier',
1246
+ tier: 'frontier',
1247
+ notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
1248
+ },
1249
+ {
1250
+ id: 'gpt-5-pro',
1251
+ aliases: ['gpt-5-pro-2025-10-06'],
1252
+ provider: 'openai',
1253
+ displayName: 'GPT-5 pro',
1254
+ recommendable: false,
1255
+ inputPerMTok: 15,
1256
+ outputPerMTok: 120,
1257
+ contextWindow: 400_000,
1258
+ cacheMinTokens: 0,
1259
+ caching: 'none',
1260
+ multipliers: { batch: 0.5 },
1261
+ capability: 'frontier',
1262
+ tier: 'frontier',
1263
+ notes: OPENAI_EARLIER_NO_CACHE_NOTE + OPENAI_DEPRECATED_SUFFIX,
1264
+ },
1265
+ {
1266
+ id: 'gpt-4.1',
1267
+ aliases: ['gpt-4.1-2025-04-14'],
1268
+ provider: 'openai',
1269
+ displayName: 'GPT-4.1',
1270
+ recommendable: false,
1271
+ inputPerMTok: 2,
1272
+ outputPerMTok: 8,
1273
+ contextWindow: 1_047_576,
1274
+ cacheMinTokens: 1024,
1275
+ caching: 'automatic',
1276
+ multipliers: { cacheRead: 0.25, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
1277
+ serviceTiers: {
1278
+ fast: { inputPerMTok: 3.5, outputPerMTok: 14 },
1279
+ },
1280
+ capability: 'large',
1281
+ tier: 'opus',
1282
+ notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
1283
+ },
1284
+ {
1285
+ id: 'gpt-4.1-mini',
1286
+ aliases: ['gpt-4.1-mini-2025-04-14'],
1287
+ provider: 'openai',
1288
+ displayName: 'GPT-4.1 mini',
1289
+ recommendable: false,
1290
+ inputPerMTok: 0.4,
1291
+ outputPerMTok: 1.6,
1292
+ contextWindow: 1_047_576,
1293
+ cacheMinTokens: 1024,
1294
+ caching: 'automatic',
1295
+ multipliers: { cacheRead: 0.25, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
1296
+ serviceTiers: {
1297
+ fast: { inputPerMTok: 0.7, outputPerMTok: 2.8 },
1298
+ },
1299
+ capability: 'mid',
1300
+ tier: 'sonnet',
1301
+ notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
1302
+ },
1303
+ {
1304
+ id: 'gpt-4o',
1305
+ aliases: ['gpt-4o-2024-11-20', 'gpt-4o-2024-08-06'],
1306
+ provider: 'openai',
1307
+ displayName: 'GPT-4o',
1308
+ recommendable: false,
1309
+ inputPerMTok: 2.5,
1310
+ outputPerMTok: 10,
1311
+ contextWindow: 128_000,
1312
+ cacheMinTokens: 1024,
1313
+ caching: 'automatic',
1314
+ multipliers: { cacheRead: 0.5, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
1315
+ serviceTiers: {
1316
+ fast: { inputPerMTok: 4.25, outputPerMTok: 17 },
1317
+ },
1318
+ capability: 'large',
1319
+ tier: 'opus',
1320
+ notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
1321
+ },
1322
+ {
1323
+ id: 'gpt-4o-mini',
1324
+ aliases: ['gpt-4o-mini-2024-07-18'],
1325
+ provider: 'openai',
1326
+ displayName: 'GPT-4o mini',
1327
+ recommendable: false,
1328
+ inputPerMTok: 0.15,
1329
+ outputPerMTok: 0.6,
1330
+ contextWindow: 128_000,
1331
+ cacheMinTokens: 1024,
1332
+ caching: 'automatic',
1333
+ multipliers: { cacheRead: 0.5, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
1334
+ serviceTiers: {
1335
+ fast: { inputPerMTok: 0.25, outputPerMTok: 1 },
1336
+ },
1337
+ capability: 'small',
1338
+ tier: 'haiku',
1339
+ notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
1340
+ },
1341
+ {
1342
+ id: 'o3',
1343
+ aliases: ['o3-2025-04-16'],
1344
+ provider: 'openai',
1345
+ displayName: 'o3',
1346
+ recommendable: false,
1347
+ inputPerMTok: 2,
1348
+ outputPerMTok: 8,
1349
+ contextWindow: 200_000,
1350
+ cacheMinTokens: 1024,
1351
+ caching: 'automatic',
1352
+ multipliers: { cacheRead: 0.25, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
1353
+ serviceTiers: {
1354
+ flex: { inputPerMTok: 1, outputPerMTok: 4 },
1355
+ fast: { inputPerMTok: 3.5, outputPerMTok: 14 },
1356
+ },
1357
+ capability: 'frontier',
1358
+ tier: 'frontier',
1359
+ notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
1360
+ },
1361
+ {
1362
+ id: 'o3-pro',
1363
+ aliases: ['o3-pro-2025-06-10'],
1364
+ provider: 'openai',
1365
+ displayName: 'o3-pro',
1366
+ recommendable: false,
1367
+ inputPerMTok: 20,
1368
+ outputPerMTok: 80,
1369
+ contextWindow: 200_000,
1370
+ cacheMinTokens: 0,
1371
+ caching: 'none',
1372
+ multipliers: { batch: 0.5 },
1373
+ capability: 'frontier',
1374
+ tier: 'frontier',
1375
+ notes: OPENAI_EARLIER_NO_CACHE_NOTE + OPENAI_DEPRECATED_SUFFIX,
1376
+ },
1377
+ // ------------------------------------------------------------------------
1378
+ // The Codex models and chat-latest. Codex CLI sessions name these, and none
1379
+ // was priced, so every such call read as unpriced. Each from its own model
1380
+ // page (developers.openai.com/api/docs/models/<id>.md), read 2026-11-05,
1381
+ // and gpt-5.3-codex and chat-latest also from the pricing page's
1382
+ // "Specialized models" table. Every page says Batch is "Not supported", so
1383
+ // none has a batch price. gpt-5.3-codex is deprecated and the rest of the
1384
+ // Codex line is shut down; all are priced for the logs that hold them and
1385
+ // never recommended. chat-latest is served and not recommended either: it
1386
+ // points at whatever model ChatGPT uses, so a recommendation would not name
1387
+ // a fixed model. Cache reads are 0.1x everywhere but codex-mini-latest,
1388
+ // whose page gives $0.375 on $1.50, 0.25x. gpt-5-search-api is on the
1389
+ // pricing page too and its model page returns 404, so it has no context
1390
+ // window and is left unpriced (see scripts/price-drift.mjs).
1391
+ // ------------------------------------------------------------------------
1392
+ {
1393
+ id: 'gpt-5.3-codex',
1394
+ provider: 'openai',
1395
+ displayName: 'GPT-5.3-Codex',
1396
+ recommendable: false,
1397
+ inputPerMTok: 1.75,
1398
+ outputPerMTok: 14,
1399
+ contextWindow: 400_000,
1400
+ cacheMinTokens: 1024,
1401
+ caching: 'automatic',
1402
+ multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
1403
+ // The pricing page's specialized "Fast" table: $3.50/$28, cached $0.35.
1404
+ serviceTiers: { fast: { inputPerMTok: 3.5, outputPerMTok: 28 } },
1405
+ capability: 'frontier',
1406
+ tier: 'frontier',
1407
+ notes: OPENAI_CODEX_NOTE + ' At most 272,000 input tokens.' + OPENAI_DEPRECATED_SUFFIX,
1408
+ },
1409
+ {
1410
+ id: 'gpt-5.2-codex',
1411
+ provider: 'openai',
1412
+ displayName: 'GPT-5.2-Codex',
1413
+ recommendable: false,
1414
+ inputPerMTok: 1.75,
1415
+ outputPerMTok: 14,
1416
+ contextWindow: 400_000,
1417
+ cacheMinTokens: 1024,
1418
+ caching: 'automatic',
1419
+ multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
1420
+ capability: 'frontier',
1421
+ tier: 'frontier',
1422
+ notes: OPENAI_CODEX_NOTE + ' At most 272,000 input tokens.' + OPENAI_SHUT_DOWN_SUFFIX,
1423
+ },
1424
+ {
1425
+ id: 'gpt-5.1-codex',
1426
+ provider: 'openai',
1427
+ displayName: 'GPT-5.1-Codex',
1428
+ recommendable: false,
1429
+ inputPerMTok: 1.25,
1430
+ outputPerMTok: 10,
1431
+ contextWindow: 400_000,
1432
+ cacheMinTokens: 1024,
1433
+ caching: 'automatic',
1434
+ multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
1435
+ capability: 'frontier',
1436
+ tier: 'frontier',
1437
+ notes: OPENAI_CODEX_NOTE + OPENAI_SHUT_DOWN_SUFFIX,
1438
+ },
1439
+ {
1440
+ id: 'gpt-5.1-codex-max',
1441
+ provider: 'openai',
1442
+ displayName: 'GPT-5.1-Codex-Max',
1443
+ recommendable: false,
1444
+ inputPerMTok: 1.25,
1445
+ outputPerMTok: 10,
1446
+ contextWindow: 400_000,
1447
+ cacheMinTokens: 1024,
1448
+ caching: 'automatic',
1449
+ multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
1450
+ capability: 'frontier',
1451
+ tier: 'frontier',
1452
+ notes: OPENAI_CODEX_NOTE + OPENAI_SHUT_DOWN_SUFFIX,
1453
+ },
1454
+ {
1455
+ id: 'gpt-5.1-codex-mini',
1456
+ provider: 'openai',
1457
+ displayName: 'GPT-5.1-Codex Mini',
1458
+ recommendable: false,
1459
+ inputPerMTok: 0.25,
1460
+ outputPerMTok: 2,
1461
+ contextWindow: 400_000,
1462
+ cacheMinTokens: 1024,
1463
+ caching: 'automatic',
1464
+ multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
1465
+ capability: 'mid',
1466
+ tier: 'sonnet',
1467
+ notes: OPENAI_CODEX_NOTE + OPENAI_SHUT_DOWN_SUFFIX,
1468
+ },
1469
+ {
1470
+ id: 'gpt-5-codex',
1471
+ provider: 'openai',
1472
+ displayName: 'GPT-5-Codex',
1473
+ recommendable: false,
1474
+ inputPerMTok: 1.25,
1475
+ outputPerMTok: 10,
1476
+ contextWindow: 400_000,
1477
+ cacheMinTokens: 1024,
1478
+ caching: 'automatic',
1479
+ multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
1480
+ capability: 'frontier',
1481
+ tier: 'frontier',
1482
+ notes: OPENAI_CODEX_NOTE + ' At most 272,000 input tokens.' + OPENAI_SHUT_DOWN_SUFFIX,
1483
+ },
1484
+ {
1485
+ id: 'codex-mini-latest',
1486
+ provider: 'openai',
1487
+ displayName: 'codex-mini-latest',
1488
+ recommendable: false,
1489
+ inputPerMTok: 1.5,
1490
+ outputPerMTok: 6,
1491
+ contextWindow: 200_000,
1492
+ cacheMinTokens: 1024,
1493
+ caching: 'automatic',
1494
+ multipliers: { cacheRead: 0.25, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
1495
+ capability: 'mid',
1496
+ tier: 'sonnet',
1497
+ notes: OPENAI_CODEX_NOTE + ' A cache read costs 0.25x input.' + OPENAI_SHUT_DOWN_SUFFIX,
1498
+ },
1499
+ {
1500
+ id: 'chat-latest',
1501
+ provider: 'openai',
1502
+ displayName: 'Chat Latest',
1503
+ recommendable: false,
1504
+ inputPerMTok: 5,
1505
+ outputPerMTok: 30,
1506
+ contextWindow: 400_000,
1507
+ cacheMinTokens: 1024,
1508
+ caching: 'automatic',
1509
+ multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
1510
+ capability: 'large',
1511
+ tier: 'opus',
1512
+ 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.',
701
1513
  },
702
1514
  // ------------------------------------------------------------------------
703
1515
  // Google
@@ -849,7 +1661,53 @@ export const MODELS = [
849
1661
  * $0.30. The K2 series bills no write, and reads at its own hit price. Batch
850
1662
  * is 60% of standard on K2.7 Code and K2.6 and not offered on K3 or the
851
1663
  * high-speed K2.7. No cache minimum is published for any of them.
1664
+ *
1665
+ * Re-read 2026-11-05. The Markdown form now ships the price tables empty
1666
+ * (`<tbody />`); the figures are in the HTML page's compiled table rows,
1667
+ * read there. Every existing price matched. Three changes: Kimi K3.1 Pro
1668
+ * and its high-speed variant are new; the batch page now lists K3 and K3.1
1669
+ * Pro at 60% ("billed at 60% of the standard price"), so K3 has a batch
1670
+ * price; and the K2 series is closed to accounts registered from 2026-11-01
1671
+ * and retires "by the end of December 2026", so it is no longer recommended.
852
1672
  */
1673
+ {
1674
+ /*
1675
+ * $2/$10, cached input $0.20, cache writes $2.00 for 5 minutes and $4.00
1676
+ * for an hour; batch 60%; 1,048,576 context, as every K3-series model.
1677
+ */
1678
+ id: 'kimi-k3.1-pro',
1679
+ provider: 'moonshot',
1680
+ displayName: 'Kimi K3.1 Pro',
1681
+ inputPerMTok: 2,
1682
+ outputPerMTok: 10,
1683
+ contextWindow: 1_048_576,
1684
+ cacheMinTokens: null,
1685
+ caching: 'automatic',
1686
+ multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 2, batch: 0.6 },
1687
+ capability: 'frontier',
1688
+ tier: 'frontier',
1689
+ notes: 'Cache writes are billed as their own line: 1x input for a 5-minute entry, 2x for an hour.'
1690
+ + ` ${NO_PUBLISHED_CACHE_MINIMUM}`,
1691
+ },
1692
+ {
1693
+ /*
1694
+ * $4/$20, cached input $0.20 (5% of its input), writes $4.00 and $8.00.
1695
+ * Not on the batch page's list, so no batch price.
1696
+ */
1697
+ id: 'kimi-k3.1-pro-highspeed',
1698
+ provider: 'moonshot',
1699
+ displayName: 'Kimi K3.1 Pro (high speed)',
1700
+ inputPerMTok: 4,
1701
+ outputPerMTok: 20,
1702
+ contextWindow: 1_048_576,
1703
+ cacheMinTokens: null,
1704
+ caching: 'automatic',
1705
+ multipliers: { cacheRead: 0.05, cacheWrite5m: 1, cacheWrite1h: 2, batch: null },
1706
+ capability: 'frontier',
1707
+ tier: 'frontier',
1708
+ notes: 'Cache writes are billed as their own line: 1x input for a 5-minute entry, 2x for an hour.'
1709
+ + ` No batch API for this model. ${NO_PUBLISHED_CACHE_MINIMUM}`,
1710
+ },
853
1711
  {
854
1712
  id: 'kimi-k3',
855
1713
  provider: 'moonshot',
@@ -859,16 +1717,18 @@ export const MODELS = [
859
1717
  contextWindow: 1_048_576,
860
1718
  cacheMinTokens: null,
861
1719
  caching: 'automatic',
862
- multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 2, batch: null },
1720
+ multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 2, batch: 0.6 },
863
1721
  capability: 'frontier',
864
1722
  tier: 'frontier',
865
1723
  notes: 'Cache writes are billed as their own line: 1x input for a 5-minute entry, 2x for an hour.'
866
- + ` No batch API for this model. ${NO_PUBLISHED_CACHE_MINIMUM}`,
1724
+ + ` Batch at 60% since the batch page listed it (read 2026-11-05). ${NO_PUBLISHED_CACHE_MINIMUM}`,
867
1725
  },
868
1726
  {
869
1727
  id: 'kimi-k2.7-code',
870
1728
  provider: 'moonshot',
871
1729
  displayName: 'Kimi K2.7 Code',
1730
+ // Closed to accounts registered from 2026-11-01; the K2 series retires by the end of December 2026.
1731
+ recommendable: false,
872
1732
  inputPerMTok: 0.95,
873
1733
  outputPerMTok: 4,
874
1734
  contextWindow: 262_144,
@@ -884,6 +1744,8 @@ export const MODELS = [
884
1744
  id: 'kimi-k2.7-code-highspeed',
885
1745
  provider: 'moonshot',
886
1746
  displayName: 'Kimi K2.7 Code (high speed)',
1747
+ // Closed to accounts registered from 2026-11-01; the K2 series retires by the end of December 2026.
1748
+ recommendable: false,
887
1749
  inputPerMTok: 1.9,
888
1750
  outputPerMTok: 8,
889
1751
  contextWindow: 262_144,
@@ -899,6 +1761,8 @@ export const MODELS = [
899
1761
  id: 'kimi-k2.6',
900
1762
  provider: 'moonshot',
901
1763
  displayName: 'Kimi K2.6',
1764
+ // Closed to accounts registered from 2026-11-01; the K2 series retires by the end of December 2026.
1765
+ recommendable: false,
902
1766
  inputPerMTok: 0.95,
903
1767
  outputPerMTok: 4,
904
1768
  contextWindow: 262_144,
@@ -1428,6 +2292,57 @@ export function getModel(id) {
1428
2292
  export function listModels() {
1429
2293
  return [...MODELS];
1430
2294
  }
2295
+ /**
2296
+ * A response's `service_tier` as the tier whose table prices it, or
2297
+ * `undefined` for the standard one.
2298
+ *
2299
+ * OpenAI renamed Priority processing to Fast mode on 2026-07-30, and its guide
2300
+ * says "for GPT-5.6 and earlier models, the response returns `priority`
2301
+ * whether the request specifies `priority` or `fast`", so both spellings are
2302
+ * the Fast table. `"default"` is the standard tier, and is also what a Fast
2303
+ * request downgraded under the ramp-rate limit returns, "and charge standard
2304
+ * rates". `"auto"` and `"scale"`, or a value this table has never seen, are
2305
+ * priced at the standard rate rather than guessed into another tier.
2306
+ */
2307
+ export function serviceTierOf(value) {
2308
+ if (typeof value !== 'string')
2309
+ return undefined;
2310
+ const tier = value.trim().toLowerCase();
2311
+ if (tier === 'flex')
2312
+ return 'flex';
2313
+ if (tier === 'fast' || tier === 'priority')
2314
+ return 'fast';
2315
+ if (tier === 'ultrafast')
2316
+ return 'ultrafast';
2317
+ return undefined;
2318
+ }
2319
+ /**
2320
+ * The row as one service tier prices it: that tier's rates and long band, the
2321
+ * row's own cache and batch ratios. Built once per row and tier.
2322
+ */
2323
+ const serviceTierMemo = new WeakMap();
2324
+ function serviceTierRow(model, tier) {
2325
+ const sheet = model.serviceTiers?.[tier];
2326
+ if (sheet === undefined)
2327
+ return undefined;
2328
+ let rows = serviceTierMemo.get(model);
2329
+ if (rows === undefined) {
2330
+ rows = new Map();
2331
+ serviceTierMemo.set(model, rows);
2332
+ }
2333
+ let row = rows.get(tier);
2334
+ if (row === undefined) {
2335
+ const { history: _history, promo: _promo, tiers: _tiers, serviceTiers: _serviceTiers, ...rest } = model;
2336
+ row = Object.freeze({
2337
+ ...rest,
2338
+ inputPerMTok: sheet.inputPerMTok,
2339
+ outputPerMTok: sheet.outputPerMTok,
2340
+ ...(sheet.tiers !== undefined ? { tiers: sheet.tiers } : {}),
2341
+ });
2342
+ rows.set(tier, row);
2343
+ }
2344
+ return row;
2345
+ }
1431
2346
  const pricingMemo = new WeakMap();
1432
2347
  /**
1433
2348
  * The row as it stood at `on`: itself when the current price applies, or a
@@ -1442,7 +2357,8 @@ function pricedAt(model, on) {
1442
2357
  let periods = periodMemo.get(model);
1443
2358
  if (periods === undefined) {
1444
2359
  periods = history.map((period) => {
1445
- const { history: _history, promo: _promo, tiers: _tiers, multipliers: _multipliers, ...rest } = model;
2360
+ // A period's own price only: the service tiers below are today's tables.
2361
+ const { history: _history, promo: _promo, tiers: _tiers, multipliers: _multipliers, serviceTiers: _serviceTiers, ...rest } = model;
1446
2362
  const row = Object.freeze({
1447
2363
  ...rest,
1448
2364
  inputPerMTok: period.inputPerMTok,
@@ -1494,6 +2410,9 @@ function cache(model) {
1494
2410
  * collapsing them is the oldest mistake in this repository.
1495
2411
  */
1496
2412
  function holds(when, on, size) {
2413
+ // Decided either way: a log that does not record a speed never asked for fast mode.
2414
+ if (when.kind === 'speed')
2415
+ return (size.speed ?? 'standard') === when.speed;
1497
2416
  if (when.kind === 'utc-hours') {
1498
2417
  const day = on.getUTCDay();
1499
2418
  if (when.weekdaysOnly && (day === 0 || day === 6))
@@ -1531,6 +2450,18 @@ export function effectivePricing(model, on = new Date(), context = {}) {
1531
2450
  if (period !== model)
1532
2451
  return effectivePricing(period, on, context);
1533
2452
  }
2453
+ /*
2454
+ * A response that names another service tier is priced by that tier's own
2455
+ * table, long band included, and by nothing composed out of two.
2456
+ */
2457
+ if (context.serviceTier !== undefined && model.serviceTiers !== undefined) {
2458
+ const named = serviceTierOf(context.serviceTier);
2459
+ const row = named === undefined ? undefined : serviceTierRow(model, named);
2460
+ if (row !== undefined) {
2461
+ const { serviceTier: _serviceTier, ...size } = context;
2462
+ return { ...effectivePricing(row, on, size), serviceTier: named };
2463
+ }
2464
+ }
1534
2465
  const memo = pricingMemo.get(model) ?? cache(model);
1535
2466
  /**
1536
2467
  * Tiers first, and a promotion never runs on top of one.
@@ -1599,6 +2530,8 @@ export function effectivePricing(model, on = new Date(), context = {}) {
1599
2530
  }
1600
2531
  /** One condition as a sentence a reader can check against a provider's page. */
1601
2532
  function describe(when) {
2533
+ if (when.kind === 'speed')
2534
+ return `${when.speed} mode (the response's usage.speed is "${when.speed}")`;
1602
2535
  if (when.kind === 'input-tokens-above') {
1603
2536
  return `prompts over ${when.tokens.toLocaleString('en-US')} input tokens`;
1604
2537
  }