@trazum/core 2.7.1 → 2.7.3
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/anthropic-usage.d.ts +58 -0
- package/dist/anthropic-usage.d.ts.map +1 -1
- package/dist/anthropic-usage.js +91 -0
- package/dist/anthropic-usage.js.map +1 -1
- package/dist/billing.d.ts.map +1 -1
- package/dist/billing.js +6 -2
- package/dist/billing.js.map +1 -1
- package/dist/claude-code.d.ts +2 -0
- package/dist/claude-code.d.ts.map +1 -1
- package/dist/claude-code.js +9 -0
- package/dist/claude-code.js.map +1 -1
- package/dist/connector.d.ts +3 -1
- package/dist/connector.d.ts.map +1 -1
- package/dist/connector.js +64 -5
- package/dist/connector.js.map +1 -1
- package/dist/gateway.d.ts +18 -0
- package/dist/gateway.d.ts.map +1 -1
- package/dist/gateway.js +20 -1
- package/dist/gateway.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/openai-usage.d.ts +38 -6
- package/dist/openai-usage.d.ts.map +1 -1
- package/dist/openai-usage.js +44 -8
- package/dist/openai-usage.js.map +1 -1
- package/dist/pricing-overlay.d.ts +1 -1
- package/dist/pricing-overlay.d.ts.map +1 -1
- package/dist/pricing-overlay.js +21 -0
- package/dist/pricing-overlay.js.map +1 -1
- package/dist/pricing.d.ts +37 -1
- package/dist/pricing.d.ts.map +1 -1
- package/dist/pricing.js +528 -9
- package/dist/pricing.js.map +1 -1
- package/dist/store.d.ts +4 -0
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +22 -1
- package/dist/store.js.map +1 -1
- package/dist/types.d.ts +54 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/usage.d.ts +16 -0
- package/dist/usage.d.ts.map +1 -1
- package/dist/usage.js +17 -0
- package/dist/usage.js.map +1 -1
- package/package.json +1 -1
- package/src/anthropic-usage.ts +134 -1
- package/src/billing.ts +6 -2
- package/src/claude-code.ts +11 -0
- package/src/connector.ts +69 -6
- package/src/gateway.ts +35 -2
- package/src/index.ts +2 -0
- package/src/openai-usage.ts +72 -10
- package/src/pricing-overlay.ts +21 -0
- package/src/pricing.ts +552 -10
- package/src/store.ts +24 -3
- package/src/types.ts +57 -0
- package/src/usage.ts +33 -0
package/dist/pricing.js
CHANGED
|
@@ -39,10 +39,12 @@ export const PROVIDER_REVIEWED = Object.freeze({
|
|
|
39
39
|
* which bills Opus 5.5 at $8/$40 and Opus 5 and 4.8 at $10/$50 and which
|
|
40
40
|
* every response records in `usage.speed`, so fast calls had been priced at
|
|
41
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.
|
|
43
|
-
* 4.1, Opus 4, Sonnet 4 and Haiku 3.5
|
|
44
|
-
*
|
|
45
|
-
*
|
|
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.
|
|
46
48
|
*/
|
|
47
49
|
anthropic: '2026-11-05',
|
|
48
50
|
/*
|
|
@@ -248,6 +250,17 @@ const NO_PUBLISHED_CACHE_MINIMUM = 'Caches automatically, but no minimum prefix
|
|
|
248
250
|
* catalogue's short and long write, whatever each provider's durations.
|
|
249
251
|
*/
|
|
250
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
|
+
];
|
|
251
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'
|
|
252
265
|
+ ' the whole request. Cache writes cost 1.25x input for the default 30-minute entry and 2.5x for a'
|
|
253
266
|
+ ' 12-hour one (Responses API).';
|
|
@@ -257,11 +270,26 @@ const OPENAI_EARLIER_LONG_NOTE = 'Priced per request by prompt length: over 272,
|
|
|
257
270
|
+ OPENAI_EARLIER_NOTE;
|
|
258
271
|
const OPENAI_EARLIER_NO_CACHE_NOTE = 'OpenAI publishes no cached-input price for this model, so caching is not priced.';
|
|
259
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.';
|
|
260
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'
|
|
261
277
|
+ ' request settings, so 1,024 here is the nearest published floor. The 2025-08-07 snapshot shuts down on'
|
|
262
278
|
+ ' 2026-12-11; OpenAI names the gpt-5.6 models as replacements.';
|
|
263
279
|
const MISTRAL_CACHE_NOTE = 'Cached input costs 10% of the input price (mistral.ai/cloud/inference, read 2026-10-11). How caching starts and'
|
|
264
280
|
+ ' its minimum are not published anywhere Trazum can read, so no caching advice is given for it.';
|
|
281
|
+
/**
|
|
282
|
+
* US-only inference on Claude 4.6 and later.
|
|
283
|
+
*
|
|
284
|
+
* platform.claude.com/docs/en/about-claude/pricing, "Data residency pricing",
|
|
285
|
+
* read 2026-11-05: "For Claude 4.6 and later models, specifying US-only
|
|
286
|
+
* inference through the `inference_geo` parameter incurs a 1.1x multiplier on
|
|
287
|
+
* all token pricing categories, including input tokens, output tokens, cache
|
|
288
|
+
* writes, and cache reads." It stacks with fast mode and the Batch API
|
|
289
|
+
* discount, the same page says. Earlier models reject the parameter, so
|
|
290
|
+
* they carry no multiplier. `price-drift.mjs` reads the sentence weekly.
|
|
291
|
+
*/
|
|
292
|
+
const US_ONLY_INFERENCE = Object.freeze({ us: 1.1 });
|
|
265
293
|
export const MODELS = [
|
|
266
294
|
{
|
|
267
295
|
/*
|
|
@@ -273,6 +301,7 @@ export const MODELS = [
|
|
|
273
301
|
*/
|
|
274
302
|
id: 'claude-fable-5-1',
|
|
275
303
|
provider: 'anthropic',
|
|
304
|
+
inferenceGeoMultipliers: US_ONLY_INFERENCE,
|
|
276
305
|
displayName: 'Claude Fable 5.1',
|
|
277
306
|
inputPerMTok: 10,
|
|
278
307
|
outputPerMTok: 50,
|
|
@@ -291,6 +320,7 @@ export const MODELS = [
|
|
|
291
320
|
*/
|
|
292
321
|
id: 'claude-mythos-5-1',
|
|
293
322
|
provider: 'anthropic',
|
|
323
|
+
inferenceGeoMultipliers: US_ONLY_INFERENCE,
|
|
294
324
|
displayName: 'Claude Mythos 5.1',
|
|
295
325
|
recommendable: false,
|
|
296
326
|
inputPerMTok: 10,
|
|
@@ -306,6 +336,7 @@ export const MODELS = [
|
|
|
306
336
|
{
|
|
307
337
|
id: 'claude-fable-5',
|
|
308
338
|
provider: 'anthropic',
|
|
339
|
+
inferenceGeoMultipliers: US_ONLY_INFERENCE,
|
|
309
340
|
displayName: 'Claude Fable 5',
|
|
310
341
|
inputPerMTok: 10,
|
|
311
342
|
outputPerMTok: 50,
|
|
@@ -318,6 +349,7 @@ export const MODELS = [
|
|
|
318
349
|
{
|
|
319
350
|
id: 'claude-mythos-5',
|
|
320
351
|
provider: 'anthropic',
|
|
352
|
+
inferenceGeoMultipliers: US_ONLY_INFERENCE,
|
|
321
353
|
displayName: 'Claude Mythos 5',
|
|
322
354
|
recommendable: false,
|
|
323
355
|
inputPerMTok: 10,
|
|
@@ -338,6 +370,7 @@ export const MODELS = [
|
|
|
338
370
|
*/
|
|
339
371
|
id: 'claude-opus-5-5',
|
|
340
372
|
provider: 'anthropic',
|
|
373
|
+
inferenceGeoMultipliers: US_ONLY_INFERENCE,
|
|
341
374
|
displayName: 'Claude Opus 5.5',
|
|
342
375
|
inputPerMTok: 4,
|
|
343
376
|
outputPerMTok: 20,
|
|
@@ -360,6 +393,7 @@ export const MODELS = [
|
|
|
360
393
|
{
|
|
361
394
|
id: 'claude-opus-5',
|
|
362
395
|
provider: 'anthropic',
|
|
396
|
+
inferenceGeoMultipliers: US_ONLY_INFERENCE,
|
|
363
397
|
displayName: 'Claude Opus 5',
|
|
364
398
|
inputPerMTok: 5,
|
|
365
399
|
outputPerMTok: 25,
|
|
@@ -374,6 +408,7 @@ export const MODELS = [
|
|
|
374
408
|
{
|
|
375
409
|
id: 'claude-opus-4-8',
|
|
376
410
|
provider: 'anthropic',
|
|
411
|
+
inferenceGeoMultipliers: US_ONLY_INFERENCE,
|
|
377
412
|
displayName: 'Claude Opus 4.8',
|
|
378
413
|
inputPerMTok: 5,
|
|
379
414
|
outputPerMTok: 25,
|
|
@@ -392,6 +427,7 @@ export const MODELS = [
|
|
|
392
427
|
{
|
|
393
428
|
id: 'claude-opus-4-7',
|
|
394
429
|
provider: 'anthropic',
|
|
430
|
+
inferenceGeoMultipliers: US_ONLY_INFERENCE,
|
|
395
431
|
displayName: 'Claude Opus 4.7',
|
|
396
432
|
inputPerMTok: 5,
|
|
397
433
|
outputPerMTok: 25,
|
|
@@ -403,6 +439,7 @@ export const MODELS = [
|
|
|
403
439
|
{
|
|
404
440
|
id: 'claude-opus-4-6',
|
|
405
441
|
provider: 'anthropic',
|
|
442
|
+
inferenceGeoMultipliers: US_ONLY_INFERENCE,
|
|
406
443
|
displayName: 'Claude Opus 4.6',
|
|
407
444
|
inputPerMTok: 5,
|
|
408
445
|
outputPerMTok: 25,
|
|
@@ -432,6 +469,51 @@ export const MODELS = [
|
|
|
432
469
|
tier: 'opus',
|
|
433
470
|
notes: '200K context window and a 64K output cap.',
|
|
434
471
|
},
|
|
472
|
+
{
|
|
473
|
+
/*
|
|
474
|
+
* Retired on the Claude API on 2026-08-05 (the deprecations page, read
|
|
475
|
+
* 2026-11-05) and still served on Claude Models on Google Cloud (Google
|
|
476
|
+
* managed) and on Bedrock. Priced because a year of logs carries it and,
|
|
477
|
+
* unpriced, every one of those calls read as a gap. The pricing page, read
|
|
478
|
+
* the same day: $15/$75, writes $18.75 and $30, cache hits $1.50, batch
|
|
479
|
+
* $7.50/$37.50, which are the default multipliers. Its model page is gone;
|
|
480
|
+
* the context-windows page gives every Claude model outside its 1M list a
|
|
481
|
+
* 200k window, and the prompt-caching page a 1,024-token cache minimum.
|
|
482
|
+
* The dated id is the one the deprecations page names and what a log
|
|
483
|
+
* carries; no shorter alias is on any page read, so none is declared.
|
|
484
|
+
*/
|
|
485
|
+
id: 'claude-opus-4-1-20250805',
|
|
486
|
+
provider: 'anthropic',
|
|
487
|
+
displayName: 'Claude Opus 4.1',
|
|
488
|
+
recommendable: false,
|
|
489
|
+
inputPerMTok: 15,
|
|
490
|
+
outputPerMTok: 75,
|
|
491
|
+
contextWindow: 200_000,
|
|
492
|
+
cacheMinTokens: 1024,
|
|
493
|
+
capability: 'large',
|
|
494
|
+
tier: 'opus',
|
|
495
|
+
notes: 'Retired on the Claude API on 2026-08-05; still served on Google Cloud (Google managed) and Bedrock.'
|
|
496
|
+
+ ' Anthropic names Claude Opus 4.8 as the replacement.',
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
/*
|
|
500
|
+
* Retired on the Claude API on 2026-06-15; still served on Claude Models
|
|
501
|
+
* on Google Cloud (Google managed). The same pages and the same figures as
|
|
502
|
+
* Opus 4.1 above: $15/$75, 200k context, a 1,024-token cache minimum.
|
|
503
|
+
*/
|
|
504
|
+
id: 'claude-opus-4-20250514',
|
|
505
|
+
provider: 'anthropic',
|
|
506
|
+
displayName: 'Claude Opus 4',
|
|
507
|
+
recommendable: false,
|
|
508
|
+
inputPerMTok: 15,
|
|
509
|
+
outputPerMTok: 75,
|
|
510
|
+
contextWindow: 200_000,
|
|
511
|
+
cacheMinTokens: 1024,
|
|
512
|
+
capability: 'large',
|
|
513
|
+
tier: 'opus',
|
|
514
|
+
notes: 'Retired on the Claude API on 2026-06-15; still served on Google Cloud (Google managed).'
|
|
515
|
+
+ ' Anthropic names Claude Opus 4.8 as the replacement.',
|
|
516
|
+
},
|
|
435
517
|
{
|
|
436
518
|
/*
|
|
437
519
|
* The pricing page and the Sonnet 5.5 model page, read 2026-10-10. The
|
|
@@ -440,6 +522,7 @@ export const MODELS = [
|
|
|
440
522
|
*/
|
|
441
523
|
id: 'claude-sonnet-5-5',
|
|
442
524
|
provider: 'anthropic',
|
|
525
|
+
inferenceGeoMultipliers: US_ONLY_INFERENCE,
|
|
443
526
|
displayName: 'Claude Sonnet 5.5',
|
|
444
527
|
inputPerMTok: 2,
|
|
445
528
|
outputPerMTok: 10,
|
|
@@ -453,6 +536,7 @@ export const MODELS = [
|
|
|
453
536
|
{
|
|
454
537
|
id: 'claude-sonnet-5',
|
|
455
538
|
provider: 'anthropic',
|
|
539
|
+
inferenceGeoMultipliers: US_ONLY_INFERENCE,
|
|
456
540
|
displayName: 'Claude Sonnet 5',
|
|
457
541
|
inputPerMTok: 2,
|
|
458
542
|
outputPerMTok: 10,
|
|
@@ -466,6 +550,7 @@ export const MODELS = [
|
|
|
466
550
|
{
|
|
467
551
|
id: 'claude-sonnet-4-6',
|
|
468
552
|
provider: 'anthropic',
|
|
553
|
+
inferenceGeoMultipliers: US_ONLY_INFERENCE,
|
|
469
554
|
displayName: 'Claude Sonnet 4.6',
|
|
470
555
|
inputPerMTok: 3,
|
|
471
556
|
outputPerMTok: 15,
|
|
@@ -497,6 +582,29 @@ export const MODELS = [
|
|
|
497
582
|
tier: 'sonnet',
|
|
498
583
|
notes: 'Deprecated; retires 2026-11-30. Recommended replacement: Claude Sonnet 5.5.',
|
|
499
584
|
},
|
|
585
|
+
{
|
|
586
|
+
/*
|
|
587
|
+
* Retired on the Claude API on 2026-06-15 (the deprecations page, read
|
|
588
|
+
* 2026-11-05); still served on Claude Models on Google Cloud (Google
|
|
589
|
+
* managed) and on Bedrock. The pricing page, read the same day: $3/$15,
|
|
590
|
+
* writes $3.75 and $6, cache hits $0.30, batch $1.50/$7.50. 200k context
|
|
591
|
+
* from the context-windows page, a 1,024-token cache minimum from the
|
|
592
|
+
* prompt-caching page. The pricing page publishes one rate for it and no
|
|
593
|
+
* long-context band, so every call is priced at that rate.
|
|
594
|
+
*/
|
|
595
|
+
id: 'claude-sonnet-4-20250514',
|
|
596
|
+
provider: 'anthropic',
|
|
597
|
+
displayName: 'Claude Sonnet 4',
|
|
598
|
+
recommendable: false,
|
|
599
|
+
inputPerMTok: 3,
|
|
600
|
+
outputPerMTok: 15,
|
|
601
|
+
contextWindow: 200_000,
|
|
602
|
+
cacheMinTokens: 1024,
|
|
603
|
+
capability: 'mid',
|
|
604
|
+
tier: 'sonnet',
|
|
605
|
+
notes: 'Retired on the Claude API on 2026-06-15; still served on Google Cloud (Google managed) and Bedrock.'
|
|
606
|
+
+ ' Anthropic names Claude Sonnet 5.5 as the replacement.',
|
|
607
|
+
},
|
|
500
608
|
{
|
|
501
609
|
/*
|
|
502
610
|
* The pricing page, the models overview and the prompt-caching page, read
|
|
@@ -516,6 +624,7 @@ export const MODELS = [
|
|
|
516
624
|
*/
|
|
517
625
|
id: 'claude-haiku-5-5',
|
|
518
626
|
provider: 'anthropic',
|
|
627
|
+
inferenceGeoMultipliers: US_ONLY_INFERENCE,
|
|
519
628
|
displayName: 'Claude Haiku 5.5',
|
|
520
629
|
inputPerMTok: 0.1,
|
|
521
630
|
outputPerMTok: 0.5,
|
|
@@ -551,6 +660,28 @@ export const MODELS = [
|
|
|
551
660
|
tier: 'haiku',
|
|
552
661
|
notes: '200K context window and a 64K output cap, smaller than the rest.',
|
|
553
662
|
},
|
|
663
|
+
{
|
|
664
|
+
/*
|
|
665
|
+
* Retired on the Claude API on 2026-02-19 (the deprecations page, read
|
|
666
|
+
* 2026-11-05); still served on Claude Models on Google Cloud (Google
|
|
667
|
+
* managed). The pricing page, read the same day: $0.80/$4, writes $1 and
|
|
668
|
+
* $1.60, cache hits $0.08, batch $0.40/$2, the default multipliers. 200k
|
|
669
|
+
* context from the context-windows page, and the prompt-caching page's
|
|
670
|
+
* 2,048-token cache minimum.
|
|
671
|
+
*/
|
|
672
|
+
id: 'claude-3-5-haiku-20241022',
|
|
673
|
+
provider: 'anthropic',
|
|
674
|
+
displayName: 'Claude Haiku 3.5',
|
|
675
|
+
recommendable: false,
|
|
676
|
+
inputPerMTok: 0.8,
|
|
677
|
+
outputPerMTok: 4,
|
|
678
|
+
contextWindow: 200_000,
|
|
679
|
+
cacheMinTokens: 2048,
|
|
680
|
+
capability: 'small',
|
|
681
|
+
tier: 'haiku',
|
|
682
|
+
notes: 'Retired on the Claude API on 2026-02-19; still served on Google Cloud (Google managed).'
|
|
683
|
+
+ ' Anthropic names Claude Haiku 4.5 as the replacement.',
|
|
684
|
+
},
|
|
554
685
|
// ------------------------------------------------------------------------
|
|
555
686
|
// OpenAI
|
|
556
687
|
//
|
|
@@ -610,6 +741,11 @@ export const MODELS = [
|
|
|
610
741
|
outputPerMTok: 75,
|
|
611
742
|
},
|
|
612
743
|
],
|
|
744
|
+
serviceTiers: {
|
|
745
|
+
flex: { inputPerMTok: 5, outputPerMTok: 25, tiers: openAiLongBand(10, 37.5) },
|
|
746
|
+
fast: { inputPerMTok: 20, outputPerMTok: 100, tiers: openAiLongBand(40, 150) },
|
|
747
|
+
ultrafast: { inputPerMTok: 60, outputPerMTok: 300, tiers: openAiLongBand(120, 450) },
|
|
748
|
+
},
|
|
613
749
|
capability: 'frontier',
|
|
614
750
|
tier: 'frontier',
|
|
615
751
|
notes: OPENAI_CURRENT_NOTE,
|
|
@@ -633,6 +769,11 @@ export const MODELS = [
|
|
|
633
769
|
outputPerMTok: 15,
|
|
634
770
|
},
|
|
635
771
|
],
|
|
772
|
+
serviceTiers: {
|
|
773
|
+
flex: { inputPerMTok: 1, outputPerMTok: 5, tiers: openAiLongBand(2, 7.5) },
|
|
774
|
+
fast: { inputPerMTok: 4, outputPerMTok: 20, tiers: openAiLongBand(8, 30) },
|
|
775
|
+
ultrafast: { inputPerMTok: 12, outputPerMTok: 60, tiers: openAiLongBand(24, 90) },
|
|
776
|
+
},
|
|
636
777
|
capability: 'large',
|
|
637
778
|
tier: 'opus',
|
|
638
779
|
notes: OPENAI_CURRENT_NOTE,
|
|
@@ -662,6 +803,10 @@ export const MODELS = [
|
|
|
662
803
|
outputPerMTok: 7.5,
|
|
663
804
|
},
|
|
664
805
|
],
|
|
806
|
+
serviceTiers: {
|
|
807
|
+
flex: { inputPerMTok: 0.5, outputPerMTok: 2.5, tiers: openAiLongBand(1, 3.75) },
|
|
808
|
+
fast: { inputPerMTok: 2, outputPerMTok: 10, tiers: openAiLongBand(4, 15) },
|
|
809
|
+
},
|
|
665
810
|
capability: 'mid',
|
|
666
811
|
tier: 'sonnet',
|
|
667
812
|
notes: OPENAI_CURRENT_NOTE,
|
|
@@ -685,6 +830,10 @@ export const MODELS = [
|
|
|
685
830
|
outputPerMTok: 15,
|
|
686
831
|
},
|
|
687
832
|
],
|
|
833
|
+
serviceTiers: {
|
|
834
|
+
flex: { inputPerMTok: 1, outputPerMTok: 5, tiers: openAiLongBand(2, 7.5) },
|
|
835
|
+
fast: { inputPerMTok: 4, outputPerMTok: 20, tiers: openAiLongBand(8, 30) },
|
|
836
|
+
},
|
|
688
837
|
capability: 'large',
|
|
689
838
|
tier: 'opus',
|
|
690
839
|
notes: OPENAI_CURRENT_NOTE,
|
|
@@ -708,12 +857,30 @@ export const MODELS = [
|
|
|
708
857
|
outputPerMTok: 0.75,
|
|
709
858
|
},
|
|
710
859
|
],
|
|
860
|
+
serviceTiers: {
|
|
861
|
+
flex: { inputPerMTok: 0.05, outputPerMTok: 0.25, tiers: openAiLongBand(0.1, 0.375) },
|
|
862
|
+
fast: { inputPerMTok: 0.2, outputPerMTok: 1, tiers: openAiLongBand(0.4, 1.5) },
|
|
863
|
+
},
|
|
711
864
|
capability: 'small',
|
|
712
865
|
tier: 'haiku',
|
|
713
866
|
notes: OPENAI_CURRENT_NOTE,
|
|
714
867
|
},
|
|
715
868
|
{
|
|
869
|
+
/*
|
|
870
|
+
* Its model page, read 2026-11-05: "The `gpt-5.6` alias routes requests
|
|
871
|
+
* to GPT-5.6 Sol", so a log that names the alias is this model; and
|
|
872
|
+
* "$4 per million input tokens and $20 per million output tokens, a 20%
|
|
873
|
+
* reduction in input pricing and a 33% reduction in output pricing ...
|
|
874
|
+
* promotional pricing is available until November 30, 2026". The price
|
|
875
|
+
* after the promotion is not published as a figure, and deriving one
|
|
876
|
+
* from two rounded percentages would be a price nobody quoted, so the row
|
|
877
|
+
* carries what the page charges today. When the page changes,
|
|
878
|
+
* `scripts/price-drift.mjs` reports it on the next weekly run; until a
|
|
879
|
+
* person reads the new figure, a call after 2026-11-30 may be priced low,
|
|
880
|
+
* and the note says so to anyone reading the row.
|
|
881
|
+
*/
|
|
716
882
|
id: 'gpt-5.6-sol',
|
|
883
|
+
aliases: ['gpt-5.6'],
|
|
717
884
|
provider: 'openai',
|
|
718
885
|
displayName: 'GPT-5.6 Sol',
|
|
719
886
|
inputPerMTok: 4,
|
|
@@ -731,9 +898,14 @@ export const MODELS = [
|
|
|
731
898
|
outputPerMTok: 30,
|
|
732
899
|
},
|
|
733
900
|
],
|
|
901
|
+
serviceTiers: {
|
|
902
|
+
flex: { inputPerMTok: 2, outputPerMTok: 10, tiers: openAiLongBand(4, 15) },
|
|
903
|
+
fast: { inputPerMTok: 8, outputPerMTok: 40, tiers: openAiLongBand(16, 60) },
|
|
904
|
+
},
|
|
734
905
|
capability: 'large',
|
|
735
906
|
tier: 'opus',
|
|
736
|
-
notes: OPENAI_CURRENT_NOTE
|
|
907
|
+
notes: OPENAI_CURRENT_NOTE
|
|
908
|
+
+ ' $4/$20 is promotional until 2026-11-30, and OpenAI has not published the price after it as a figure.',
|
|
737
909
|
},
|
|
738
910
|
{
|
|
739
911
|
id: 'gpt-5.6-terra',
|
|
@@ -754,6 +926,10 @@ export const MODELS = [
|
|
|
754
926
|
outputPerMTok: 18,
|
|
755
927
|
},
|
|
756
928
|
],
|
|
929
|
+
serviceTiers: {
|
|
930
|
+
flex: { inputPerMTok: 1, outputPerMTok: 6, tiers: openAiLongBand(2, 9) },
|
|
931
|
+
fast: { inputPerMTok: 4, outputPerMTok: 24, tiers: openAiLongBand(8, 36) },
|
|
932
|
+
},
|
|
757
933
|
capability: 'mid',
|
|
758
934
|
tier: 'sonnet',
|
|
759
935
|
notes: OPENAI_CURRENT_NOTE,
|
|
@@ -777,55 +953,109 @@ export const MODELS = [
|
|
|
777
953
|
outputPerMTok: 1.8,
|
|
778
954
|
},
|
|
779
955
|
],
|
|
956
|
+
serviceTiers: {
|
|
957
|
+
flex: { inputPerMTok: 0.1, outputPerMTok: 0.6, tiers: openAiLongBand(0.2, 0.9) },
|
|
958
|
+
fast: { inputPerMTok: 0.4, outputPerMTok: 2.4, tiers: openAiLongBand(0.8, 3.6) },
|
|
959
|
+
},
|
|
780
960
|
capability: 'small',
|
|
781
961
|
tier: 'haiku',
|
|
782
962
|
notes: OPENAI_CURRENT_NOTE,
|
|
783
963
|
},
|
|
964
|
+
{
|
|
965
|
+
/*
|
|
966
|
+
* The pricing page's "Cyber models" table and the model's own page
|
|
967
|
+
* (developers.openai.com/api/docs/models/gpt-5.6-cyber.md), read
|
|
968
|
+
* 2026-11-05: $12.50/$75, cached input $1.25, the 30-minute write $15.625
|
|
969
|
+
* and the 12-hour one $31.25, the same 0.1x, 1.25x and 2.5x as the rest of
|
|
970
|
+
* GPT-5.6. A 400,000-token context window with at most 272,000 input
|
|
971
|
+
* tokens, so the long-prompt band the model page mentions can never be
|
|
972
|
+
* reached and none is modelled; the pricing page lists none either. The
|
|
973
|
+
* Batch endpoint is "Not supported", so there is no batch price.
|
|
974
|
+
*
|
|
975
|
+
* Found by `scripts/price-drift.mjs` on its first run, as a model on the
|
|
976
|
+
* pricing page that read as unpriced. It needs Daybreak programme
|
|
977
|
+
* approval, so it is priced for the logs of people who have it and never
|
|
978
|
+
* recommended to anyone else.
|
|
979
|
+
*/
|
|
980
|
+
id: 'gpt-5.6-cyber',
|
|
981
|
+
provider: 'openai',
|
|
982
|
+
displayName: 'GPT-5.6 Cyber',
|
|
983
|
+
recommendable: false,
|
|
984
|
+
inputPerMTok: 12.5,
|
|
985
|
+
outputPerMTok: 75,
|
|
986
|
+
contextWindow: 400_000,
|
|
987
|
+
cacheMinTokens: 1024,
|
|
988
|
+
caching: 'automatic',
|
|
989
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1.25, cacheWrite1h: 2.5, batch: null },
|
|
990
|
+
cacheTtl: OPENAI_CACHE_TTL,
|
|
991
|
+
capability: 'large',
|
|
992
|
+
tier: 'opus',
|
|
993
|
+
notes: 'Needs approval through the Daybreak programme. At most 272,000 input tokens, Responses API only, no batch.'
|
|
994
|
+
+ ' Cache writes cost 1.25x input for the default 30-minute entry and 2.5x for a 12-hour one.',
|
|
995
|
+
},
|
|
784
996
|
// ------------------------------------------------------------------------
|
|
997
|
+
// GPT-5, mini and nano. Each model page, read 2026-11-05, opens with
|
|
998
|
+
// "Status: Deprecated", and the catalogue still offered all three as
|
|
999
|
+
// cheaper alternatives, nano as the cheapest OpenAI model there is. Priced
|
|
1000
|
+
// for the logs that hold them; never recommended.
|
|
785
1001
|
{
|
|
786
1002
|
id: 'gpt-5',
|
|
787
1003
|
aliases: ['gpt-5-2025-08-07'],
|
|
788
1004
|
provider: 'openai',
|
|
789
1005
|
displayName: 'GPT-5',
|
|
1006
|
+
recommendable: false,
|
|
790
1007
|
inputPerMTok: 1.25,
|
|
791
1008
|
outputPerMTok: 10,
|
|
792
1009
|
contextWindow: 400_000,
|
|
793
1010
|
cacheMinTokens: 1024,
|
|
794
1011
|
caching: 'automatic',
|
|
795
1012
|
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1013
|
+
serviceTiers: {
|
|
1014
|
+
flex: { inputPerMTok: 0.625, outputPerMTok: 5 },
|
|
1015
|
+
fast: { inputPerMTok: 2.5, outputPerMTok: 20 },
|
|
1016
|
+
},
|
|
796
1017
|
capability: 'frontier',
|
|
797
1018
|
tier: 'frontier',
|
|
798
|
-
notes: OPENAI_GPT5_NOTE,
|
|
1019
|
+
notes: OPENAI_GPT5_NOTE + OPENAI_DEPRECATED_SUFFIX,
|
|
799
1020
|
},
|
|
800
1021
|
{
|
|
801
1022
|
id: 'gpt-5-mini',
|
|
802
1023
|
aliases: ['gpt-5-mini-2025-08-07'],
|
|
803
1024
|
provider: 'openai',
|
|
804
1025
|
displayName: 'GPT-5 mini',
|
|
1026
|
+
recommendable: false,
|
|
805
1027
|
inputPerMTok: 0.25,
|
|
806
1028
|
outputPerMTok: 2,
|
|
807
1029
|
contextWindow: 400_000,
|
|
808
1030
|
cacheMinTokens: 1024,
|
|
809
1031
|
caching: 'automatic',
|
|
810
1032
|
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1033
|
+
serviceTiers: {
|
|
1034
|
+
flex: { inputPerMTok: 0.125, outputPerMTok: 1 },
|
|
1035
|
+
fast: { inputPerMTok: 0.45, outputPerMTok: 3.6 },
|
|
1036
|
+
},
|
|
811
1037
|
capability: 'mid',
|
|
812
1038
|
tier: 'sonnet',
|
|
813
|
-
notes: OPENAI_GPT5_NOTE,
|
|
1039
|
+
notes: OPENAI_GPT5_NOTE + OPENAI_DEPRECATED_SUFFIX,
|
|
814
1040
|
},
|
|
815
1041
|
{
|
|
816
1042
|
id: 'gpt-5-nano',
|
|
817
1043
|
aliases: ['gpt-5-nano-2025-08-07'],
|
|
818
1044
|
provider: 'openai',
|
|
819
1045
|
displayName: 'GPT-5 nano',
|
|
1046
|
+
recommendable: false,
|
|
820
1047
|
inputPerMTok: 0.05,
|
|
821
1048
|
outputPerMTok: 0.4,
|
|
822
1049
|
contextWindow: 400_000,
|
|
823
1050
|
cacheMinTokens: 1024,
|
|
824
1051
|
caching: 'automatic',
|
|
825
1052
|
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1053
|
+
serviceTiers: {
|
|
1054
|
+
flex: { inputPerMTok: 0.025, outputPerMTok: 0.2 },
|
|
1055
|
+
},
|
|
826
1056
|
capability: 'small',
|
|
827
1057
|
tier: 'haiku',
|
|
828
|
-
notes: OPENAI_GPT5_NOTE,
|
|
1058
|
+
notes: OPENAI_GPT5_NOTE + OPENAI_DEPRECATED_SUFFIX,
|
|
829
1059
|
},
|
|
830
1060
|
// ------------------------------------------------------------------------
|
|
831
1061
|
// OpenAI's earlier models, still billed and still in logs.
|
|
@@ -862,6 +1092,10 @@ export const MODELS = [
|
|
|
862
1092
|
outputPerMTok: 45,
|
|
863
1093
|
},
|
|
864
1094
|
],
|
|
1095
|
+
serviceTiers: {
|
|
1096
|
+
flex: { inputPerMTok: 2.5, outputPerMTok: 15, tiers: openAiLongBand(5, 22.5) },
|
|
1097
|
+
fast: { inputPerMTok: 12.5, outputPerMTok: 75 },
|
|
1098
|
+
},
|
|
865
1099
|
capability: 'frontier',
|
|
866
1100
|
tier: 'frontier',
|
|
867
1101
|
notes: OPENAI_EARLIER_LONG_NOTE,
|
|
@@ -885,6 +1119,9 @@ export const MODELS = [
|
|
|
885
1119
|
outputPerMTok: 270,
|
|
886
1120
|
},
|
|
887
1121
|
],
|
|
1122
|
+
serviceTiers: {
|
|
1123
|
+
flex: { inputPerMTok: 15, outputPerMTok: 90 },
|
|
1124
|
+
},
|
|
888
1125
|
capability: 'frontier',
|
|
889
1126
|
tier: 'frontier',
|
|
890
1127
|
notes: OPENAI_EARLIER_LONG_NOTE,
|
|
@@ -908,6 +1145,10 @@ export const MODELS = [
|
|
|
908
1145
|
outputPerMTok: 22.5,
|
|
909
1146
|
},
|
|
910
1147
|
],
|
|
1148
|
+
serviceTiers: {
|
|
1149
|
+
flex: { inputPerMTok: 1.25, outputPerMTok: 7.5, tiers: openAiLongBand(2.5, 11.25) },
|
|
1150
|
+
fast: { inputPerMTok: 5, outputPerMTok: 30 },
|
|
1151
|
+
},
|
|
911
1152
|
capability: 'frontier',
|
|
912
1153
|
tier: 'frontier',
|
|
913
1154
|
notes: OPENAI_EARLIER_LONG_NOTE,
|
|
@@ -931,6 +1172,9 @@ export const MODELS = [
|
|
|
931
1172
|
outputPerMTok: 270,
|
|
932
1173
|
},
|
|
933
1174
|
],
|
|
1175
|
+
serviceTiers: {
|
|
1176
|
+
flex: { inputPerMTok: 15, outputPerMTok: 90, tiers: openAiLongBand(30, 135) },
|
|
1177
|
+
},
|
|
934
1178
|
capability: 'frontier',
|
|
935
1179
|
tier: 'frontier',
|
|
936
1180
|
notes: OPENAI_EARLIER_LONG_NOTE,
|
|
@@ -946,6 +1190,10 @@ export const MODELS = [
|
|
|
946
1190
|
cacheMinTokens: 1024,
|
|
947
1191
|
caching: 'automatic',
|
|
948
1192
|
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1193
|
+
serviceTiers: {
|
|
1194
|
+
flex: { inputPerMTok: 0.375, outputPerMTok: 2.25 },
|
|
1195
|
+
fast: { inputPerMTok: 1.5, outputPerMTok: 9 },
|
|
1196
|
+
},
|
|
949
1197
|
capability: 'mid',
|
|
950
1198
|
tier: 'sonnet',
|
|
951
1199
|
notes: OPENAI_EARLIER_NOTE,
|
|
@@ -962,6 +1210,9 @@ export const MODELS = [
|
|
|
962
1210
|
cacheMinTokens: 1024,
|
|
963
1211
|
caching: 'automatic',
|
|
964
1212
|
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1213
|
+
serviceTiers: {
|
|
1214
|
+
flex: { inputPerMTok: 0.1, outputPerMTok: 0.625 },
|
|
1215
|
+
},
|
|
965
1216
|
capability: 'small',
|
|
966
1217
|
tier: 'haiku',
|
|
967
1218
|
notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
|
|
@@ -977,6 +1228,10 @@ export const MODELS = [
|
|
|
977
1228
|
cacheMinTokens: 1024,
|
|
978
1229
|
caching: 'automatic',
|
|
979
1230
|
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1231
|
+
serviceTiers: {
|
|
1232
|
+
flex: { inputPerMTok: 0.875, outputPerMTok: 7 },
|
|
1233
|
+
fast: { inputPerMTok: 3.5, outputPerMTok: 28 },
|
|
1234
|
+
},
|
|
980
1235
|
capability: 'frontier',
|
|
981
1236
|
tier: 'frontier',
|
|
982
1237
|
notes: OPENAI_EARLIER_NOTE,
|
|
@@ -1008,6 +1263,10 @@ export const MODELS = [
|
|
|
1008
1263
|
cacheMinTokens: 1024,
|
|
1009
1264
|
caching: 'automatic',
|
|
1010
1265
|
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1266
|
+
serviceTiers: {
|
|
1267
|
+
flex: { inputPerMTok: 0.625, outputPerMTok: 5 },
|
|
1268
|
+
fast: { inputPerMTok: 2.5, outputPerMTok: 20 },
|
|
1269
|
+
},
|
|
1011
1270
|
capability: 'frontier',
|
|
1012
1271
|
tier: 'frontier',
|
|
1013
1272
|
notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
|
|
@@ -1040,6 +1299,9 @@ export const MODELS = [
|
|
|
1040
1299
|
cacheMinTokens: 1024,
|
|
1041
1300
|
caching: 'automatic',
|
|
1042
1301
|
multipliers: { cacheRead: 0.25, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1302
|
+
serviceTiers: {
|
|
1303
|
+
fast: { inputPerMTok: 3.5, outputPerMTok: 14 },
|
|
1304
|
+
},
|
|
1043
1305
|
capability: 'large',
|
|
1044
1306
|
tier: 'opus',
|
|
1045
1307
|
notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
|
|
@@ -1056,6 +1318,9 @@ export const MODELS = [
|
|
|
1056
1318
|
cacheMinTokens: 1024,
|
|
1057
1319
|
caching: 'automatic',
|
|
1058
1320
|
multipliers: { cacheRead: 0.25, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1321
|
+
serviceTiers: {
|
|
1322
|
+
fast: { inputPerMTok: 0.7, outputPerMTok: 2.8 },
|
|
1323
|
+
},
|
|
1059
1324
|
capability: 'mid',
|
|
1060
1325
|
tier: 'sonnet',
|
|
1061
1326
|
notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
|
|
@@ -1072,6 +1337,9 @@ export const MODELS = [
|
|
|
1072
1337
|
cacheMinTokens: 1024,
|
|
1073
1338
|
caching: 'automatic',
|
|
1074
1339
|
multipliers: { cacheRead: 0.5, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1340
|
+
serviceTiers: {
|
|
1341
|
+
fast: { inputPerMTok: 4.25, outputPerMTok: 17 },
|
|
1342
|
+
},
|
|
1075
1343
|
capability: 'large',
|
|
1076
1344
|
tier: 'opus',
|
|
1077
1345
|
notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
|
|
@@ -1088,6 +1356,9 @@ export const MODELS = [
|
|
|
1088
1356
|
cacheMinTokens: 1024,
|
|
1089
1357
|
caching: 'automatic',
|
|
1090
1358
|
multipliers: { cacheRead: 0.5, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1359
|
+
serviceTiers: {
|
|
1360
|
+
fast: { inputPerMTok: 0.25, outputPerMTok: 1 },
|
|
1361
|
+
},
|
|
1091
1362
|
capability: 'small',
|
|
1092
1363
|
tier: 'haiku',
|
|
1093
1364
|
notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
|
|
@@ -1104,6 +1375,10 @@ export const MODELS = [
|
|
|
1104
1375
|
cacheMinTokens: 1024,
|
|
1105
1376
|
caching: 'automatic',
|
|
1106
1377
|
multipliers: { cacheRead: 0.25, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1378
|
+
serviceTiers: {
|
|
1379
|
+
flex: { inputPerMTok: 1, outputPerMTok: 4 },
|
|
1380
|
+
fast: { inputPerMTok: 3.5, outputPerMTok: 14 },
|
|
1381
|
+
},
|
|
1107
1382
|
capability: 'frontier',
|
|
1108
1383
|
tier: 'frontier',
|
|
1109
1384
|
notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
|
|
@@ -1125,6 +1400,143 @@ export const MODELS = [
|
|
|
1125
1400
|
notes: OPENAI_EARLIER_NO_CACHE_NOTE + OPENAI_DEPRECATED_SUFFIX,
|
|
1126
1401
|
},
|
|
1127
1402
|
// ------------------------------------------------------------------------
|
|
1403
|
+
// The Codex models and chat-latest. Codex CLI sessions name these, and none
|
|
1404
|
+
// was priced, so every such call read as unpriced. Each from its own model
|
|
1405
|
+
// page (developers.openai.com/api/docs/models/<id>.md), read 2026-11-05,
|
|
1406
|
+
// and gpt-5.3-codex and chat-latest also from the pricing page's
|
|
1407
|
+
// "Specialized models" table. Every page says Batch is "Not supported", so
|
|
1408
|
+
// none has a batch price. gpt-5.3-codex is deprecated and the rest of the
|
|
1409
|
+
// Codex line is shut down; all are priced for the logs that hold them and
|
|
1410
|
+
// never recommended. chat-latest is served and not recommended either: it
|
|
1411
|
+
// points at whatever model ChatGPT uses, so a recommendation would not name
|
|
1412
|
+
// a fixed model. Cache reads are 0.1x everywhere but codex-mini-latest,
|
|
1413
|
+
// whose page gives $0.375 on $1.50, 0.25x. gpt-5-search-api is on the
|
|
1414
|
+
// pricing page too and its model page returns 404, so it has no context
|
|
1415
|
+
// window and is left unpriced (see scripts/price-drift.mjs).
|
|
1416
|
+
// ------------------------------------------------------------------------
|
|
1417
|
+
{
|
|
1418
|
+
id: 'gpt-5.3-codex',
|
|
1419
|
+
provider: 'openai',
|
|
1420
|
+
displayName: 'GPT-5.3-Codex',
|
|
1421
|
+
recommendable: false,
|
|
1422
|
+
inputPerMTok: 1.75,
|
|
1423
|
+
outputPerMTok: 14,
|
|
1424
|
+
contextWindow: 400_000,
|
|
1425
|
+
cacheMinTokens: 1024,
|
|
1426
|
+
caching: 'automatic',
|
|
1427
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
|
|
1428
|
+
// The pricing page's specialized "Fast" table: $3.50/$28, cached $0.35.
|
|
1429
|
+
serviceTiers: { fast: { inputPerMTok: 3.5, outputPerMTok: 28 } },
|
|
1430
|
+
capability: 'frontier',
|
|
1431
|
+
tier: 'frontier',
|
|
1432
|
+
notes: OPENAI_CODEX_NOTE + ' At most 272,000 input tokens.' + OPENAI_DEPRECATED_SUFFIX,
|
|
1433
|
+
},
|
|
1434
|
+
{
|
|
1435
|
+
id: 'gpt-5.2-codex',
|
|
1436
|
+
provider: 'openai',
|
|
1437
|
+
displayName: 'GPT-5.2-Codex',
|
|
1438
|
+
recommendable: false,
|
|
1439
|
+
inputPerMTok: 1.75,
|
|
1440
|
+
outputPerMTok: 14,
|
|
1441
|
+
contextWindow: 400_000,
|
|
1442
|
+
cacheMinTokens: 1024,
|
|
1443
|
+
caching: 'automatic',
|
|
1444
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
|
|
1445
|
+
capability: 'frontier',
|
|
1446
|
+
tier: 'frontier',
|
|
1447
|
+
notes: OPENAI_CODEX_NOTE + ' At most 272,000 input tokens.' + OPENAI_SHUT_DOWN_SUFFIX,
|
|
1448
|
+
},
|
|
1449
|
+
{
|
|
1450
|
+
id: 'gpt-5.1-codex',
|
|
1451
|
+
provider: 'openai',
|
|
1452
|
+
displayName: 'GPT-5.1-Codex',
|
|
1453
|
+
recommendable: false,
|
|
1454
|
+
inputPerMTok: 1.25,
|
|
1455
|
+
outputPerMTok: 10,
|
|
1456
|
+
contextWindow: 400_000,
|
|
1457
|
+
cacheMinTokens: 1024,
|
|
1458
|
+
caching: 'automatic',
|
|
1459
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
|
|
1460
|
+
capability: 'frontier',
|
|
1461
|
+
tier: 'frontier',
|
|
1462
|
+
notes: OPENAI_CODEX_NOTE + OPENAI_SHUT_DOWN_SUFFIX,
|
|
1463
|
+
},
|
|
1464
|
+
{
|
|
1465
|
+
id: 'gpt-5.1-codex-max',
|
|
1466
|
+
provider: 'openai',
|
|
1467
|
+
displayName: 'GPT-5.1-Codex-Max',
|
|
1468
|
+
recommendable: false,
|
|
1469
|
+
inputPerMTok: 1.25,
|
|
1470
|
+
outputPerMTok: 10,
|
|
1471
|
+
contextWindow: 400_000,
|
|
1472
|
+
cacheMinTokens: 1024,
|
|
1473
|
+
caching: 'automatic',
|
|
1474
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
|
|
1475
|
+
capability: 'frontier',
|
|
1476
|
+
tier: 'frontier',
|
|
1477
|
+
notes: OPENAI_CODEX_NOTE + OPENAI_SHUT_DOWN_SUFFIX,
|
|
1478
|
+
},
|
|
1479
|
+
{
|
|
1480
|
+
id: 'gpt-5.1-codex-mini',
|
|
1481
|
+
provider: 'openai',
|
|
1482
|
+
displayName: 'GPT-5.1-Codex Mini',
|
|
1483
|
+
recommendable: false,
|
|
1484
|
+
inputPerMTok: 0.25,
|
|
1485
|
+
outputPerMTok: 2,
|
|
1486
|
+
contextWindow: 400_000,
|
|
1487
|
+
cacheMinTokens: 1024,
|
|
1488
|
+
caching: 'automatic',
|
|
1489
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
|
|
1490
|
+
capability: 'mid',
|
|
1491
|
+
tier: 'sonnet',
|
|
1492
|
+
notes: OPENAI_CODEX_NOTE + OPENAI_SHUT_DOWN_SUFFIX,
|
|
1493
|
+
},
|
|
1494
|
+
{
|
|
1495
|
+
id: 'gpt-5-codex',
|
|
1496
|
+
provider: 'openai',
|
|
1497
|
+
displayName: 'GPT-5-Codex',
|
|
1498
|
+
recommendable: false,
|
|
1499
|
+
inputPerMTok: 1.25,
|
|
1500
|
+
outputPerMTok: 10,
|
|
1501
|
+
contextWindow: 400_000,
|
|
1502
|
+
cacheMinTokens: 1024,
|
|
1503
|
+
caching: 'automatic',
|
|
1504
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
|
|
1505
|
+
capability: 'frontier',
|
|
1506
|
+
tier: 'frontier',
|
|
1507
|
+
notes: OPENAI_CODEX_NOTE + ' At most 272,000 input tokens.' + OPENAI_SHUT_DOWN_SUFFIX,
|
|
1508
|
+
},
|
|
1509
|
+
{
|
|
1510
|
+
id: 'codex-mini-latest',
|
|
1511
|
+
provider: 'openai',
|
|
1512
|
+
displayName: 'codex-mini-latest',
|
|
1513
|
+
recommendable: false,
|
|
1514
|
+
inputPerMTok: 1.5,
|
|
1515
|
+
outputPerMTok: 6,
|
|
1516
|
+
contextWindow: 200_000,
|
|
1517
|
+
cacheMinTokens: 1024,
|
|
1518
|
+
caching: 'automatic',
|
|
1519
|
+
multipliers: { cacheRead: 0.25, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
|
|
1520
|
+
capability: 'mid',
|
|
1521
|
+
tier: 'sonnet',
|
|
1522
|
+
notes: OPENAI_CODEX_NOTE + ' A cache read costs 0.25x input.' + OPENAI_SHUT_DOWN_SUFFIX,
|
|
1523
|
+
},
|
|
1524
|
+
{
|
|
1525
|
+
id: 'chat-latest',
|
|
1526
|
+
provider: 'openai',
|
|
1527
|
+
displayName: 'Chat Latest',
|
|
1528
|
+
recommendable: false,
|
|
1529
|
+
inputPerMTok: 5,
|
|
1530
|
+
outputPerMTok: 30,
|
|
1531
|
+
contextWindow: 400_000,
|
|
1532
|
+
cacheMinTokens: 1024,
|
|
1533
|
+
caching: 'automatic',
|
|
1534
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
|
|
1535
|
+
capability: 'large',
|
|
1536
|
+
tier: 'opus',
|
|
1537
|
+
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.',
|
|
1538
|
+
},
|
|
1539
|
+
// ------------------------------------------------------------------------
|
|
1128
1540
|
// Google
|
|
1129
1541
|
// ------------------------------------------------------------------------
|
|
1130
1542
|
{
|
|
@@ -1905,6 +2317,70 @@ export function getModel(id) {
|
|
|
1905
2317
|
export function listModels() {
|
|
1906
2318
|
return [...MODELS];
|
|
1907
2319
|
}
|
|
2320
|
+
/**
|
|
2321
|
+
* A response's `usage.inference_geo` as the geography that prices it, or
|
|
2322
|
+
* `undefined` for the global rate. `"global"` is the default and the row's
|
|
2323
|
+
* own price; `"not_available"` is what a model that cannot pin a geography
|
|
2324
|
+
* reports, and is priced the same.
|
|
2325
|
+
*/
|
|
2326
|
+
export function inferenceGeoOf(value) {
|
|
2327
|
+
if (typeof value !== 'string')
|
|
2328
|
+
return undefined;
|
|
2329
|
+
return value.trim().toLowerCase() === 'us' ? 'us' : undefined;
|
|
2330
|
+
}
|
|
2331
|
+
/** Rounded to a billionth of a dollar per million tokens, so 1.1x of $5 is $5.5 and not $5.500000000000001. */
|
|
2332
|
+
const scaled = (rate, factor) => Math.round(rate * factor * 1e9) / 1e9;
|
|
2333
|
+
/**
|
|
2334
|
+
* A response's `service_tier` as the tier whose table prices it, or
|
|
2335
|
+
* `undefined` for the standard one.
|
|
2336
|
+
*
|
|
2337
|
+
* OpenAI renamed Priority processing to Fast mode on 2026-07-30, and its guide
|
|
2338
|
+
* says "for GPT-5.6 and earlier models, the response returns `priority`
|
|
2339
|
+
* whether the request specifies `priority` or `fast`", so both spellings are
|
|
2340
|
+
* the Fast table. `"default"` is the standard tier, and is also what a Fast
|
|
2341
|
+
* request downgraded under the ramp-rate limit returns, "and charge standard
|
|
2342
|
+
* rates". `"auto"` and `"scale"`, or a value this table has never seen, are
|
|
2343
|
+
* priced at the standard rate rather than guessed into another tier.
|
|
2344
|
+
*/
|
|
2345
|
+
export function serviceTierOf(value) {
|
|
2346
|
+
if (typeof value !== 'string')
|
|
2347
|
+
return undefined;
|
|
2348
|
+
const tier = value.trim().toLowerCase();
|
|
2349
|
+
if (tier === 'flex')
|
|
2350
|
+
return 'flex';
|
|
2351
|
+
if (tier === 'fast' || tier === 'priority')
|
|
2352
|
+
return 'fast';
|
|
2353
|
+
if (tier === 'ultrafast')
|
|
2354
|
+
return 'ultrafast';
|
|
2355
|
+
return undefined;
|
|
2356
|
+
}
|
|
2357
|
+
/**
|
|
2358
|
+
* The row as one service tier prices it: that tier's rates and long band, the
|
|
2359
|
+
* row's own cache and batch ratios. Built once per row and tier.
|
|
2360
|
+
*/
|
|
2361
|
+
const serviceTierMemo = new WeakMap();
|
|
2362
|
+
function serviceTierRow(model, tier) {
|
|
2363
|
+
const sheet = model.serviceTiers?.[tier];
|
|
2364
|
+
if (sheet === undefined)
|
|
2365
|
+
return undefined;
|
|
2366
|
+
let rows = serviceTierMemo.get(model);
|
|
2367
|
+
if (rows === undefined) {
|
|
2368
|
+
rows = new Map();
|
|
2369
|
+
serviceTierMemo.set(model, rows);
|
|
2370
|
+
}
|
|
2371
|
+
let row = rows.get(tier);
|
|
2372
|
+
if (row === undefined) {
|
|
2373
|
+
const { history: _history, promo: _promo, tiers: _tiers, serviceTiers: _serviceTiers, ...rest } = model;
|
|
2374
|
+
row = Object.freeze({
|
|
2375
|
+
...rest,
|
|
2376
|
+
inputPerMTok: sheet.inputPerMTok,
|
|
2377
|
+
outputPerMTok: sheet.outputPerMTok,
|
|
2378
|
+
...(sheet.tiers !== undefined ? { tiers: sheet.tiers } : {}),
|
|
2379
|
+
});
|
|
2380
|
+
rows.set(tier, row);
|
|
2381
|
+
}
|
|
2382
|
+
return row;
|
|
2383
|
+
}
|
|
1908
2384
|
const pricingMemo = new WeakMap();
|
|
1909
2385
|
/**
|
|
1910
2386
|
* The row as it stood at `on`: itself when the current price applies, or a
|
|
@@ -1919,7 +2395,8 @@ function pricedAt(model, on) {
|
|
|
1919
2395
|
let periods = periodMemo.get(model);
|
|
1920
2396
|
if (periods === undefined) {
|
|
1921
2397
|
periods = history.map((period) => {
|
|
1922
|
-
|
|
2398
|
+
// A period's own price only: the service tiers below are today's tables.
|
|
2399
|
+
const { history: _history, promo: _promo, tiers: _tiers, multipliers: _multipliers, serviceTiers: _serviceTiers, ...rest } = model;
|
|
1923
2400
|
const row = Object.freeze({
|
|
1924
2401
|
...rest,
|
|
1925
2402
|
inputPerMTok: period.inputPerMTok,
|
|
@@ -2005,12 +2482,54 @@ function holds(when, on, size) {
|
|
|
2005
2482
|
* `pricing.test.js` fails a tiered model whose report drops it.
|
|
2006
2483
|
*/
|
|
2007
2484
|
export function effectivePricing(model, on = new Date(), context = {}) {
|
|
2485
|
+
/*
|
|
2486
|
+
* A geography with a published multiplier scales whatever the rest of the
|
|
2487
|
+
* call decides, fast mode and the long band included, because the page says
|
|
2488
|
+
* it stacks with all of them. Applied once, outside everything else.
|
|
2489
|
+
*/
|
|
2490
|
+
if (context.inferenceGeo !== undefined) {
|
|
2491
|
+
const { inferenceGeo, ...rest } = context;
|
|
2492
|
+
const rates = effectivePricing(model, on, rest);
|
|
2493
|
+
const geo = inferenceGeoOf(inferenceGeo);
|
|
2494
|
+
const factor = geo === undefined ? undefined : model.inferenceGeoMultipliers?.[geo];
|
|
2495
|
+
if (geo === undefined || factor === undefined)
|
|
2496
|
+
return rates;
|
|
2497
|
+
return {
|
|
2498
|
+
...rates,
|
|
2499
|
+
inputPerMTok: scaled(rates.inputPerMTok, factor),
|
|
2500
|
+
outputPerMTok: scaled(rates.outputPerMTok, factor),
|
|
2501
|
+
...(rates.tier?.floor !== undefined
|
|
2502
|
+
? {
|
|
2503
|
+
tier: {
|
|
2504
|
+
...rates.tier,
|
|
2505
|
+
floor: {
|
|
2506
|
+
inputPerMTok: scaled(rates.tier.floor.inputPerMTok, factor),
|
|
2507
|
+
outputPerMTok: scaled(rates.tier.floor.outputPerMTok, factor),
|
|
2508
|
+
},
|
|
2509
|
+
},
|
|
2510
|
+
}
|
|
2511
|
+
: {}),
|
|
2512
|
+
inferenceGeo: geo,
|
|
2513
|
+
};
|
|
2514
|
+
}
|
|
2008
2515
|
/* A call before a published price change is priced as it was billed then. */
|
|
2009
2516
|
if (model.history !== undefined) {
|
|
2010
2517
|
const period = pricedAt(model, on);
|
|
2011
2518
|
if (period !== model)
|
|
2012
2519
|
return effectivePricing(period, on, context);
|
|
2013
2520
|
}
|
|
2521
|
+
/*
|
|
2522
|
+
* A response that names another service tier is priced by that tier's own
|
|
2523
|
+
* table, long band included, and by nothing composed out of two.
|
|
2524
|
+
*/
|
|
2525
|
+
if (context.serviceTier !== undefined && model.serviceTiers !== undefined) {
|
|
2526
|
+
const named = serviceTierOf(context.serviceTier);
|
|
2527
|
+
const row = named === undefined ? undefined : serviceTierRow(model, named);
|
|
2528
|
+
if (row !== undefined) {
|
|
2529
|
+
const { serviceTier: _serviceTier, ...size } = context;
|
|
2530
|
+
return { ...effectivePricing(row, on, size), serviceTier: named };
|
|
2531
|
+
}
|
|
2532
|
+
}
|
|
2014
2533
|
const memo = pricingMemo.get(model) ?? cache(model);
|
|
2015
2534
|
/**
|
|
2016
2535
|
* Tiers first, and a promotion never runs on top of one.
|