@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/src/pricing.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ModelPricing, PricingTier, TierCondition } from './types.js';
|
|
1
|
+
import type { InferenceGeo, ModelPricing, PricingTier, ServiceTier, TierCondition } from './types.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Model and pricing catalogue (USD per million tokens).
|
|
@@ -41,10 +41,12 @@ export const PROVIDER_REVIEWED: Readonly<Record<string, string>> = Object.freeze
|
|
|
41
41
|
* which bills Opus 5.5 at $8/$40 and Opus 5 and 4.8 at $10/$50 and which
|
|
42
42
|
* every response records in `usage.speed`, so fast calls had been priced at
|
|
43
43
|
* half their cost; and Claude Sonnet 4.5, deprecated but still served until
|
|
44
|
-
* 2026-11-30, which read as unpriced. Both are here now.
|
|
45
|
-
* 4.1, Opus 4, Sonnet 4 and Haiku 3.5
|
|
46
|
-
*
|
|
47
|
-
*
|
|
44
|
+
* 2026-11-30, which read as unpriced. Both are here now. So are the
|
|
45
|
+
* retired Opus 4.1, Opus 4, Sonnet 4 and Haiku 3.5, still on the pricing
|
|
46
|
+
* page and in every log from before their retirement: their own model pages
|
|
47
|
+
* are gone, and the context-windows page gives each the 200k window every
|
|
48
|
+
* Claude model outside its 1M list has. Claude Sonnet 3.7 and Haiku 3 are
|
|
49
|
+
* retired and absent from the pricing page, so they stay unpriced.
|
|
48
50
|
*/
|
|
49
51
|
anthropic: '2026-11-05',
|
|
50
52
|
/*
|
|
@@ -269,6 +271,18 @@ const NO_PUBLISHED_CACHE_MINIMUM =
|
|
|
269
271
|
*/
|
|
270
272
|
const OPENAI_CACHE_TTL = Object.freeze({ writeMs: 30 * 60_000, longerMs: 12 * 60 * 60_000 });
|
|
271
273
|
|
|
274
|
+
/**
|
|
275
|
+
* OpenAI's service-tier tables, read from developers.openai.com/api/docs/pricing.md
|
|
276
|
+
* on 2026-11-05: the Flex, Fast and Ultrafast tables beside the Standard one,
|
|
277
|
+
* each model's row as printed, and its "Long context" columns where the table
|
|
278
|
+
* publishes them ("Short context: <=272K input tokens. Long context: >272K").
|
|
279
|
+
* A row whose long columns read "-" gets no long band here: GPT-5.5 and 5.4 in
|
|
280
|
+
* Fast, GPT-5.5 pro in Flex. See `ModelPricing.serviceTiers`.
|
|
281
|
+
*/
|
|
282
|
+
const openAiLongBand = (inputPerMTok: number, outputPerMTok: number): PricingTier[] => [
|
|
283
|
+
{ id: 'over-272k', when: { kind: 'input-tokens-above', tokens: 272_000 }, inputPerMTok, outputPerMTok },
|
|
284
|
+
];
|
|
285
|
+
|
|
272
286
|
const OPENAI_CURRENT_NOTE =
|
|
273
287
|
'Priced per request by prompt length: over 272,000 input tokens, 2x input and cache and 1.5x output for'
|
|
274
288
|
+ ' the whole request. Cache writes cost 1.25x input for the default 30-minute entry and 2.5x for a'
|
|
@@ -282,6 +296,10 @@ const OPENAI_EARLIER_LONG_NOTE =
|
|
|
282
296
|
+ OPENAI_EARLIER_NOTE;
|
|
283
297
|
const OPENAI_EARLIER_NO_CACHE_NOTE = 'OpenAI publishes no cached-input price for this model, so caching is not priced.';
|
|
284
298
|
const OPENAI_DEPRECATED_SUFFIX = ' Deprecated by OpenAI: priced for the logs that hold it, never recommended.';
|
|
299
|
+
const OPENAI_SHUT_DOWN_SUFFIX = ' Shut down by OpenAI: priced for the logs that hold it, never recommended.';
|
|
300
|
+
const OPENAI_CODEX_NOTE =
|
|
301
|
+
'Caching is automatic; a write costs what input costs. Responses API only, and no batch. OpenAI says the minimum for'
|
|
302
|
+
+ ' models before GPT-5.6 varies by request settings, so 1,024 here is the nearest published floor.';
|
|
285
303
|
|
|
286
304
|
const OPENAI_GPT5_NOTE =
|
|
287
305
|
'Caching is automatic, with no cache_control to set. OpenAI says the minimum for models before GPT-5.6 varies by'
|
|
@@ -292,6 +310,19 @@ const MISTRAL_CACHE_NOTE =
|
|
|
292
310
|
'Cached input costs 10% of the input price (mistral.ai/cloud/inference, read 2026-10-11). How caching starts and'
|
|
293
311
|
+ ' its minimum are not published anywhere Trazum can read, so no caching advice is given for it.';
|
|
294
312
|
|
|
313
|
+
/**
|
|
314
|
+
* US-only inference on Claude 4.6 and later.
|
|
315
|
+
*
|
|
316
|
+
* platform.claude.com/docs/en/about-claude/pricing, "Data residency pricing",
|
|
317
|
+
* read 2026-11-05: "For Claude 4.6 and later models, specifying US-only
|
|
318
|
+
* inference through the `inference_geo` parameter incurs a 1.1x multiplier on
|
|
319
|
+
* all token pricing categories, including input tokens, output tokens, cache
|
|
320
|
+
* writes, and cache reads." It stacks with fast mode and the Batch API
|
|
321
|
+
* discount, the same page says. Earlier models reject the parameter, so
|
|
322
|
+
* they carry no multiplier. `price-drift.mjs` reads the sentence weekly.
|
|
323
|
+
*/
|
|
324
|
+
const US_ONLY_INFERENCE = Object.freeze({ us: 1.1 });
|
|
325
|
+
|
|
295
326
|
export const MODELS: ModelPricing[] = [
|
|
296
327
|
{
|
|
297
328
|
/*
|
|
@@ -303,6 +334,7 @@ export const MODELS: ModelPricing[] = [
|
|
|
303
334
|
*/
|
|
304
335
|
id: 'claude-fable-5-1',
|
|
305
336
|
provider: 'anthropic',
|
|
337
|
+
inferenceGeoMultipliers: US_ONLY_INFERENCE,
|
|
306
338
|
displayName: 'Claude Fable 5.1',
|
|
307
339
|
inputPerMTok: 10,
|
|
308
340
|
outputPerMTok: 50,
|
|
@@ -321,6 +353,7 @@ export const MODELS: ModelPricing[] = [
|
|
|
321
353
|
*/
|
|
322
354
|
id: 'claude-mythos-5-1',
|
|
323
355
|
provider: 'anthropic',
|
|
356
|
+
inferenceGeoMultipliers: US_ONLY_INFERENCE,
|
|
324
357
|
displayName: 'Claude Mythos 5.1',
|
|
325
358
|
recommendable: false,
|
|
326
359
|
inputPerMTok: 10,
|
|
@@ -337,6 +370,7 @@ export const MODELS: ModelPricing[] = [
|
|
|
337
370
|
{
|
|
338
371
|
id: 'claude-fable-5',
|
|
339
372
|
provider: 'anthropic',
|
|
373
|
+
inferenceGeoMultipliers: US_ONLY_INFERENCE,
|
|
340
374
|
displayName: 'Claude Fable 5',
|
|
341
375
|
inputPerMTok: 10,
|
|
342
376
|
outputPerMTok: 50,
|
|
@@ -349,6 +383,7 @@ export const MODELS: ModelPricing[] = [
|
|
|
349
383
|
{
|
|
350
384
|
id: 'claude-mythos-5',
|
|
351
385
|
provider: 'anthropic',
|
|
386
|
+
inferenceGeoMultipliers: US_ONLY_INFERENCE,
|
|
352
387
|
displayName: 'Claude Mythos 5',
|
|
353
388
|
recommendable: false,
|
|
354
389
|
inputPerMTok: 10,
|
|
@@ -370,6 +405,7 @@ export const MODELS: ModelPricing[] = [
|
|
|
370
405
|
*/
|
|
371
406
|
id: 'claude-opus-5-5',
|
|
372
407
|
provider: 'anthropic',
|
|
408
|
+
inferenceGeoMultipliers: US_ONLY_INFERENCE,
|
|
373
409
|
displayName: 'Claude Opus 5.5',
|
|
374
410
|
inputPerMTok: 4,
|
|
375
411
|
outputPerMTok: 20,
|
|
@@ -392,6 +428,7 @@ export const MODELS: ModelPricing[] = [
|
|
|
392
428
|
{
|
|
393
429
|
id: 'claude-opus-5',
|
|
394
430
|
provider: 'anthropic',
|
|
431
|
+
inferenceGeoMultipliers: US_ONLY_INFERENCE,
|
|
395
432
|
displayName: 'Claude Opus 5',
|
|
396
433
|
inputPerMTok: 5,
|
|
397
434
|
outputPerMTok: 25,
|
|
@@ -406,6 +443,7 @@ export const MODELS: ModelPricing[] = [
|
|
|
406
443
|
{
|
|
407
444
|
id: 'claude-opus-4-8',
|
|
408
445
|
provider: 'anthropic',
|
|
446
|
+
inferenceGeoMultipliers: US_ONLY_INFERENCE,
|
|
409
447
|
displayName: 'Claude Opus 4.8',
|
|
410
448
|
inputPerMTok: 5,
|
|
411
449
|
outputPerMTok: 25,
|
|
@@ -424,6 +462,7 @@ export const MODELS: ModelPricing[] = [
|
|
|
424
462
|
{
|
|
425
463
|
id: 'claude-opus-4-7',
|
|
426
464
|
provider: 'anthropic',
|
|
465
|
+
inferenceGeoMultipliers: US_ONLY_INFERENCE,
|
|
427
466
|
displayName: 'Claude Opus 4.7',
|
|
428
467
|
inputPerMTok: 5,
|
|
429
468
|
outputPerMTok: 25,
|
|
@@ -435,6 +474,7 @@ export const MODELS: ModelPricing[] = [
|
|
|
435
474
|
{
|
|
436
475
|
id: 'claude-opus-4-6',
|
|
437
476
|
provider: 'anthropic',
|
|
477
|
+
inferenceGeoMultipliers: US_ONLY_INFERENCE,
|
|
438
478
|
displayName: 'Claude Opus 4.6',
|
|
439
479
|
inputPerMTok: 5,
|
|
440
480
|
outputPerMTok: 25,
|
|
@@ -464,6 +504,53 @@ export const MODELS: ModelPricing[] = [
|
|
|
464
504
|
tier: 'opus',
|
|
465
505
|
notes: '200K context window and a 64K output cap.',
|
|
466
506
|
},
|
|
507
|
+
{
|
|
508
|
+
/*
|
|
509
|
+
* Retired on the Claude API on 2026-08-05 (the deprecations page, read
|
|
510
|
+
* 2026-11-05) and still served on Claude Models on Google Cloud (Google
|
|
511
|
+
* managed) and on Bedrock. Priced because a year of logs carries it and,
|
|
512
|
+
* unpriced, every one of those calls read as a gap. The pricing page, read
|
|
513
|
+
* the same day: $15/$75, writes $18.75 and $30, cache hits $1.50, batch
|
|
514
|
+
* $7.50/$37.50, which are the default multipliers. Its model page is gone;
|
|
515
|
+
* the context-windows page gives every Claude model outside its 1M list a
|
|
516
|
+
* 200k window, and the prompt-caching page a 1,024-token cache minimum.
|
|
517
|
+
* The dated id is the one the deprecations page names and what a log
|
|
518
|
+
* carries; no shorter alias is on any page read, so none is declared.
|
|
519
|
+
*/
|
|
520
|
+
id: 'claude-opus-4-1-20250805',
|
|
521
|
+
provider: 'anthropic',
|
|
522
|
+
displayName: 'Claude Opus 4.1',
|
|
523
|
+
recommendable: false,
|
|
524
|
+
inputPerMTok: 15,
|
|
525
|
+
outputPerMTok: 75,
|
|
526
|
+
contextWindow: 200_000,
|
|
527
|
+
cacheMinTokens: 1024,
|
|
528
|
+
capability: 'large',
|
|
529
|
+
tier: 'opus',
|
|
530
|
+
notes:
|
|
531
|
+
'Retired on the Claude API on 2026-08-05; still served on Google Cloud (Google managed) and Bedrock.'
|
|
532
|
+
+ ' Anthropic names Claude Opus 4.8 as the replacement.',
|
|
533
|
+
},
|
|
534
|
+
{
|
|
535
|
+
/*
|
|
536
|
+
* Retired on the Claude API on 2026-06-15; still served on Claude Models
|
|
537
|
+
* on Google Cloud (Google managed). The same pages and the same figures as
|
|
538
|
+
* Opus 4.1 above: $15/$75, 200k context, a 1,024-token cache minimum.
|
|
539
|
+
*/
|
|
540
|
+
id: 'claude-opus-4-20250514',
|
|
541
|
+
provider: 'anthropic',
|
|
542
|
+
displayName: 'Claude Opus 4',
|
|
543
|
+
recommendable: false,
|
|
544
|
+
inputPerMTok: 15,
|
|
545
|
+
outputPerMTok: 75,
|
|
546
|
+
contextWindow: 200_000,
|
|
547
|
+
cacheMinTokens: 1024,
|
|
548
|
+
capability: 'large',
|
|
549
|
+
tier: 'opus',
|
|
550
|
+
notes:
|
|
551
|
+
'Retired on the Claude API on 2026-06-15; still served on Google Cloud (Google managed).'
|
|
552
|
+
+ ' Anthropic names Claude Opus 4.8 as the replacement.',
|
|
553
|
+
},
|
|
467
554
|
{
|
|
468
555
|
/*
|
|
469
556
|
* The pricing page and the Sonnet 5.5 model page, read 2026-10-10. The
|
|
@@ -472,6 +559,7 @@ export const MODELS: ModelPricing[] = [
|
|
|
472
559
|
*/
|
|
473
560
|
id: 'claude-sonnet-5-5',
|
|
474
561
|
provider: 'anthropic',
|
|
562
|
+
inferenceGeoMultipliers: US_ONLY_INFERENCE,
|
|
475
563
|
displayName: 'Claude Sonnet 5.5',
|
|
476
564
|
inputPerMTok: 2,
|
|
477
565
|
outputPerMTok: 10,
|
|
@@ -485,6 +573,7 @@ export const MODELS: ModelPricing[] = [
|
|
|
485
573
|
{
|
|
486
574
|
id: 'claude-sonnet-5',
|
|
487
575
|
provider: 'anthropic',
|
|
576
|
+
inferenceGeoMultipliers: US_ONLY_INFERENCE,
|
|
488
577
|
displayName: 'Claude Sonnet 5',
|
|
489
578
|
inputPerMTok: 2,
|
|
490
579
|
outputPerMTok: 10,
|
|
@@ -499,6 +588,7 @@ export const MODELS: ModelPricing[] = [
|
|
|
499
588
|
{
|
|
500
589
|
id: 'claude-sonnet-4-6',
|
|
501
590
|
provider: 'anthropic',
|
|
591
|
+
inferenceGeoMultipliers: US_ONLY_INFERENCE,
|
|
502
592
|
displayName: 'Claude Sonnet 4.6',
|
|
503
593
|
inputPerMTok: 3,
|
|
504
594
|
outputPerMTok: 15,
|
|
@@ -530,6 +620,30 @@ export const MODELS: ModelPricing[] = [
|
|
|
530
620
|
tier: 'sonnet',
|
|
531
621
|
notes: 'Deprecated; retires 2026-11-30. Recommended replacement: Claude Sonnet 5.5.',
|
|
532
622
|
},
|
|
623
|
+
{
|
|
624
|
+
/*
|
|
625
|
+
* Retired on the Claude API on 2026-06-15 (the deprecations page, read
|
|
626
|
+
* 2026-11-05); still served on Claude Models on Google Cloud (Google
|
|
627
|
+
* managed) and on Bedrock. The pricing page, read the same day: $3/$15,
|
|
628
|
+
* writes $3.75 and $6, cache hits $0.30, batch $1.50/$7.50. 200k context
|
|
629
|
+
* from the context-windows page, a 1,024-token cache minimum from the
|
|
630
|
+
* prompt-caching page. The pricing page publishes one rate for it and no
|
|
631
|
+
* long-context band, so every call is priced at that rate.
|
|
632
|
+
*/
|
|
633
|
+
id: 'claude-sonnet-4-20250514',
|
|
634
|
+
provider: 'anthropic',
|
|
635
|
+
displayName: 'Claude Sonnet 4',
|
|
636
|
+
recommendable: false,
|
|
637
|
+
inputPerMTok: 3,
|
|
638
|
+
outputPerMTok: 15,
|
|
639
|
+
contextWindow: 200_000,
|
|
640
|
+
cacheMinTokens: 1024,
|
|
641
|
+
capability: 'mid',
|
|
642
|
+
tier: 'sonnet',
|
|
643
|
+
notes:
|
|
644
|
+
'Retired on the Claude API on 2026-06-15; still served on Google Cloud (Google managed) and Bedrock.'
|
|
645
|
+
+ ' Anthropic names Claude Sonnet 5.5 as the replacement.',
|
|
646
|
+
},
|
|
533
647
|
{
|
|
534
648
|
/*
|
|
535
649
|
* The pricing page, the models overview and the prompt-caching page, read
|
|
@@ -549,6 +663,7 @@ export const MODELS: ModelPricing[] = [
|
|
|
549
663
|
*/
|
|
550
664
|
id: 'claude-haiku-5-5',
|
|
551
665
|
provider: 'anthropic',
|
|
666
|
+
inferenceGeoMultipliers: US_ONLY_INFERENCE,
|
|
552
667
|
displayName: 'Claude Haiku 5.5',
|
|
553
668
|
inputPerMTok: 0.1,
|
|
554
669
|
outputPerMTok: 0.5,
|
|
@@ -585,6 +700,29 @@ export const MODELS: ModelPricing[] = [
|
|
|
585
700
|
tier: 'haiku',
|
|
586
701
|
notes: '200K context window and a 64K output cap, smaller than the rest.',
|
|
587
702
|
},
|
|
703
|
+
{
|
|
704
|
+
/*
|
|
705
|
+
* Retired on the Claude API on 2026-02-19 (the deprecations page, read
|
|
706
|
+
* 2026-11-05); still served on Claude Models on Google Cloud (Google
|
|
707
|
+
* managed). The pricing page, read the same day: $0.80/$4, writes $1 and
|
|
708
|
+
* $1.60, cache hits $0.08, batch $0.40/$2, the default multipliers. 200k
|
|
709
|
+
* context from the context-windows page, and the prompt-caching page's
|
|
710
|
+
* 2,048-token cache minimum.
|
|
711
|
+
*/
|
|
712
|
+
id: 'claude-3-5-haiku-20241022',
|
|
713
|
+
provider: 'anthropic',
|
|
714
|
+
displayName: 'Claude Haiku 3.5',
|
|
715
|
+
recommendable: false,
|
|
716
|
+
inputPerMTok: 0.8,
|
|
717
|
+
outputPerMTok: 4,
|
|
718
|
+
contextWindow: 200_000,
|
|
719
|
+
cacheMinTokens: 2048,
|
|
720
|
+
capability: 'small',
|
|
721
|
+
tier: 'haiku',
|
|
722
|
+
notes:
|
|
723
|
+
'Retired on the Claude API on 2026-02-19; still served on Google Cloud (Google managed).'
|
|
724
|
+
+ ' Anthropic names Claude Haiku 4.5 as the replacement.',
|
|
725
|
+
},
|
|
588
726
|
|
|
589
727
|
// ------------------------------------------------------------------------
|
|
590
728
|
// OpenAI
|
|
@@ -645,6 +783,11 @@ export const MODELS: ModelPricing[] = [
|
|
|
645
783
|
outputPerMTok: 75,
|
|
646
784
|
},
|
|
647
785
|
],
|
|
786
|
+
serviceTiers: {
|
|
787
|
+
flex: { inputPerMTok: 5, outputPerMTok: 25, tiers: openAiLongBand(10, 37.5) },
|
|
788
|
+
fast: { inputPerMTok: 20, outputPerMTok: 100, tiers: openAiLongBand(40, 150) },
|
|
789
|
+
ultrafast: { inputPerMTok: 60, outputPerMTok: 300, tiers: openAiLongBand(120, 450) },
|
|
790
|
+
},
|
|
648
791
|
capability: 'frontier',
|
|
649
792
|
tier: 'frontier',
|
|
650
793
|
notes: OPENAI_CURRENT_NOTE,
|
|
@@ -668,6 +811,11 @@ export const MODELS: ModelPricing[] = [
|
|
|
668
811
|
outputPerMTok: 15,
|
|
669
812
|
},
|
|
670
813
|
],
|
|
814
|
+
serviceTiers: {
|
|
815
|
+
flex: { inputPerMTok: 1, outputPerMTok: 5, tiers: openAiLongBand(2, 7.5) },
|
|
816
|
+
fast: { inputPerMTok: 4, outputPerMTok: 20, tiers: openAiLongBand(8, 30) },
|
|
817
|
+
ultrafast: { inputPerMTok: 12, outputPerMTok: 60, tiers: openAiLongBand(24, 90) },
|
|
818
|
+
},
|
|
671
819
|
capability: 'large',
|
|
672
820
|
tier: 'opus',
|
|
673
821
|
notes: OPENAI_CURRENT_NOTE,
|
|
@@ -697,6 +845,10 @@ export const MODELS: ModelPricing[] = [
|
|
|
697
845
|
outputPerMTok: 7.5,
|
|
698
846
|
},
|
|
699
847
|
],
|
|
848
|
+
serviceTiers: {
|
|
849
|
+
flex: { inputPerMTok: 0.5, outputPerMTok: 2.5, tiers: openAiLongBand(1, 3.75) },
|
|
850
|
+
fast: { inputPerMTok: 2, outputPerMTok: 10, tiers: openAiLongBand(4, 15) },
|
|
851
|
+
},
|
|
700
852
|
capability: 'mid',
|
|
701
853
|
tier: 'sonnet',
|
|
702
854
|
notes: OPENAI_CURRENT_NOTE,
|
|
@@ -720,6 +872,10 @@ export const MODELS: ModelPricing[] = [
|
|
|
720
872
|
outputPerMTok: 15,
|
|
721
873
|
},
|
|
722
874
|
],
|
|
875
|
+
serviceTiers: {
|
|
876
|
+
flex: { inputPerMTok: 1, outputPerMTok: 5, tiers: openAiLongBand(2, 7.5) },
|
|
877
|
+
fast: { inputPerMTok: 4, outputPerMTok: 20, tiers: openAiLongBand(8, 30) },
|
|
878
|
+
},
|
|
723
879
|
capability: 'large',
|
|
724
880
|
tier: 'opus',
|
|
725
881
|
notes: OPENAI_CURRENT_NOTE,
|
|
@@ -743,12 +899,30 @@ export const MODELS: ModelPricing[] = [
|
|
|
743
899
|
outputPerMTok: 0.75,
|
|
744
900
|
},
|
|
745
901
|
],
|
|
902
|
+
serviceTiers: {
|
|
903
|
+
flex: { inputPerMTok: 0.05, outputPerMTok: 0.25, tiers: openAiLongBand(0.1, 0.375) },
|
|
904
|
+
fast: { inputPerMTok: 0.2, outputPerMTok: 1, tiers: openAiLongBand(0.4, 1.5) },
|
|
905
|
+
},
|
|
746
906
|
capability: 'small',
|
|
747
907
|
tier: 'haiku',
|
|
748
908
|
notes: OPENAI_CURRENT_NOTE,
|
|
749
909
|
},
|
|
750
910
|
{
|
|
911
|
+
/*
|
|
912
|
+
* Its model page, read 2026-11-05: "The `gpt-5.6` alias routes requests
|
|
913
|
+
* to GPT-5.6 Sol", so a log that names the alias is this model; and
|
|
914
|
+
* "$4 per million input tokens and $20 per million output tokens, a 20%
|
|
915
|
+
* reduction in input pricing and a 33% reduction in output pricing ...
|
|
916
|
+
* promotional pricing is available until November 30, 2026". The price
|
|
917
|
+
* after the promotion is not published as a figure, and deriving one
|
|
918
|
+
* from two rounded percentages would be a price nobody quoted, so the row
|
|
919
|
+
* carries what the page charges today. When the page changes,
|
|
920
|
+
* `scripts/price-drift.mjs` reports it on the next weekly run; until a
|
|
921
|
+
* person reads the new figure, a call after 2026-11-30 may be priced low,
|
|
922
|
+
* and the note says so to anyone reading the row.
|
|
923
|
+
*/
|
|
751
924
|
id: 'gpt-5.6-sol',
|
|
925
|
+
aliases: ['gpt-5.6'],
|
|
752
926
|
provider: 'openai',
|
|
753
927
|
displayName: 'GPT-5.6 Sol',
|
|
754
928
|
inputPerMTok: 4,
|
|
@@ -766,9 +940,15 @@ export const MODELS: ModelPricing[] = [
|
|
|
766
940
|
outputPerMTok: 30,
|
|
767
941
|
},
|
|
768
942
|
],
|
|
943
|
+
serviceTiers: {
|
|
944
|
+
flex: { inputPerMTok: 2, outputPerMTok: 10, tiers: openAiLongBand(4, 15) },
|
|
945
|
+
fast: { inputPerMTok: 8, outputPerMTok: 40, tiers: openAiLongBand(16, 60) },
|
|
946
|
+
},
|
|
769
947
|
capability: 'large',
|
|
770
948
|
tier: 'opus',
|
|
771
|
-
notes:
|
|
949
|
+
notes:
|
|
950
|
+
OPENAI_CURRENT_NOTE
|
|
951
|
+
+ ' $4/$20 is promotional until 2026-11-30, and OpenAI has not published the price after it as a figure.',
|
|
772
952
|
},
|
|
773
953
|
{
|
|
774
954
|
id: 'gpt-5.6-terra',
|
|
@@ -789,6 +969,10 @@ export const MODELS: ModelPricing[] = [
|
|
|
789
969
|
outputPerMTok: 18,
|
|
790
970
|
},
|
|
791
971
|
],
|
|
972
|
+
serviceTiers: {
|
|
973
|
+
flex: { inputPerMTok: 1, outputPerMTok: 6, tiers: openAiLongBand(2, 9) },
|
|
974
|
+
fast: { inputPerMTok: 4, outputPerMTok: 24, tiers: openAiLongBand(8, 36) },
|
|
975
|
+
},
|
|
792
976
|
capability: 'mid',
|
|
793
977
|
tier: 'sonnet',
|
|
794
978
|
notes: OPENAI_CURRENT_NOTE,
|
|
@@ -812,56 +996,111 @@ export const MODELS: ModelPricing[] = [
|
|
|
812
996
|
outputPerMTok: 1.8,
|
|
813
997
|
},
|
|
814
998
|
],
|
|
999
|
+
serviceTiers: {
|
|
1000
|
+
flex: { inputPerMTok: 0.1, outputPerMTok: 0.6, tiers: openAiLongBand(0.2, 0.9) },
|
|
1001
|
+
fast: { inputPerMTok: 0.4, outputPerMTok: 2.4, tiers: openAiLongBand(0.8, 3.6) },
|
|
1002
|
+
},
|
|
815
1003
|
capability: 'small',
|
|
816
1004
|
tier: 'haiku',
|
|
817
1005
|
notes: OPENAI_CURRENT_NOTE,
|
|
818
1006
|
},
|
|
1007
|
+
{
|
|
1008
|
+
/*
|
|
1009
|
+
* The pricing page's "Cyber models" table and the model's own page
|
|
1010
|
+
* (developers.openai.com/api/docs/models/gpt-5.6-cyber.md), read
|
|
1011
|
+
* 2026-11-05: $12.50/$75, cached input $1.25, the 30-minute write $15.625
|
|
1012
|
+
* and the 12-hour one $31.25, the same 0.1x, 1.25x and 2.5x as the rest of
|
|
1013
|
+
* GPT-5.6. A 400,000-token context window with at most 272,000 input
|
|
1014
|
+
* tokens, so the long-prompt band the model page mentions can never be
|
|
1015
|
+
* reached and none is modelled; the pricing page lists none either. The
|
|
1016
|
+
* Batch endpoint is "Not supported", so there is no batch price.
|
|
1017
|
+
*
|
|
1018
|
+
* Found by `scripts/price-drift.mjs` on its first run, as a model on the
|
|
1019
|
+
* pricing page that read as unpriced. It needs Daybreak programme
|
|
1020
|
+
* approval, so it is priced for the logs of people who have it and never
|
|
1021
|
+
* recommended to anyone else.
|
|
1022
|
+
*/
|
|
1023
|
+
id: 'gpt-5.6-cyber',
|
|
1024
|
+
provider: 'openai',
|
|
1025
|
+
displayName: 'GPT-5.6 Cyber',
|
|
1026
|
+
recommendable: false,
|
|
1027
|
+
inputPerMTok: 12.5,
|
|
1028
|
+
outputPerMTok: 75,
|
|
1029
|
+
contextWindow: 400_000,
|
|
1030
|
+
cacheMinTokens: 1024,
|
|
1031
|
+
caching: 'automatic',
|
|
1032
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1.25, cacheWrite1h: 2.5, batch: null },
|
|
1033
|
+
cacheTtl: OPENAI_CACHE_TTL,
|
|
1034
|
+
capability: 'large',
|
|
1035
|
+
tier: 'opus',
|
|
1036
|
+
notes:
|
|
1037
|
+
'Needs approval through the Daybreak programme. At most 272,000 input tokens, Responses API only, no batch.'
|
|
1038
|
+
+ ' Cache writes cost 1.25x input for the default 30-minute entry and 2.5x for a 12-hour one.',
|
|
1039
|
+
},
|
|
819
1040
|
|
|
820
1041
|
// ------------------------------------------------------------------------
|
|
1042
|
+
// GPT-5, mini and nano. Each model page, read 2026-11-05, opens with
|
|
1043
|
+
// "Status: Deprecated", and the catalogue still offered all three as
|
|
1044
|
+
// cheaper alternatives, nano as the cheapest OpenAI model there is. Priced
|
|
1045
|
+
// for the logs that hold them; never recommended.
|
|
821
1046
|
{
|
|
822
1047
|
id: 'gpt-5',
|
|
823
1048
|
aliases: ['gpt-5-2025-08-07'],
|
|
824
1049
|
provider: 'openai',
|
|
825
1050
|
displayName: 'GPT-5',
|
|
1051
|
+
recommendable: false,
|
|
826
1052
|
inputPerMTok: 1.25,
|
|
827
1053
|
outputPerMTok: 10,
|
|
828
1054
|
contextWindow: 400_000,
|
|
829
1055
|
cacheMinTokens: 1024,
|
|
830
1056
|
caching: 'automatic',
|
|
831
1057
|
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1058
|
+
serviceTiers: {
|
|
1059
|
+
flex: { inputPerMTok: 0.625, outputPerMTok: 5 },
|
|
1060
|
+
fast: { inputPerMTok: 2.5, outputPerMTok: 20 },
|
|
1061
|
+
},
|
|
832
1062
|
capability: 'frontier',
|
|
833
1063
|
tier: 'frontier',
|
|
834
|
-
notes: OPENAI_GPT5_NOTE,
|
|
1064
|
+
notes: OPENAI_GPT5_NOTE + OPENAI_DEPRECATED_SUFFIX,
|
|
835
1065
|
},
|
|
836
1066
|
{
|
|
837
1067
|
id: 'gpt-5-mini',
|
|
838
1068
|
aliases: ['gpt-5-mini-2025-08-07'],
|
|
839
1069
|
provider: 'openai',
|
|
840
1070
|
displayName: 'GPT-5 mini',
|
|
1071
|
+
recommendable: false,
|
|
841
1072
|
inputPerMTok: 0.25,
|
|
842
1073
|
outputPerMTok: 2,
|
|
843
1074
|
contextWindow: 400_000,
|
|
844
1075
|
cacheMinTokens: 1024,
|
|
845
1076
|
caching: 'automatic',
|
|
846
1077
|
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1078
|
+
serviceTiers: {
|
|
1079
|
+
flex: { inputPerMTok: 0.125, outputPerMTok: 1 },
|
|
1080
|
+
fast: { inputPerMTok: 0.45, outputPerMTok: 3.6 },
|
|
1081
|
+
},
|
|
847
1082
|
capability: 'mid',
|
|
848
1083
|
tier: 'sonnet',
|
|
849
|
-
notes: OPENAI_GPT5_NOTE,
|
|
1084
|
+
notes: OPENAI_GPT5_NOTE + OPENAI_DEPRECATED_SUFFIX,
|
|
850
1085
|
},
|
|
851
1086
|
{
|
|
852
1087
|
id: 'gpt-5-nano',
|
|
853
1088
|
aliases: ['gpt-5-nano-2025-08-07'],
|
|
854
1089
|
provider: 'openai',
|
|
855
1090
|
displayName: 'GPT-5 nano',
|
|
1091
|
+
recommendable: false,
|
|
856
1092
|
inputPerMTok: 0.05,
|
|
857
1093
|
outputPerMTok: 0.4,
|
|
858
1094
|
contextWindow: 400_000,
|
|
859
1095
|
cacheMinTokens: 1024,
|
|
860
1096
|
caching: 'automatic',
|
|
861
1097
|
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1098
|
+
serviceTiers: {
|
|
1099
|
+
flex: { inputPerMTok: 0.025, outputPerMTok: 0.2 },
|
|
1100
|
+
},
|
|
862
1101
|
capability: 'small',
|
|
863
1102
|
tier: 'haiku',
|
|
864
|
-
notes: OPENAI_GPT5_NOTE,
|
|
1103
|
+
notes: OPENAI_GPT5_NOTE + OPENAI_DEPRECATED_SUFFIX,
|
|
865
1104
|
},
|
|
866
1105
|
|
|
867
1106
|
// ------------------------------------------------------------------------
|
|
@@ -899,6 +1138,10 @@ export const MODELS: ModelPricing[] = [
|
|
|
899
1138
|
outputPerMTok: 45,
|
|
900
1139
|
},
|
|
901
1140
|
],
|
|
1141
|
+
serviceTiers: {
|
|
1142
|
+
flex: { inputPerMTok: 2.5, outputPerMTok: 15, tiers: openAiLongBand(5, 22.5) },
|
|
1143
|
+
fast: { inputPerMTok: 12.5, outputPerMTok: 75 },
|
|
1144
|
+
},
|
|
902
1145
|
capability: 'frontier',
|
|
903
1146
|
tier: 'frontier',
|
|
904
1147
|
notes: OPENAI_EARLIER_LONG_NOTE,
|
|
@@ -922,6 +1165,9 @@ export const MODELS: ModelPricing[] = [
|
|
|
922
1165
|
outputPerMTok: 270,
|
|
923
1166
|
},
|
|
924
1167
|
],
|
|
1168
|
+
serviceTiers: {
|
|
1169
|
+
flex: { inputPerMTok: 15, outputPerMTok: 90 },
|
|
1170
|
+
},
|
|
925
1171
|
capability: 'frontier',
|
|
926
1172
|
tier: 'frontier',
|
|
927
1173
|
notes: OPENAI_EARLIER_LONG_NOTE,
|
|
@@ -945,6 +1191,10 @@ export const MODELS: ModelPricing[] = [
|
|
|
945
1191
|
outputPerMTok: 22.5,
|
|
946
1192
|
},
|
|
947
1193
|
],
|
|
1194
|
+
serviceTiers: {
|
|
1195
|
+
flex: { inputPerMTok: 1.25, outputPerMTok: 7.5, tiers: openAiLongBand(2.5, 11.25) },
|
|
1196
|
+
fast: { inputPerMTok: 5, outputPerMTok: 30 },
|
|
1197
|
+
},
|
|
948
1198
|
capability: 'frontier',
|
|
949
1199
|
tier: 'frontier',
|
|
950
1200
|
notes: OPENAI_EARLIER_LONG_NOTE,
|
|
@@ -968,6 +1218,9 @@ export const MODELS: ModelPricing[] = [
|
|
|
968
1218
|
outputPerMTok: 270,
|
|
969
1219
|
},
|
|
970
1220
|
],
|
|
1221
|
+
serviceTiers: {
|
|
1222
|
+
flex: { inputPerMTok: 15, outputPerMTok: 90, tiers: openAiLongBand(30, 135) },
|
|
1223
|
+
},
|
|
971
1224
|
capability: 'frontier',
|
|
972
1225
|
tier: 'frontier',
|
|
973
1226
|
notes: OPENAI_EARLIER_LONG_NOTE,
|
|
@@ -983,6 +1236,10 @@ export const MODELS: ModelPricing[] = [
|
|
|
983
1236
|
cacheMinTokens: 1024,
|
|
984
1237
|
caching: 'automatic',
|
|
985
1238
|
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1239
|
+
serviceTiers: {
|
|
1240
|
+
flex: { inputPerMTok: 0.375, outputPerMTok: 2.25 },
|
|
1241
|
+
fast: { inputPerMTok: 1.5, outputPerMTok: 9 },
|
|
1242
|
+
},
|
|
986
1243
|
capability: 'mid',
|
|
987
1244
|
tier: 'sonnet',
|
|
988
1245
|
notes: OPENAI_EARLIER_NOTE,
|
|
@@ -999,6 +1256,9 @@ export const MODELS: ModelPricing[] = [
|
|
|
999
1256
|
cacheMinTokens: 1024,
|
|
1000
1257
|
caching: 'automatic',
|
|
1001
1258
|
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1259
|
+
serviceTiers: {
|
|
1260
|
+
flex: { inputPerMTok: 0.1, outputPerMTok: 0.625 },
|
|
1261
|
+
},
|
|
1002
1262
|
capability: 'small',
|
|
1003
1263
|
tier: 'haiku',
|
|
1004
1264
|
notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
|
|
@@ -1014,6 +1274,10 @@ export const MODELS: ModelPricing[] = [
|
|
|
1014
1274
|
cacheMinTokens: 1024,
|
|
1015
1275
|
caching: 'automatic',
|
|
1016
1276
|
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1277
|
+
serviceTiers: {
|
|
1278
|
+
flex: { inputPerMTok: 0.875, outputPerMTok: 7 },
|
|
1279
|
+
fast: { inputPerMTok: 3.5, outputPerMTok: 28 },
|
|
1280
|
+
},
|
|
1017
1281
|
capability: 'frontier',
|
|
1018
1282
|
tier: 'frontier',
|
|
1019
1283
|
notes: OPENAI_EARLIER_NOTE,
|
|
@@ -1045,6 +1309,10 @@ export const MODELS: ModelPricing[] = [
|
|
|
1045
1309
|
cacheMinTokens: 1024,
|
|
1046
1310
|
caching: 'automatic',
|
|
1047
1311
|
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1312
|
+
serviceTiers: {
|
|
1313
|
+
flex: { inputPerMTok: 0.625, outputPerMTok: 5 },
|
|
1314
|
+
fast: { inputPerMTok: 2.5, outputPerMTok: 20 },
|
|
1315
|
+
},
|
|
1048
1316
|
capability: 'frontier',
|
|
1049
1317
|
tier: 'frontier',
|
|
1050
1318
|
notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
|
|
@@ -1077,6 +1345,9 @@ export const MODELS: ModelPricing[] = [
|
|
|
1077
1345
|
cacheMinTokens: 1024,
|
|
1078
1346
|
caching: 'automatic',
|
|
1079
1347
|
multipliers: { cacheRead: 0.25, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1348
|
+
serviceTiers: {
|
|
1349
|
+
fast: { inputPerMTok: 3.5, outputPerMTok: 14 },
|
|
1350
|
+
},
|
|
1080
1351
|
capability: 'large',
|
|
1081
1352
|
tier: 'opus',
|
|
1082
1353
|
notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
|
|
@@ -1093,6 +1364,9 @@ export const MODELS: ModelPricing[] = [
|
|
|
1093
1364
|
cacheMinTokens: 1024,
|
|
1094
1365
|
caching: 'automatic',
|
|
1095
1366
|
multipliers: { cacheRead: 0.25, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1367
|
+
serviceTiers: {
|
|
1368
|
+
fast: { inputPerMTok: 0.7, outputPerMTok: 2.8 },
|
|
1369
|
+
},
|
|
1096
1370
|
capability: 'mid',
|
|
1097
1371
|
tier: 'sonnet',
|
|
1098
1372
|
notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
|
|
@@ -1109,6 +1383,9 @@ export const MODELS: ModelPricing[] = [
|
|
|
1109
1383
|
cacheMinTokens: 1024,
|
|
1110
1384
|
caching: 'automatic',
|
|
1111
1385
|
multipliers: { cacheRead: 0.5, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1386
|
+
serviceTiers: {
|
|
1387
|
+
fast: { inputPerMTok: 4.25, outputPerMTok: 17 },
|
|
1388
|
+
},
|
|
1112
1389
|
capability: 'large',
|
|
1113
1390
|
tier: 'opus',
|
|
1114
1391
|
notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
|
|
@@ -1125,6 +1402,9 @@ export const MODELS: ModelPricing[] = [
|
|
|
1125
1402
|
cacheMinTokens: 1024,
|
|
1126
1403
|
caching: 'automatic',
|
|
1127
1404
|
multipliers: { cacheRead: 0.5, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1405
|
+
serviceTiers: {
|
|
1406
|
+
fast: { inputPerMTok: 0.25, outputPerMTok: 1 },
|
|
1407
|
+
},
|
|
1128
1408
|
capability: 'small',
|
|
1129
1409
|
tier: 'haiku',
|
|
1130
1410
|
notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
|
|
@@ -1141,6 +1421,10 @@ export const MODELS: ModelPricing[] = [
|
|
|
1141
1421
|
cacheMinTokens: 1024,
|
|
1142
1422
|
caching: 'automatic',
|
|
1143
1423
|
multipliers: { cacheRead: 0.25, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1424
|
+
serviceTiers: {
|
|
1425
|
+
flex: { inputPerMTok: 1, outputPerMTok: 4 },
|
|
1426
|
+
fast: { inputPerMTok: 3.5, outputPerMTok: 14 },
|
|
1427
|
+
},
|
|
1144
1428
|
capability: 'frontier',
|
|
1145
1429
|
tier: 'frontier',
|
|
1146
1430
|
notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
|
|
@@ -1161,6 +1445,143 @@ export const MODELS: ModelPricing[] = [
|
|
|
1161
1445
|
tier: 'frontier',
|
|
1162
1446
|
notes: OPENAI_EARLIER_NO_CACHE_NOTE + OPENAI_DEPRECATED_SUFFIX,
|
|
1163
1447
|
},
|
|
1448
|
+
// ------------------------------------------------------------------------
|
|
1449
|
+
// The Codex models and chat-latest. Codex CLI sessions name these, and none
|
|
1450
|
+
// was priced, so every such call read as unpriced. Each from its own model
|
|
1451
|
+
// page (developers.openai.com/api/docs/models/<id>.md), read 2026-11-05,
|
|
1452
|
+
// and gpt-5.3-codex and chat-latest also from the pricing page's
|
|
1453
|
+
// "Specialized models" table. Every page says Batch is "Not supported", so
|
|
1454
|
+
// none has a batch price. gpt-5.3-codex is deprecated and the rest of the
|
|
1455
|
+
// Codex line is shut down; all are priced for the logs that hold them and
|
|
1456
|
+
// never recommended. chat-latest is served and not recommended either: it
|
|
1457
|
+
// points at whatever model ChatGPT uses, so a recommendation would not name
|
|
1458
|
+
// a fixed model. Cache reads are 0.1x everywhere but codex-mini-latest,
|
|
1459
|
+
// whose page gives $0.375 on $1.50, 0.25x. gpt-5-search-api is on the
|
|
1460
|
+
// pricing page too and its model page returns 404, so it has no context
|
|
1461
|
+
// window and is left unpriced (see scripts/price-drift.mjs).
|
|
1462
|
+
// ------------------------------------------------------------------------
|
|
1463
|
+
{
|
|
1464
|
+
id: 'gpt-5.3-codex',
|
|
1465
|
+
provider: 'openai',
|
|
1466
|
+
displayName: 'GPT-5.3-Codex',
|
|
1467
|
+
recommendable: false,
|
|
1468
|
+
inputPerMTok: 1.75,
|
|
1469
|
+
outputPerMTok: 14,
|
|
1470
|
+
contextWindow: 400_000,
|
|
1471
|
+
cacheMinTokens: 1024,
|
|
1472
|
+
caching: 'automatic',
|
|
1473
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
|
|
1474
|
+
// The pricing page's specialized "Fast" table: $3.50/$28, cached $0.35.
|
|
1475
|
+
serviceTiers: { fast: { inputPerMTok: 3.5, outputPerMTok: 28 } },
|
|
1476
|
+
capability: 'frontier',
|
|
1477
|
+
tier: 'frontier',
|
|
1478
|
+
notes: OPENAI_CODEX_NOTE + ' At most 272,000 input tokens.' + OPENAI_DEPRECATED_SUFFIX,
|
|
1479
|
+
},
|
|
1480
|
+
{
|
|
1481
|
+
id: 'gpt-5.2-codex',
|
|
1482
|
+
provider: 'openai',
|
|
1483
|
+
displayName: 'GPT-5.2-Codex',
|
|
1484
|
+
recommendable: false,
|
|
1485
|
+
inputPerMTok: 1.75,
|
|
1486
|
+
outputPerMTok: 14,
|
|
1487
|
+
contextWindow: 400_000,
|
|
1488
|
+
cacheMinTokens: 1024,
|
|
1489
|
+
caching: 'automatic',
|
|
1490
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
|
|
1491
|
+
capability: 'frontier',
|
|
1492
|
+
tier: 'frontier',
|
|
1493
|
+
notes: OPENAI_CODEX_NOTE + ' At most 272,000 input tokens.' + OPENAI_SHUT_DOWN_SUFFIX,
|
|
1494
|
+
},
|
|
1495
|
+
{
|
|
1496
|
+
id: 'gpt-5.1-codex',
|
|
1497
|
+
provider: 'openai',
|
|
1498
|
+
displayName: 'GPT-5.1-Codex',
|
|
1499
|
+
recommendable: false,
|
|
1500
|
+
inputPerMTok: 1.25,
|
|
1501
|
+
outputPerMTok: 10,
|
|
1502
|
+
contextWindow: 400_000,
|
|
1503
|
+
cacheMinTokens: 1024,
|
|
1504
|
+
caching: 'automatic',
|
|
1505
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
|
|
1506
|
+
capability: 'frontier',
|
|
1507
|
+
tier: 'frontier',
|
|
1508
|
+
notes: OPENAI_CODEX_NOTE + OPENAI_SHUT_DOWN_SUFFIX,
|
|
1509
|
+
},
|
|
1510
|
+
{
|
|
1511
|
+
id: 'gpt-5.1-codex-max',
|
|
1512
|
+
provider: 'openai',
|
|
1513
|
+
displayName: 'GPT-5.1-Codex-Max',
|
|
1514
|
+
recommendable: false,
|
|
1515
|
+
inputPerMTok: 1.25,
|
|
1516
|
+
outputPerMTok: 10,
|
|
1517
|
+
contextWindow: 400_000,
|
|
1518
|
+
cacheMinTokens: 1024,
|
|
1519
|
+
caching: 'automatic',
|
|
1520
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
|
|
1521
|
+
capability: 'frontier',
|
|
1522
|
+
tier: 'frontier',
|
|
1523
|
+
notes: OPENAI_CODEX_NOTE + OPENAI_SHUT_DOWN_SUFFIX,
|
|
1524
|
+
},
|
|
1525
|
+
{
|
|
1526
|
+
id: 'gpt-5.1-codex-mini',
|
|
1527
|
+
provider: 'openai',
|
|
1528
|
+
displayName: 'GPT-5.1-Codex Mini',
|
|
1529
|
+
recommendable: false,
|
|
1530
|
+
inputPerMTok: 0.25,
|
|
1531
|
+
outputPerMTok: 2,
|
|
1532
|
+
contextWindow: 400_000,
|
|
1533
|
+
cacheMinTokens: 1024,
|
|
1534
|
+
caching: 'automatic',
|
|
1535
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
|
|
1536
|
+
capability: 'mid',
|
|
1537
|
+
tier: 'sonnet',
|
|
1538
|
+
notes: OPENAI_CODEX_NOTE + OPENAI_SHUT_DOWN_SUFFIX,
|
|
1539
|
+
},
|
|
1540
|
+
{
|
|
1541
|
+
id: 'gpt-5-codex',
|
|
1542
|
+
provider: 'openai',
|
|
1543
|
+
displayName: 'GPT-5-Codex',
|
|
1544
|
+
recommendable: false,
|
|
1545
|
+
inputPerMTok: 1.25,
|
|
1546
|
+
outputPerMTok: 10,
|
|
1547
|
+
contextWindow: 400_000,
|
|
1548
|
+
cacheMinTokens: 1024,
|
|
1549
|
+
caching: 'automatic',
|
|
1550
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
|
|
1551
|
+
capability: 'frontier',
|
|
1552
|
+
tier: 'frontier',
|
|
1553
|
+
notes: OPENAI_CODEX_NOTE + ' At most 272,000 input tokens.' + OPENAI_SHUT_DOWN_SUFFIX,
|
|
1554
|
+
},
|
|
1555
|
+
{
|
|
1556
|
+
id: 'codex-mini-latest',
|
|
1557
|
+
provider: 'openai',
|
|
1558
|
+
displayName: 'codex-mini-latest',
|
|
1559
|
+
recommendable: false,
|
|
1560
|
+
inputPerMTok: 1.5,
|
|
1561
|
+
outputPerMTok: 6,
|
|
1562
|
+
contextWindow: 200_000,
|
|
1563
|
+
cacheMinTokens: 1024,
|
|
1564
|
+
caching: 'automatic',
|
|
1565
|
+
multipliers: { cacheRead: 0.25, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
|
|
1566
|
+
capability: 'mid',
|
|
1567
|
+
tier: 'sonnet',
|
|
1568
|
+
notes: OPENAI_CODEX_NOTE + ' A cache read costs 0.25x input.' + OPENAI_SHUT_DOWN_SUFFIX,
|
|
1569
|
+
},
|
|
1570
|
+
{
|
|
1571
|
+
id: 'chat-latest',
|
|
1572
|
+
provider: 'openai',
|
|
1573
|
+
displayName: 'Chat Latest',
|
|
1574
|
+
recommendable: false,
|
|
1575
|
+
inputPerMTok: 5,
|
|
1576
|
+
outputPerMTok: 30,
|
|
1577
|
+
contextWindow: 400_000,
|
|
1578
|
+
cacheMinTokens: 1024,
|
|
1579
|
+
caching: 'automatic',
|
|
1580
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
|
|
1581
|
+
capability: 'large',
|
|
1582
|
+
tier: 'opus',
|
|
1583
|
+
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.',
|
|
1584
|
+
},
|
|
1164
1585
|
|
|
1165
1586
|
// ------------------------------------------------------------------------
|
|
1166
1587
|
// Google
|
|
@@ -2042,6 +2463,10 @@ interface Rates {
|
|
|
2042
2463
|
*/
|
|
2043
2464
|
floor?: { inputPerMTok: number; outputPerMTok: number };
|
|
2044
2465
|
} | null;
|
|
2466
|
+
/** The service tier whose table priced the call, when it was not the standard one. */
|
|
2467
|
+
serviceTier?: ServiceTier;
|
|
2468
|
+
/** The geography whose published multiplier priced the call, when it was not global. */
|
|
2469
|
+
inferenceGeo?: InferenceGeo;
|
|
2045
2470
|
}
|
|
2046
2471
|
|
|
2047
2472
|
/**
|
|
@@ -2064,6 +2489,81 @@ export interface PromptSize {
|
|
|
2064
2489
|
inputTokensAtMost?: number;
|
|
2065
2490
|
/** The response's `usage.speed`, when the log kept it: `"fast"` or `"standard"`. */
|
|
2066
2491
|
speed?: string;
|
|
2492
|
+
/**
|
|
2493
|
+
* The response's `service_tier`, when the log kept it: OpenAI's `"flex"`,
|
|
2494
|
+
* `"priority"` or `"fast"`, `"ultrafast"`, or `"default"`. Normalised by
|
|
2495
|
+
* `serviceTierOf`; anything else prices at the standard rate.
|
|
2496
|
+
*/
|
|
2497
|
+
serviceTier?: string;
|
|
2498
|
+
/**
|
|
2499
|
+
* The response's `usage.inference_geo`, when the log kept it: Anthropic's
|
|
2500
|
+
* `"us"`, `"global"` or `"not_available"`. Normalised by `inferenceGeoOf`;
|
|
2501
|
+
* only a geography the row publishes a multiplier for changes the price.
|
|
2502
|
+
*/
|
|
2503
|
+
inferenceGeo?: string;
|
|
2504
|
+
}
|
|
2505
|
+
|
|
2506
|
+
/**
|
|
2507
|
+
* A response's `usage.inference_geo` as the geography that prices it, or
|
|
2508
|
+
* `undefined` for the global rate. `"global"` is the default and the row's
|
|
2509
|
+
* own price; `"not_available"` is what a model that cannot pin a geography
|
|
2510
|
+
* reports, and is priced the same.
|
|
2511
|
+
*/
|
|
2512
|
+
export function inferenceGeoOf(value: unknown): InferenceGeo | undefined {
|
|
2513
|
+
if (typeof value !== 'string') return undefined;
|
|
2514
|
+
return value.trim().toLowerCase() === 'us' ? 'us' : undefined;
|
|
2515
|
+
}
|
|
2516
|
+
|
|
2517
|
+
/** Rounded to a billionth of a dollar per million tokens, so 1.1x of $5 is $5.5 and not $5.500000000000001. */
|
|
2518
|
+
const scaled = (rate: number, factor: number): number => Math.round(rate * factor * 1e9) / 1e9;
|
|
2519
|
+
|
|
2520
|
+
/**
|
|
2521
|
+
* A response's `service_tier` as the tier whose table prices it, or
|
|
2522
|
+
* `undefined` for the standard one.
|
|
2523
|
+
*
|
|
2524
|
+
* OpenAI renamed Priority processing to Fast mode on 2026-07-30, and its guide
|
|
2525
|
+
* says "for GPT-5.6 and earlier models, the response returns `priority`
|
|
2526
|
+
* whether the request specifies `priority` or `fast`", so both spellings are
|
|
2527
|
+
* the Fast table. `"default"` is the standard tier, and is also what a Fast
|
|
2528
|
+
* request downgraded under the ramp-rate limit returns, "and charge standard
|
|
2529
|
+
* rates". `"auto"` and `"scale"`, or a value this table has never seen, are
|
|
2530
|
+
* priced at the standard rate rather than guessed into another tier.
|
|
2531
|
+
*/
|
|
2532
|
+
export function serviceTierOf(value: unknown): ServiceTier | undefined {
|
|
2533
|
+
if (typeof value !== 'string') return undefined;
|
|
2534
|
+
const tier = value.trim().toLowerCase();
|
|
2535
|
+
if (tier === 'flex') return 'flex';
|
|
2536
|
+
if (tier === 'fast' || tier === 'priority') return 'fast';
|
|
2537
|
+
if (tier === 'ultrafast') return 'ultrafast';
|
|
2538
|
+
return undefined;
|
|
2539
|
+
}
|
|
2540
|
+
|
|
2541
|
+
/**
|
|
2542
|
+
* The row as one service tier prices it: that tier's rates and long band, the
|
|
2543
|
+
* row's own cache and batch ratios. Built once per row and tier.
|
|
2544
|
+
*/
|
|
2545
|
+
const serviceTierMemo = new WeakMap<ModelPricing, Map<ServiceTier, ModelPricing>>();
|
|
2546
|
+
|
|
2547
|
+
function serviceTierRow(model: ModelPricing, tier: ServiceTier): ModelPricing | undefined {
|
|
2548
|
+
const sheet = model.serviceTiers?.[tier];
|
|
2549
|
+
if (sheet === undefined) return undefined;
|
|
2550
|
+
let rows = serviceTierMemo.get(model);
|
|
2551
|
+
if (rows === undefined) {
|
|
2552
|
+
rows = new Map();
|
|
2553
|
+
serviceTierMemo.set(model, rows);
|
|
2554
|
+
}
|
|
2555
|
+
let row = rows.get(tier);
|
|
2556
|
+
if (row === undefined) {
|
|
2557
|
+
const { history: _history, promo: _promo, tiers: _tiers, serviceTiers: _serviceTiers, ...rest } = model;
|
|
2558
|
+
row = Object.freeze({
|
|
2559
|
+
...rest,
|
|
2560
|
+
inputPerMTok: sheet.inputPerMTok,
|
|
2561
|
+
outputPerMTok: sheet.outputPerMTok,
|
|
2562
|
+
...(sheet.tiers !== undefined ? { tiers: sheet.tiers } : {}),
|
|
2563
|
+
});
|
|
2564
|
+
rows.set(tier, row);
|
|
2565
|
+
}
|
|
2566
|
+
return row;
|
|
2067
2567
|
}
|
|
2068
2568
|
|
|
2069
2569
|
const pricingMemo = new WeakMap<
|
|
@@ -2084,7 +2584,8 @@ function pricedAt(model: ModelPricing, on: Date): ModelPricing {
|
|
|
2084
2584
|
let periods = periodMemo.get(model);
|
|
2085
2585
|
if (periods === undefined) {
|
|
2086
2586
|
periods = history.map((period) => {
|
|
2087
|
-
|
|
2587
|
+
// A period's own price only: the service tiers below are today's tables.
|
|
2588
|
+
const { history: _history, promo: _promo, tiers: _tiers, multipliers: _multipliers, serviceTiers: _serviceTiers, ...rest } = model;
|
|
2088
2589
|
const row: ModelPricing = Object.freeze({
|
|
2089
2590
|
...rest,
|
|
2090
2591
|
inputPerMTok: period.inputPerMTok,
|
|
@@ -2176,11 +2677,52 @@ export function effectivePricing(
|
|
|
2176
2677
|
on: Date = new Date(),
|
|
2177
2678
|
context: PromptSize = {},
|
|
2178
2679
|
): Rates {
|
|
2680
|
+
/*
|
|
2681
|
+
* A geography with a published multiplier scales whatever the rest of the
|
|
2682
|
+
* call decides, fast mode and the long band included, because the page says
|
|
2683
|
+
* it stacks with all of them. Applied once, outside everything else.
|
|
2684
|
+
*/
|
|
2685
|
+
if (context.inferenceGeo !== undefined) {
|
|
2686
|
+
const { inferenceGeo, ...rest } = context;
|
|
2687
|
+
const rates = effectivePricing(model, on, rest);
|
|
2688
|
+
const geo = inferenceGeoOf(inferenceGeo);
|
|
2689
|
+
const factor = geo === undefined ? undefined : model.inferenceGeoMultipliers?.[geo];
|
|
2690
|
+
if (geo === undefined || factor === undefined) return rates;
|
|
2691
|
+
return {
|
|
2692
|
+
...rates,
|
|
2693
|
+
inputPerMTok: scaled(rates.inputPerMTok, factor),
|
|
2694
|
+
outputPerMTok: scaled(rates.outputPerMTok, factor),
|
|
2695
|
+
...(rates.tier?.floor !== undefined
|
|
2696
|
+
? {
|
|
2697
|
+
tier: {
|
|
2698
|
+
...rates.tier,
|
|
2699
|
+
floor: {
|
|
2700
|
+
inputPerMTok: scaled(rates.tier.floor.inputPerMTok, factor),
|
|
2701
|
+
outputPerMTok: scaled(rates.tier.floor.outputPerMTok, factor),
|
|
2702
|
+
},
|
|
2703
|
+
},
|
|
2704
|
+
}
|
|
2705
|
+
: {}),
|
|
2706
|
+
inferenceGeo: geo,
|
|
2707
|
+
};
|
|
2708
|
+
}
|
|
2179
2709
|
/* A call before a published price change is priced as it was billed then. */
|
|
2180
2710
|
if (model.history !== undefined) {
|
|
2181
2711
|
const period = pricedAt(model, on);
|
|
2182
2712
|
if (period !== model) return effectivePricing(period, on, context);
|
|
2183
2713
|
}
|
|
2714
|
+
/*
|
|
2715
|
+
* A response that names another service tier is priced by that tier's own
|
|
2716
|
+
* table, long band included, and by nothing composed out of two.
|
|
2717
|
+
*/
|
|
2718
|
+
if (context.serviceTier !== undefined && model.serviceTiers !== undefined) {
|
|
2719
|
+
const named = serviceTierOf(context.serviceTier);
|
|
2720
|
+
const row = named === undefined ? undefined : serviceTierRow(model, named);
|
|
2721
|
+
if (row !== undefined) {
|
|
2722
|
+
const { serviceTier: _serviceTier, ...size } = context;
|
|
2723
|
+
return { ...effectivePricing(row, on, size), serviceTier: named };
|
|
2724
|
+
}
|
|
2725
|
+
}
|
|
2184
2726
|
const memo = pricingMemo.get(model) ?? cache(model);
|
|
2185
2727
|
|
|
2186
2728
|
/**
|