@trazum/core 2.7.0 → 2.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/billing.d.ts.map +1 -1
- package/dist/billing.js +5 -1
- 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 +6 -0
- package/dist/claude-code.js.map +1 -1
- package/dist/gateway.d.ts +16 -0
- package/dist/gateway.d.ts.map +1 -1
- package/dist/gateway.js +61 -6
- package/dist/gateway.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/pricing.d.ts +24 -1
- package/dist/pricing.d.ts.map +1 -1
- package/dist/pricing.js +960 -27
- package/dist/pricing.js.map +1 -1
- package/dist/slim-line.d.ts +37 -0
- package/dist/slim-line.d.ts.map +1 -0
- package/dist/slim-line.js +68 -0
- package/dist/slim-line.js.map +1 -0
- package/dist/types.d.ts +53 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/usage.d.ts +23 -0
- package/dist/usage.d.ts.map +1 -1
- package/dist/usage.js +57 -5
- package/dist/usage.js.map +1 -1
- package/package.json +1 -1
- package/src/billing.ts +5 -1
- package/src/claude-code.ts +8 -0
- package/src/gateway.ts +73 -6
- package/src/index.ts +4 -0
- package/src/pricing.ts +981 -28
- package/src/slim-line.ts +66 -0
- package/src/types.ts +53 -1
- package/src/usage.ts +82 -5
package/src/pricing.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ModelPricing, PricingTier, TierCondition } from './types.js';
|
|
1
|
+
import type { ModelPricing, PricingTier, ServiceTier, TierCondition } from './types.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Model and pricing catalogue (USD per million tokens).
|
|
@@ -35,8 +35,20 @@ export const PROVIDER_REVIEWED: Readonly<Record<string, string>> = Object.freeze
|
|
|
35
35
|
* each model's own page, read 2026-10-10. Every existing row matched and
|
|
36
36
|
* five models were added. Claude Haiku 5.5 waited for per-request pricing,
|
|
37
37
|
* because it bills by prompt length, and was added with it on 2026-10-11.
|
|
38
|
+
*
|
|
39
|
+
* Re-read 2026-11-05 with the fast-mode, deprecations and prompt-caching
|
|
40
|
+
* pages. Every existing price matched. Two things were missing: fast mode,
|
|
41
|
+
* which bills Opus 5.5 at $8/$40 and Opus 5 and 4.8 at $10/$50 and which
|
|
42
|
+
* every response records in `usage.speed`, so fast calls had been priced at
|
|
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. 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.
|
|
38
50
|
*/
|
|
39
|
-
anthropic: '2026-
|
|
51
|
+
anthropic: '2026-11-05',
|
|
40
52
|
/*
|
|
41
53
|
* developers.openai.com/api/docs/pricing, read 2026-08-31.
|
|
42
54
|
*
|
|
@@ -57,8 +69,16 @@ export const PROVIDER_REVIEWED: Readonly<Record<string, string>> = Object.freeze
|
|
|
57
69
|
* gpt-6-sol, gpt-6-luna and gpt-5.6 sol, terra and luna) waited for
|
|
58
70
|
* per-request pricing, since each doubles its rates for prompts over 272K
|
|
59
71
|
* tokens, and was added with it the same day, from each model's own page.
|
|
72
|
+
*
|
|
73
|
+
* Re-read 2026-11-05: pricing.md, prompt-caching.md and every model page
|
|
74
|
+
* named below, in their Markdown form. Every existing price matched. New:
|
|
75
|
+
* GPT-6.1 Terra; a 12-hour cache write at 2.5x input on GPT-5.6 and later,
|
|
76
|
+
* which the usage object splits from the 30-minute kind and which was being
|
|
77
|
+
* priced as one, at half its cost; and sixteen earlier models that are still
|
|
78
|
+
* billed and still in logs (GPT-5.5, 5.4, 5.2, 5.1 and their mini, nano and
|
|
79
|
+
* pro siblings, GPT-5 pro, GPT-4.1, GPT-4o and o3), none of which was priced.
|
|
60
80
|
*/
|
|
61
|
-
openai: '2026-
|
|
81
|
+
openai: '2026-11-05',
|
|
62
82
|
/*
|
|
63
83
|
* ai.google.dev/gemini-api/docs/pricing, docs/caching and the model pages,
|
|
64
84
|
* read 2026-10-10. Every price matched; what changed is how caching starts
|
|
@@ -78,8 +98,14 @@ export const PROVIDER_REVIEWED: Readonly<Record<string, string>> = Object.freeze
|
|
|
78
98
|
* and added nothing. Kimi K3, K2.7 Code (and its high-speed variant) and
|
|
79
99
|
* K2.6 are priced now. `kimi-k2` was discontinued on 2026-05-25 by the
|
|
80
100
|
* provider's own notice, so it stays priced and is no longer recommended.
|
|
101
|
+
*
|
|
102
|
+
* Re-read 2026-11-05 from the HTML page's compiled tables, the Markdown
|
|
103
|
+
* form now serving them empty. Every price matched; K3.1 Pro and its
|
|
104
|
+
* high-speed variant are added, K3 gains its 60% batch price, and the K2
|
|
105
|
+
* series, closed to new accounts and retiring in December, is no longer
|
|
106
|
+
* recommended.
|
|
81
107
|
*/
|
|
82
|
-
moonshot: '2026-
|
|
108
|
+
moonshot: '2026-11-05',
|
|
83
109
|
/*
|
|
84
110
|
* api-docs.deepseek.com/quick_start/pricing read 2026-10-10, and the
|
|
85
111
|
* 2026-09-10 announcement (api-docs.deepseek.com/news/news260910) read
|
|
@@ -87,8 +113,13 @@ export const PROVIDER_REVIEWED: Readonly<Record<string, string>> = Object.freeze
|
|
|
87
113
|
* Sept 10, 2026." V4 Flash was retired that day and its id now bills at
|
|
88
114
|
* the new deepseek-flash price, so the old price lives in its `history`.
|
|
89
115
|
* V4 Pro matched the page unchanged.
|
|
116
|
+
*
|
|
117
|
+
* Re-read 2026-11-05: every price, the peak window (01:00-04:00 and
|
|
118
|
+
* 06:00-10:00 UTC, Monday to Friday, Chinese public holidays off-peak in
|
|
119
|
+
* full) and the cache-hit prices matched. The Flash version behind
|
|
120
|
+
* `deepseek-flash` is now named DeepSeek-V4.1-Flash-1017, at the same price.
|
|
90
121
|
*/
|
|
91
|
-
deepseek: '2026-
|
|
122
|
+
deepseek: '2026-11-05',
|
|
92
123
|
/*
|
|
93
124
|
* docs.x.ai/developers/models, each model's page and the 2026-05-15
|
|
94
125
|
* retirement notice, read 2026-10-11 in their Markdown form. Grok 4.7, 4.6,
|
|
@@ -96,8 +127,11 @@ export const PROVIDER_REVIEWED: Readonly<Record<string, string>> = Object.freeze
|
|
|
96
127
|
* request pays once its prompt reaches 200k tokens, which per-request
|
|
97
128
|
* pricing can now express. `grok-4` was retired on 2026-05-15 and its calls
|
|
98
129
|
* have billed at Grok 4.3's prices since, so it carries both periods.
|
|
130
|
+
*
|
|
131
|
+
* Re-read 2026-11-05 (docs.x.ai/developers/models.md): every model, price,
|
|
132
|
+
* cached price, 200k threshold and context window matched. Nothing new.
|
|
99
133
|
*/
|
|
100
|
-
xai: '2026-
|
|
134
|
+
xai: '2026-11-05',
|
|
101
135
|
/*
|
|
102
136
|
* `mistral.ai/pricing`, read 2026-08-28 — by a human, because the page
|
|
103
137
|
* renders its table in the browser and serves a fetch only an FAQ example
|
|
@@ -118,8 +152,13 @@ export const PROVIDER_REVIEWED: Readonly<Record<string, string>> = Object.freeze
|
|
|
118
152
|
* price as carrying the cache discount. This table said Mistral had no
|
|
119
153
|
* prompt caching at all. docs.mistral.ai, where a minimum or a mechanism
|
|
120
154
|
* would be, is not reachable from here, so neither is claimed.
|
|
155
|
+
*
|
|
156
|
+
* Re-read 2026-11-05 from the same three model cards' `data-prices` and
|
|
157
|
+
* mistral.ai/cloud/inference: Large 2512 at $0.50/$1.50, Medium 3.5 at
|
|
158
|
+
* $1.50/$7.50 and Small 2603 at $0.15/$0.60 matched, as did the 90% cached
|
|
159
|
+
* input discount. docs.mistral.ai is still not reachable from here.
|
|
121
160
|
*/
|
|
122
|
-
mistral: '2026-
|
|
161
|
+
mistral: '2026-11-05',
|
|
123
162
|
});
|
|
124
163
|
|
|
125
164
|
/**
|
|
@@ -224,12 +263,43 @@ const GROK_LONG = (inputPerMTok: number, outputPerMTok: number): PricingTier =>
|
|
|
224
263
|
const NO_PUBLISHED_CACHE_MINIMUM =
|
|
225
264
|
'Caches automatically, but no minimum prefix length is published, so no caching advice is given for it.';
|
|
226
265
|
|
|
227
|
-
/**
|
|
228
|
-
|
|
266
|
+
/**
|
|
267
|
+
* OpenAI's GPT-5.6 and later: an entry lives at least 30 minutes by default,
|
|
268
|
+
* and the Responses API sells a 12-hour one (`prompt_cache_options.ttl`). The
|
|
269
|
+
* two write prices are the `cacheWrite5m` and `cacheWrite1h` multipliers: the
|
|
270
|
+
* catalogue's short and long write, whatever each provider's durations.
|
|
271
|
+
*/
|
|
272
|
+
const OPENAI_CACHE_TTL = Object.freeze({ writeMs: 30 * 60_000, longerMs: 12 * 60 * 60_000 });
|
|
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
|
+
];
|
|
229
285
|
|
|
230
286
|
const OPENAI_CURRENT_NOTE =
|
|
231
287
|
'Priced per request by prompt length: over 272,000 input tokens, 2x input and cache and 1.5x output for'
|
|
232
|
-
+ ' the whole request. Cache writes cost 1.25x input
|
|
288
|
+
+ ' the whole request. Cache writes cost 1.25x input for the default 30-minute entry and 2.5x for a'
|
|
289
|
+
+ ' 12-hour one (Responses API).';
|
|
290
|
+
|
|
291
|
+
const OPENAI_EARLIER_NOTE =
|
|
292
|
+
'Caching is automatic; a write costs what input costs. OpenAI says the minimum for models before GPT-5.6 varies by'
|
|
293
|
+
+ ' request settings, so 1,024 here is the nearest published floor.';
|
|
294
|
+
const OPENAI_EARLIER_LONG_NOTE =
|
|
295
|
+
'Priced per request by prompt length: over 272,000 input tokens, 2x input and 1.5x output for the whole request. '
|
|
296
|
+
+ OPENAI_EARLIER_NOTE;
|
|
297
|
+
const OPENAI_EARLIER_NO_CACHE_NOTE = 'OpenAI publishes no cached-input price for this model, so caching is not priced.';
|
|
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.';
|
|
233
303
|
|
|
234
304
|
const OPENAI_GPT5_NOTE =
|
|
235
305
|
'Caching is automatic, with no cache_control to set. OpenAI says the minimum for models before GPT-5.6 varies by'
|
|
@@ -324,9 +394,18 @@ export const MODELS: ModelPricing[] = [
|
|
|
324
394
|
contextWindow: 1_000_000,
|
|
325
395
|
cacheMinTokens: 512,
|
|
326
396
|
multipliers: { cacheRead: 0.05, cacheWrite5m: 1.25, cacheWrite1h: 2, batch: 0.5 },
|
|
397
|
+
/*
|
|
398
|
+
* Fast mode, read 2026-11-05 from platform.claude.com/docs/en/about-claude/
|
|
399
|
+
* pricing#fast-mode-pricing and build-with-claude/fast-mode: $8/$40 "across
|
|
400
|
+
* the full context window", with the caching multipliers "on top", which is
|
|
401
|
+
* how a tier's rate already feeds the cache prices here. The response's
|
|
402
|
+
* `usage.speed` says which speed ran.
|
|
403
|
+
*/
|
|
404
|
+
tiers: [{ id: 'fast', when: { kind: 'speed', speed: 'fast' }, inputPerMTok: 8, outputPerMTok: 40 }],
|
|
327
405
|
capability: 'large',
|
|
328
406
|
tier: 'opus',
|
|
329
|
-
notes: 'Cache hits cost 5% of the input price ($0.20), against 10% on Opus 5 and earlier.'
|
|
407
|
+
notes: 'Cache hits cost 5% of the input price ($0.20), against 10% on Opus 5 and earlier.'
|
|
408
|
+
+ ' Fast mode (usage.speed "fast") bills $8/$40.',
|
|
330
409
|
},
|
|
331
410
|
{
|
|
332
411
|
id: 'claude-opus-5',
|
|
@@ -336,9 +415,11 @@ export const MODELS: ModelPricing[] = [
|
|
|
336
415
|
outputPerMTok: 25,
|
|
337
416
|
contextWindow: 1_000_000,
|
|
338
417
|
cacheMinTokens: 512,
|
|
418
|
+
// Fast mode in research preview, $10/$50; same sources as Opus 5.5's.
|
|
419
|
+
tiers: [{ id: 'fast', when: { kind: 'speed', speed: 'fast' }, inputPerMTok: 10, outputPerMTok: 50 }],
|
|
339
420
|
capability: 'large',
|
|
340
421
|
tier: 'opus',
|
|
341
|
-
notes: '512-token cache minimum: caches prompts that would miss on Opus 4.6.',
|
|
422
|
+
notes: '512-token cache minimum: caches prompts that would miss on Opus 4.6. Fast mode bills $10/$50.',
|
|
342
423
|
},
|
|
343
424
|
{
|
|
344
425
|
id: 'claude-opus-4-8',
|
|
@@ -348,8 +429,15 @@ export const MODELS: ModelPricing[] = [
|
|
|
348
429
|
outputPerMTok: 25,
|
|
349
430
|
contextWindow: 1_000_000,
|
|
350
431
|
cacheMinTokens: 1024,
|
|
432
|
+
/*
|
|
433
|
+
* Fast mode in research preview, $10/$50; same sources as Opus 5.5's. It is
|
|
434
|
+
* deprecated on this model and removed on 2026-11-30, after which no
|
|
435
|
+
* response records it, so the tier only ever prices calls that ran fast.
|
|
436
|
+
*/
|
|
437
|
+
tiers: [{ id: 'fast', when: { kind: 'speed', speed: 'fast' }, inputPerMTok: 10, outputPerMTok: 50 }],
|
|
351
438
|
capability: 'large',
|
|
352
439
|
tier: 'opus',
|
|
440
|
+
notes: 'Fast mode bills $10/$50 until it is removed from this model on 2026-11-30.',
|
|
353
441
|
},
|
|
354
442
|
{
|
|
355
443
|
id: 'claude-opus-4-7',
|
|
@@ -394,6 +482,53 @@ export const MODELS: ModelPricing[] = [
|
|
|
394
482
|
tier: 'opus',
|
|
395
483
|
notes: '200K context window and a 64K output cap.',
|
|
396
484
|
},
|
|
485
|
+
{
|
|
486
|
+
/*
|
|
487
|
+
* Retired on the Claude API on 2026-08-05 (the deprecations page, read
|
|
488
|
+
* 2026-11-05) and still served on Claude Models on Google Cloud (Google
|
|
489
|
+
* managed) and on Bedrock. Priced because a year of logs carries it and,
|
|
490
|
+
* unpriced, every one of those calls read as a gap. The pricing page, read
|
|
491
|
+
* the same day: $15/$75, writes $18.75 and $30, cache hits $1.50, batch
|
|
492
|
+
* $7.50/$37.50, which are the default multipliers. Its model page is gone;
|
|
493
|
+
* the context-windows page gives every Claude model outside its 1M list a
|
|
494
|
+
* 200k window, and the prompt-caching page a 1,024-token cache minimum.
|
|
495
|
+
* The dated id is the one the deprecations page names and what a log
|
|
496
|
+
* carries; no shorter alias is on any page read, so none is declared.
|
|
497
|
+
*/
|
|
498
|
+
id: 'claude-opus-4-1-20250805',
|
|
499
|
+
provider: 'anthropic',
|
|
500
|
+
displayName: 'Claude Opus 4.1',
|
|
501
|
+
recommendable: false,
|
|
502
|
+
inputPerMTok: 15,
|
|
503
|
+
outputPerMTok: 75,
|
|
504
|
+
contextWindow: 200_000,
|
|
505
|
+
cacheMinTokens: 1024,
|
|
506
|
+
capability: 'large',
|
|
507
|
+
tier: 'opus',
|
|
508
|
+
notes:
|
|
509
|
+
'Retired on the Claude API on 2026-08-05; still served on Google Cloud (Google managed) and Bedrock.'
|
|
510
|
+
+ ' Anthropic names Claude Opus 4.8 as the replacement.',
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
/*
|
|
514
|
+
* Retired on the Claude API on 2026-06-15; still served on Claude Models
|
|
515
|
+
* on Google Cloud (Google managed). The same pages and the same figures as
|
|
516
|
+
* Opus 4.1 above: $15/$75, 200k context, a 1,024-token cache minimum.
|
|
517
|
+
*/
|
|
518
|
+
id: 'claude-opus-4-20250514',
|
|
519
|
+
provider: 'anthropic',
|
|
520
|
+
displayName: 'Claude Opus 4',
|
|
521
|
+
recommendable: false,
|
|
522
|
+
inputPerMTok: 15,
|
|
523
|
+
outputPerMTok: 75,
|
|
524
|
+
contextWindow: 200_000,
|
|
525
|
+
cacheMinTokens: 1024,
|
|
526
|
+
capability: 'large',
|
|
527
|
+
tier: 'opus',
|
|
528
|
+
notes:
|
|
529
|
+
'Retired on the Claude API on 2026-06-15; still served on Google Cloud (Google managed).'
|
|
530
|
+
+ ' Anthropic names Claude Opus 4.8 as the replacement.',
|
|
531
|
+
},
|
|
397
532
|
{
|
|
398
533
|
/*
|
|
399
534
|
* The pricing page and the Sonnet 5.5 model page, read 2026-10-10. The
|
|
@@ -437,6 +572,53 @@ export const MODELS: ModelPricing[] = [
|
|
|
437
572
|
capability: 'mid',
|
|
438
573
|
tier: 'sonnet',
|
|
439
574
|
},
|
|
575
|
+
{
|
|
576
|
+
/*
|
|
577
|
+
* Its own model page (platform.claude.com/docs/en/models/sonnet-4-5/
|
|
578
|
+
* overview), the pricing page, the prompt-caching page and the
|
|
579
|
+
* deprecations page, read 2026-11-05. $3/$15, writes $3.75 and $6, cache
|
|
580
|
+
* read $0.30, batch 50% off, 200K context, 1,024-token cache minimum.
|
|
581
|
+
* Deprecated on 2026-09-30 and retiring on 2026-11-30, so it is priced (it
|
|
582
|
+
* is in every log of the last year) and never recommended. It was missing
|
|
583
|
+
* here, so every Sonnet 4.5 call read as an unpriced model.
|
|
584
|
+
*/
|
|
585
|
+
id: 'claude-sonnet-4-5',
|
|
586
|
+
aliases: ['claude-sonnet-4-5-20250929'],
|
|
587
|
+
provider: 'anthropic',
|
|
588
|
+
displayName: 'Claude Sonnet 4.5',
|
|
589
|
+
recommendable: false,
|
|
590
|
+
inputPerMTok: 3,
|
|
591
|
+
outputPerMTok: 15,
|
|
592
|
+
contextWindow: 200_000,
|
|
593
|
+
cacheMinTokens: 1024,
|
|
594
|
+
capability: 'mid',
|
|
595
|
+
tier: 'sonnet',
|
|
596
|
+
notes: 'Deprecated; retires 2026-11-30. Recommended replacement: Claude Sonnet 5.5.',
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
/*
|
|
600
|
+
* Retired on the Claude API on 2026-06-15 (the deprecations page, read
|
|
601
|
+
* 2026-11-05); still served on Claude Models on Google Cloud (Google
|
|
602
|
+
* managed) and on Bedrock. The pricing page, read the same day: $3/$15,
|
|
603
|
+
* writes $3.75 and $6, cache hits $0.30, batch $1.50/$7.50. 200k context
|
|
604
|
+
* from the context-windows page, a 1,024-token cache minimum from the
|
|
605
|
+
* prompt-caching page. The pricing page publishes one rate for it and no
|
|
606
|
+
* long-context band, so every call is priced at that rate.
|
|
607
|
+
*/
|
|
608
|
+
id: 'claude-sonnet-4-20250514',
|
|
609
|
+
provider: 'anthropic',
|
|
610
|
+
displayName: 'Claude Sonnet 4',
|
|
611
|
+
recommendable: false,
|
|
612
|
+
inputPerMTok: 3,
|
|
613
|
+
outputPerMTok: 15,
|
|
614
|
+
contextWindow: 200_000,
|
|
615
|
+
cacheMinTokens: 1024,
|
|
616
|
+
capability: 'mid',
|
|
617
|
+
tier: 'sonnet',
|
|
618
|
+
notes:
|
|
619
|
+
'Retired on the Claude API on 2026-06-15; still served on Google Cloud (Google managed) and Bedrock.'
|
|
620
|
+
+ ' Anthropic names Claude Sonnet 5.5 as the replacement.',
|
|
621
|
+
},
|
|
440
622
|
{
|
|
441
623
|
/*
|
|
442
624
|
* The pricing page, the models overview and the prompt-caching page, read
|
|
@@ -492,6 +674,29 @@ export const MODELS: ModelPricing[] = [
|
|
|
492
674
|
tier: 'haiku',
|
|
493
675
|
notes: '200K context window and a 64K output cap, smaller than the rest.',
|
|
494
676
|
},
|
|
677
|
+
{
|
|
678
|
+
/*
|
|
679
|
+
* Retired on the Claude API on 2026-02-19 (the deprecations page, read
|
|
680
|
+
* 2026-11-05); still served on Claude Models on Google Cloud (Google
|
|
681
|
+
* managed). The pricing page, read the same day: $0.80/$4, writes $1 and
|
|
682
|
+
* $1.60, cache hits $0.08, batch $0.40/$2, the default multipliers. 200k
|
|
683
|
+
* context from the context-windows page, and the prompt-caching page's
|
|
684
|
+
* 2,048-token cache minimum.
|
|
685
|
+
*/
|
|
686
|
+
id: 'claude-3-5-haiku-20241022',
|
|
687
|
+
provider: 'anthropic',
|
|
688
|
+
displayName: 'Claude Haiku 3.5',
|
|
689
|
+
recommendable: false,
|
|
690
|
+
inputPerMTok: 0.8,
|
|
691
|
+
outputPerMTok: 4,
|
|
692
|
+
contextWindow: 200_000,
|
|
693
|
+
cacheMinTokens: 2048,
|
|
694
|
+
capability: 'small',
|
|
695
|
+
tier: 'haiku',
|
|
696
|
+
notes:
|
|
697
|
+
'Retired on the Claude API on 2026-02-19; still served on Google Cloud (Google managed).'
|
|
698
|
+
+ ' Anthropic names Claude Haiku 4.5 as the replacement.',
|
|
699
|
+
},
|
|
495
700
|
|
|
496
701
|
// ------------------------------------------------------------------------
|
|
497
702
|
// OpenAI
|
|
@@ -515,8 +720,17 @@ export const MODELS: ModelPricing[] = [
|
|
|
515
720
|
// - **Cache writes are billed**, at 1.25x the uncached input rate, and the
|
|
516
721
|
// usage object reports them (`cache_write_tokens`). Reads are 10% of input,
|
|
517
722
|
// 5% on GPT-6.1 Sol.
|
|
518
|
-
// - **An entry lives at least 30 minutes** after its last write or read
|
|
519
|
-
// there
|
|
723
|
+
// - **An entry lives at least 30 minutes** after its last write or read:
|
|
724
|
+
// `cacheTtl`. On 2026-10-11 there was no longer one to buy.
|
|
725
|
+
//
|
|
726
|
+
// Re-read 2026-11-05 (pricing.md, prompt-caching.md and the GPT-6.1 pages,
|
|
727
|
+
// in their Markdown form). Every price matched. Two things are new: GPT-6.1
|
|
728
|
+
// Terra, and a **12-hour cache write** in the Responses API at 2.5x input
|
|
729
|
+
// (`prompt_cache_options.ttl: "12h"`), reported in
|
|
730
|
+
// `input_tokens_details.cache_write_tokens_details` as `ttl_30m_tokens` and
|
|
731
|
+
// `ttl_12h_tokens`, "both fields returned, including when one is zero". A
|
|
732
|
+
// 12-hour write is the long write here; read as a 30-minute one, it was
|
|
733
|
+
// priced at half its cost.
|
|
520
734
|
//
|
|
521
735
|
// Caching is implicit by default (a breakpoint at the end of the latest
|
|
522
736
|
// eligible message) from a 1,024-token minimum. Batch and Flex are half
|
|
@@ -533,7 +747,7 @@ export const MODELS: ModelPricing[] = [
|
|
|
533
747
|
contextWindow: 1_050_000,
|
|
534
748
|
cacheMinTokens: 1024,
|
|
535
749
|
caching: 'automatic',
|
|
536
|
-
multipliers: { cacheRead: 0.1, cacheWrite5m: 1.25, cacheWrite1h:
|
|
750
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1.25, cacheWrite1h: 2.5, batch: 0.5 },
|
|
537
751
|
cacheTtl: OPENAI_CACHE_TTL,
|
|
538
752
|
tiers: [
|
|
539
753
|
{
|
|
@@ -543,6 +757,11 @@ export const MODELS: ModelPricing[] = [
|
|
|
543
757
|
outputPerMTok: 75,
|
|
544
758
|
},
|
|
545
759
|
],
|
|
760
|
+
serviceTiers: {
|
|
761
|
+
flex: { inputPerMTok: 5, outputPerMTok: 25, tiers: openAiLongBand(10, 37.5) },
|
|
762
|
+
fast: { inputPerMTok: 20, outputPerMTok: 100, tiers: openAiLongBand(40, 150) },
|
|
763
|
+
ultrafast: { inputPerMTok: 60, outputPerMTok: 300, tiers: openAiLongBand(120, 450) },
|
|
764
|
+
},
|
|
546
765
|
capability: 'frontier',
|
|
547
766
|
tier: 'frontier',
|
|
548
767
|
notes: OPENAI_CURRENT_NOTE,
|
|
@@ -556,7 +775,7 @@ export const MODELS: ModelPricing[] = [
|
|
|
556
775
|
contextWindow: 1_050_000,
|
|
557
776
|
cacheMinTokens: 1024,
|
|
558
777
|
caching: 'automatic',
|
|
559
|
-
multipliers: { cacheRead: 0.05, cacheWrite5m: 1.25, cacheWrite1h:
|
|
778
|
+
multipliers: { cacheRead: 0.05, cacheWrite5m: 1.25, cacheWrite1h: 2.5, batch: 0.5 },
|
|
560
779
|
cacheTtl: OPENAI_CACHE_TTL,
|
|
561
780
|
tiers: [
|
|
562
781
|
{
|
|
@@ -566,10 +785,48 @@ export const MODELS: ModelPricing[] = [
|
|
|
566
785
|
outputPerMTok: 15,
|
|
567
786
|
},
|
|
568
787
|
],
|
|
788
|
+
serviceTiers: {
|
|
789
|
+
flex: { inputPerMTok: 1, outputPerMTok: 5, tiers: openAiLongBand(2, 7.5) },
|
|
790
|
+
fast: { inputPerMTok: 4, outputPerMTok: 20, tiers: openAiLongBand(8, 30) },
|
|
791
|
+
ultrafast: { inputPerMTok: 12, outputPerMTok: 60, tiers: openAiLongBand(24, 90) },
|
|
792
|
+
},
|
|
569
793
|
capability: 'large',
|
|
570
794
|
tier: 'opus',
|
|
571
795
|
notes: OPENAI_CURRENT_NOTE,
|
|
572
796
|
},
|
|
797
|
+
{
|
|
798
|
+
/*
|
|
799
|
+
* developers.openai.com/api/docs/models/gpt-6.1-terra.md, read 2026-11-05:
|
|
800
|
+
* $1/$5, cached input $0.05 ("5% of the uncached input token rate"), cache
|
|
801
|
+
* writes $1.25 for 30 minutes and $2.50 for 12 hours, the same 272K band,
|
|
802
|
+
* 1,050,000 context, 922,000 input and 128,000 output.
|
|
803
|
+
*/
|
|
804
|
+
id: 'gpt-6.1-terra',
|
|
805
|
+
provider: 'openai',
|
|
806
|
+
displayName: 'GPT-6.1 Terra',
|
|
807
|
+
inputPerMTok: 1,
|
|
808
|
+
outputPerMTok: 5,
|
|
809
|
+
contextWindow: 1_050_000,
|
|
810
|
+
cacheMinTokens: 1024,
|
|
811
|
+
caching: 'automatic',
|
|
812
|
+
multipliers: { cacheRead: 0.05, cacheWrite5m: 1.25, cacheWrite1h: 2.5, batch: 0.5 },
|
|
813
|
+
cacheTtl: OPENAI_CACHE_TTL,
|
|
814
|
+
tiers: [
|
|
815
|
+
{
|
|
816
|
+
id: 'over-272k',
|
|
817
|
+
when: { kind: 'input-tokens-above', tokens: 272_000 },
|
|
818
|
+
inputPerMTok: 2,
|
|
819
|
+
outputPerMTok: 7.5,
|
|
820
|
+
},
|
|
821
|
+
],
|
|
822
|
+
serviceTiers: {
|
|
823
|
+
flex: { inputPerMTok: 0.5, outputPerMTok: 2.5, tiers: openAiLongBand(1, 3.75) },
|
|
824
|
+
fast: { inputPerMTok: 2, outputPerMTok: 10, tiers: openAiLongBand(4, 15) },
|
|
825
|
+
},
|
|
826
|
+
capability: 'mid',
|
|
827
|
+
tier: 'sonnet',
|
|
828
|
+
notes: OPENAI_CURRENT_NOTE,
|
|
829
|
+
},
|
|
573
830
|
{
|
|
574
831
|
id: 'gpt-6-sol',
|
|
575
832
|
provider: 'openai',
|
|
@@ -579,7 +836,7 @@ export const MODELS: ModelPricing[] = [
|
|
|
579
836
|
contextWindow: 1_050_000,
|
|
580
837
|
cacheMinTokens: 1024,
|
|
581
838
|
caching: 'automatic',
|
|
582
|
-
multipliers: { cacheRead: 0.1, cacheWrite5m: 1.25, cacheWrite1h:
|
|
839
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1.25, cacheWrite1h: 2.5, batch: 0.5 },
|
|
583
840
|
cacheTtl: OPENAI_CACHE_TTL,
|
|
584
841
|
tiers: [
|
|
585
842
|
{
|
|
@@ -589,6 +846,10 @@ export const MODELS: ModelPricing[] = [
|
|
|
589
846
|
outputPerMTok: 15,
|
|
590
847
|
},
|
|
591
848
|
],
|
|
849
|
+
serviceTiers: {
|
|
850
|
+
flex: { inputPerMTok: 1, outputPerMTok: 5, tiers: openAiLongBand(2, 7.5) },
|
|
851
|
+
fast: { inputPerMTok: 4, outputPerMTok: 20, tiers: openAiLongBand(8, 30) },
|
|
852
|
+
},
|
|
592
853
|
capability: 'large',
|
|
593
854
|
tier: 'opus',
|
|
594
855
|
notes: OPENAI_CURRENT_NOTE,
|
|
@@ -602,7 +863,7 @@ export const MODELS: ModelPricing[] = [
|
|
|
602
863
|
contextWindow: 1_050_000,
|
|
603
864
|
cacheMinTokens: 1024,
|
|
604
865
|
caching: 'automatic',
|
|
605
|
-
multipliers: { cacheRead: 0.1, cacheWrite5m: 1.25, cacheWrite1h:
|
|
866
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1.25, cacheWrite1h: 2.5, batch: 0.5 },
|
|
606
867
|
cacheTtl: OPENAI_CACHE_TTL,
|
|
607
868
|
tiers: [
|
|
608
869
|
{
|
|
@@ -612,12 +873,30 @@ export const MODELS: ModelPricing[] = [
|
|
|
612
873
|
outputPerMTok: 0.75,
|
|
613
874
|
},
|
|
614
875
|
],
|
|
876
|
+
serviceTiers: {
|
|
877
|
+
flex: { inputPerMTok: 0.05, outputPerMTok: 0.25, tiers: openAiLongBand(0.1, 0.375) },
|
|
878
|
+
fast: { inputPerMTok: 0.2, outputPerMTok: 1, tiers: openAiLongBand(0.4, 1.5) },
|
|
879
|
+
},
|
|
615
880
|
capability: 'small',
|
|
616
881
|
tier: 'haiku',
|
|
617
882
|
notes: OPENAI_CURRENT_NOTE,
|
|
618
883
|
},
|
|
619
884
|
{
|
|
885
|
+
/*
|
|
886
|
+
* Its model page, read 2026-11-05: "The `gpt-5.6` alias routes requests
|
|
887
|
+
* to GPT-5.6 Sol", so a log that names the alias is this model; and
|
|
888
|
+
* "$4 per million input tokens and $20 per million output tokens, a 20%
|
|
889
|
+
* reduction in input pricing and a 33% reduction in output pricing ...
|
|
890
|
+
* promotional pricing is available until November 30, 2026". The price
|
|
891
|
+
* after the promotion is not published as a figure, and deriving one
|
|
892
|
+
* from two rounded percentages would be a price nobody quoted, so the row
|
|
893
|
+
* carries what the page charges today. When the page changes,
|
|
894
|
+
* `scripts/price-drift.mjs` reports it on the next weekly run; until a
|
|
895
|
+
* person reads the new figure, a call after 2026-11-30 may be priced low,
|
|
896
|
+
* and the note says so to anyone reading the row.
|
|
897
|
+
*/
|
|
620
898
|
id: 'gpt-5.6-sol',
|
|
899
|
+
aliases: ['gpt-5.6'],
|
|
621
900
|
provider: 'openai',
|
|
622
901
|
displayName: 'GPT-5.6 Sol',
|
|
623
902
|
inputPerMTok: 4,
|
|
@@ -625,7 +904,7 @@ export const MODELS: ModelPricing[] = [
|
|
|
625
904
|
contextWindow: 1_050_000,
|
|
626
905
|
cacheMinTokens: 1024,
|
|
627
906
|
caching: 'automatic',
|
|
628
|
-
multipliers: { cacheRead: 0.1, cacheWrite5m: 1.25, cacheWrite1h:
|
|
907
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1.25, cacheWrite1h: 2.5, batch: 0.5 },
|
|
629
908
|
cacheTtl: OPENAI_CACHE_TTL,
|
|
630
909
|
tiers: [
|
|
631
910
|
{
|
|
@@ -635,9 +914,15 @@ export const MODELS: ModelPricing[] = [
|
|
|
635
914
|
outputPerMTok: 30,
|
|
636
915
|
},
|
|
637
916
|
],
|
|
917
|
+
serviceTiers: {
|
|
918
|
+
flex: { inputPerMTok: 2, outputPerMTok: 10, tiers: openAiLongBand(4, 15) },
|
|
919
|
+
fast: { inputPerMTok: 8, outputPerMTok: 40, tiers: openAiLongBand(16, 60) },
|
|
920
|
+
},
|
|
638
921
|
capability: 'large',
|
|
639
922
|
tier: 'opus',
|
|
640
|
-
notes:
|
|
923
|
+
notes:
|
|
924
|
+
OPENAI_CURRENT_NOTE
|
|
925
|
+
+ ' $4/$20 is promotional until 2026-11-30, and OpenAI has not published the price after it as a figure.',
|
|
641
926
|
},
|
|
642
927
|
{
|
|
643
928
|
id: 'gpt-5.6-terra',
|
|
@@ -648,7 +933,7 @@ export const MODELS: ModelPricing[] = [
|
|
|
648
933
|
contextWindow: 1_050_000,
|
|
649
934
|
cacheMinTokens: 1024,
|
|
650
935
|
caching: 'automatic',
|
|
651
|
-
multipliers: { cacheRead: 0.1, cacheWrite5m: 1.25, cacheWrite1h:
|
|
936
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1.25, cacheWrite1h: 2.5, batch: 0.5 },
|
|
652
937
|
cacheTtl: OPENAI_CACHE_TTL,
|
|
653
938
|
tiers: [
|
|
654
939
|
{
|
|
@@ -658,6 +943,10 @@ export const MODELS: ModelPricing[] = [
|
|
|
658
943
|
outputPerMTok: 18,
|
|
659
944
|
},
|
|
660
945
|
],
|
|
946
|
+
serviceTiers: {
|
|
947
|
+
flex: { inputPerMTok: 1, outputPerMTok: 6, tiers: openAiLongBand(2, 9) },
|
|
948
|
+
fast: { inputPerMTok: 4, outputPerMTok: 24, tiers: openAiLongBand(8, 36) },
|
|
949
|
+
},
|
|
661
950
|
capability: 'mid',
|
|
662
951
|
tier: 'sonnet',
|
|
663
952
|
notes: OPENAI_CURRENT_NOTE,
|
|
@@ -671,7 +960,7 @@ export const MODELS: ModelPricing[] = [
|
|
|
671
960
|
contextWindow: 1_050_000,
|
|
672
961
|
cacheMinTokens: 1024,
|
|
673
962
|
caching: 'automatic',
|
|
674
|
-
multipliers: { cacheRead: 0.1, cacheWrite5m: 1.25, cacheWrite1h:
|
|
963
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1.25, cacheWrite1h: 2.5, batch: 0.5 },
|
|
675
964
|
cacheTtl: OPENAI_CACHE_TTL,
|
|
676
965
|
tiers: [
|
|
677
966
|
{
|
|
@@ -681,56 +970,591 @@ export const MODELS: ModelPricing[] = [
|
|
|
681
970
|
outputPerMTok: 1.8,
|
|
682
971
|
},
|
|
683
972
|
],
|
|
973
|
+
serviceTiers: {
|
|
974
|
+
flex: { inputPerMTok: 0.1, outputPerMTok: 0.6, tiers: openAiLongBand(0.2, 0.9) },
|
|
975
|
+
fast: { inputPerMTok: 0.4, outputPerMTok: 2.4, tiers: openAiLongBand(0.8, 3.6) },
|
|
976
|
+
},
|
|
684
977
|
capability: 'small',
|
|
685
978
|
tier: 'haiku',
|
|
686
979
|
notes: OPENAI_CURRENT_NOTE,
|
|
687
980
|
},
|
|
981
|
+
{
|
|
982
|
+
/*
|
|
983
|
+
* The pricing page's "Cyber models" table and the model's own page
|
|
984
|
+
* (developers.openai.com/api/docs/models/gpt-5.6-cyber.md), read
|
|
985
|
+
* 2026-11-05: $12.50/$75, cached input $1.25, the 30-minute write $15.625
|
|
986
|
+
* and the 12-hour one $31.25, the same 0.1x, 1.25x and 2.5x as the rest of
|
|
987
|
+
* GPT-5.6. A 400,000-token context window with at most 272,000 input
|
|
988
|
+
* tokens, so the long-prompt band the model page mentions can never be
|
|
989
|
+
* reached and none is modelled; the pricing page lists none either. The
|
|
990
|
+
* Batch endpoint is "Not supported", so there is no batch price.
|
|
991
|
+
*
|
|
992
|
+
* Found by `scripts/price-drift.mjs` on its first run, as a model on the
|
|
993
|
+
* pricing page that read as unpriced. It needs Daybreak programme
|
|
994
|
+
* approval, so it is priced for the logs of people who have it and never
|
|
995
|
+
* recommended to anyone else.
|
|
996
|
+
*/
|
|
997
|
+
id: 'gpt-5.6-cyber',
|
|
998
|
+
provider: 'openai',
|
|
999
|
+
displayName: 'GPT-5.6 Cyber',
|
|
1000
|
+
recommendable: false,
|
|
1001
|
+
inputPerMTok: 12.5,
|
|
1002
|
+
outputPerMTok: 75,
|
|
1003
|
+
contextWindow: 400_000,
|
|
1004
|
+
cacheMinTokens: 1024,
|
|
1005
|
+
caching: 'automatic',
|
|
1006
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1.25, cacheWrite1h: 2.5, batch: null },
|
|
1007
|
+
cacheTtl: OPENAI_CACHE_TTL,
|
|
1008
|
+
capability: 'large',
|
|
1009
|
+
tier: 'opus',
|
|
1010
|
+
notes:
|
|
1011
|
+
'Needs approval through the Daybreak programme. At most 272,000 input tokens, Responses API only, no batch.'
|
|
1012
|
+
+ ' Cache writes cost 1.25x input for the default 30-minute entry and 2.5x for a 12-hour one.',
|
|
1013
|
+
},
|
|
688
1014
|
|
|
689
1015
|
// ------------------------------------------------------------------------
|
|
1016
|
+
// GPT-5, mini and nano. Each model page, read 2026-11-05, opens with
|
|
1017
|
+
// "Status: Deprecated", and the catalogue still offered all three as
|
|
1018
|
+
// cheaper alternatives, nano as the cheapest OpenAI model there is. Priced
|
|
1019
|
+
// for the logs that hold them; never recommended.
|
|
690
1020
|
{
|
|
691
1021
|
id: 'gpt-5',
|
|
692
1022
|
aliases: ['gpt-5-2025-08-07'],
|
|
693
1023
|
provider: 'openai',
|
|
694
1024
|
displayName: 'GPT-5',
|
|
1025
|
+
recommendable: false,
|
|
695
1026
|
inputPerMTok: 1.25,
|
|
696
1027
|
outputPerMTok: 10,
|
|
697
1028
|
contextWindow: 400_000,
|
|
698
1029
|
cacheMinTokens: 1024,
|
|
699
1030
|
caching: 'automatic',
|
|
700
1031
|
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1032
|
+
serviceTiers: {
|
|
1033
|
+
flex: { inputPerMTok: 0.625, outputPerMTok: 5 },
|
|
1034
|
+
fast: { inputPerMTok: 2.5, outputPerMTok: 20 },
|
|
1035
|
+
},
|
|
701
1036
|
capability: 'frontier',
|
|
702
1037
|
tier: 'frontier',
|
|
703
|
-
notes: OPENAI_GPT5_NOTE,
|
|
1038
|
+
notes: OPENAI_GPT5_NOTE + OPENAI_DEPRECATED_SUFFIX,
|
|
704
1039
|
},
|
|
705
1040
|
{
|
|
706
1041
|
id: 'gpt-5-mini',
|
|
707
1042
|
aliases: ['gpt-5-mini-2025-08-07'],
|
|
708
1043
|
provider: 'openai',
|
|
709
1044
|
displayName: 'GPT-5 mini',
|
|
1045
|
+
recommendable: false,
|
|
710
1046
|
inputPerMTok: 0.25,
|
|
711
1047
|
outputPerMTok: 2,
|
|
712
1048
|
contextWindow: 400_000,
|
|
713
1049
|
cacheMinTokens: 1024,
|
|
714
1050
|
caching: 'automatic',
|
|
715
1051
|
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1052
|
+
serviceTiers: {
|
|
1053
|
+
flex: { inputPerMTok: 0.125, outputPerMTok: 1 },
|
|
1054
|
+
fast: { inputPerMTok: 0.45, outputPerMTok: 3.6 },
|
|
1055
|
+
},
|
|
716
1056
|
capability: 'mid',
|
|
717
1057
|
tier: 'sonnet',
|
|
718
|
-
notes: OPENAI_GPT5_NOTE,
|
|
1058
|
+
notes: OPENAI_GPT5_NOTE + OPENAI_DEPRECATED_SUFFIX,
|
|
719
1059
|
},
|
|
720
1060
|
{
|
|
721
1061
|
id: 'gpt-5-nano',
|
|
722
1062
|
aliases: ['gpt-5-nano-2025-08-07'],
|
|
723
1063
|
provider: 'openai',
|
|
724
1064
|
displayName: 'GPT-5 nano',
|
|
1065
|
+
recommendable: false,
|
|
725
1066
|
inputPerMTok: 0.05,
|
|
726
1067
|
outputPerMTok: 0.4,
|
|
727
1068
|
contextWindow: 400_000,
|
|
728
1069
|
cacheMinTokens: 1024,
|
|
729
1070
|
caching: 'automatic',
|
|
730
1071
|
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1072
|
+
serviceTiers: {
|
|
1073
|
+
flex: { inputPerMTok: 0.025, outputPerMTok: 0.2 },
|
|
1074
|
+
},
|
|
731
1075
|
capability: 'small',
|
|
732
1076
|
tier: 'haiku',
|
|
733
|
-
notes: OPENAI_GPT5_NOTE,
|
|
1077
|
+
notes: OPENAI_GPT5_NOTE + OPENAI_DEPRECATED_SUFFIX,
|
|
1078
|
+
},
|
|
1079
|
+
|
|
1080
|
+
// ------------------------------------------------------------------------
|
|
1081
|
+
// OpenAI's earlier models, still billed and still in logs.
|
|
1082
|
+
//
|
|
1083
|
+
// developers.openai.com/api/docs/pricing.md (Standard and Batch tables) and
|
|
1084
|
+
// each model's own page (models/<id>.md), read 2026-11-05 in their Markdown
|
|
1085
|
+
// form. None was priced here, so every call to gpt-4o, gpt-4.1, o3 or a
|
|
1086
|
+
// GPT-5.x before 5.6 read as an unpriced model. Prices, cached-input prices
|
|
1087
|
+
// and context windows are each page's own; the dated snapshot ids are the
|
|
1088
|
+
// ones each page lists, except gpt-4o-2024-05-13, which is shut down and
|
|
1089
|
+
// priced differently from the current gpt-4o. A cached read costs what the
|
|
1090
|
+
// page says (10% of input on GPT-5.x, 25% on GPT-4.1 and o3, 50% on GPT-4o);
|
|
1091
|
+
// a write costs what input costs, as on GPT-5. The pro models publish no
|
|
1092
|
+
// cached price and are not cached. Models whose page says "Status:
|
|
1093
|
+
// Deprecated" are priced and never recommended. GPT-5.5, GPT-5.5 pro, GPT-5.4
|
|
1094
|
+
// and GPT-5.4 pro bill a prompt over 272K at 2x input and 1.5x output.
|
|
1095
|
+
// ------------------------------------------------------------------------
|
|
1096
|
+
{
|
|
1097
|
+
id: 'gpt-5.5',
|
|
1098
|
+
aliases: ['gpt-5.5-2026-04-23'],
|
|
1099
|
+
provider: 'openai',
|
|
1100
|
+
displayName: 'GPT-5.5',
|
|
1101
|
+
inputPerMTok: 5,
|
|
1102
|
+
outputPerMTok: 30,
|
|
1103
|
+
contextWindow: 1_050_000,
|
|
1104
|
+
cacheMinTokens: 1024,
|
|
1105
|
+
caching: 'automatic',
|
|
1106
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1107
|
+
tiers: [
|
|
1108
|
+
{
|
|
1109
|
+
id: 'over-272k',
|
|
1110
|
+
when: { kind: 'input-tokens-above', tokens: 272_000 },
|
|
1111
|
+
inputPerMTok: 10,
|
|
1112
|
+
outputPerMTok: 45,
|
|
1113
|
+
},
|
|
1114
|
+
],
|
|
1115
|
+
serviceTiers: {
|
|
1116
|
+
flex: { inputPerMTok: 2.5, outputPerMTok: 15, tiers: openAiLongBand(5, 22.5) },
|
|
1117
|
+
fast: { inputPerMTok: 12.5, outputPerMTok: 75 },
|
|
1118
|
+
},
|
|
1119
|
+
capability: 'frontier',
|
|
1120
|
+
tier: 'frontier',
|
|
1121
|
+
notes: OPENAI_EARLIER_LONG_NOTE,
|
|
1122
|
+
},
|
|
1123
|
+
{
|
|
1124
|
+
id: 'gpt-5.5-pro',
|
|
1125
|
+
aliases: ['gpt-5.5-pro-2026-04-23'],
|
|
1126
|
+
provider: 'openai',
|
|
1127
|
+
displayName: 'GPT-5.5 pro',
|
|
1128
|
+
inputPerMTok: 30,
|
|
1129
|
+
outputPerMTok: 180,
|
|
1130
|
+
contextWindow: 1_050_000,
|
|
1131
|
+
cacheMinTokens: 0,
|
|
1132
|
+
caching: 'none',
|
|
1133
|
+
multipliers: { batch: 0.5 },
|
|
1134
|
+
tiers: [
|
|
1135
|
+
{
|
|
1136
|
+
id: 'over-272k',
|
|
1137
|
+
when: { kind: 'input-tokens-above', tokens: 272_000 },
|
|
1138
|
+
inputPerMTok: 60,
|
|
1139
|
+
outputPerMTok: 270,
|
|
1140
|
+
},
|
|
1141
|
+
],
|
|
1142
|
+
serviceTiers: {
|
|
1143
|
+
flex: { inputPerMTok: 15, outputPerMTok: 90 },
|
|
1144
|
+
},
|
|
1145
|
+
capability: 'frontier',
|
|
1146
|
+
tier: 'frontier',
|
|
1147
|
+
notes: OPENAI_EARLIER_LONG_NOTE,
|
|
1148
|
+
},
|
|
1149
|
+
{
|
|
1150
|
+
id: 'gpt-5.4',
|
|
1151
|
+
aliases: ['gpt-5.4-2026-03-05'],
|
|
1152
|
+
provider: 'openai',
|
|
1153
|
+
displayName: 'GPT-5.4',
|
|
1154
|
+
inputPerMTok: 2.5,
|
|
1155
|
+
outputPerMTok: 15,
|
|
1156
|
+
contextWindow: 1_050_000,
|
|
1157
|
+
cacheMinTokens: 1024,
|
|
1158
|
+
caching: 'automatic',
|
|
1159
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1160
|
+
tiers: [
|
|
1161
|
+
{
|
|
1162
|
+
id: 'over-272k',
|
|
1163
|
+
when: { kind: 'input-tokens-above', tokens: 272_000 },
|
|
1164
|
+
inputPerMTok: 5,
|
|
1165
|
+
outputPerMTok: 22.5,
|
|
1166
|
+
},
|
|
1167
|
+
],
|
|
1168
|
+
serviceTiers: {
|
|
1169
|
+
flex: { inputPerMTok: 1.25, outputPerMTok: 7.5, tiers: openAiLongBand(2.5, 11.25) },
|
|
1170
|
+
fast: { inputPerMTok: 5, outputPerMTok: 30 },
|
|
1171
|
+
},
|
|
1172
|
+
capability: 'frontier',
|
|
1173
|
+
tier: 'frontier',
|
|
1174
|
+
notes: OPENAI_EARLIER_LONG_NOTE,
|
|
1175
|
+
},
|
|
1176
|
+
{
|
|
1177
|
+
id: 'gpt-5.4-pro',
|
|
1178
|
+
aliases: ['gpt-5.4-pro-2026-03-05'],
|
|
1179
|
+
provider: 'openai',
|
|
1180
|
+
displayName: 'GPT-5.4 pro',
|
|
1181
|
+
inputPerMTok: 30,
|
|
1182
|
+
outputPerMTok: 180,
|
|
1183
|
+
contextWindow: 1_050_000,
|
|
1184
|
+
cacheMinTokens: 0,
|
|
1185
|
+
caching: 'none',
|
|
1186
|
+
multipliers: { batch: 0.5 },
|
|
1187
|
+
tiers: [
|
|
1188
|
+
{
|
|
1189
|
+
id: 'over-272k',
|
|
1190
|
+
when: { kind: 'input-tokens-above', tokens: 272_000 },
|
|
1191
|
+
inputPerMTok: 60,
|
|
1192
|
+
outputPerMTok: 270,
|
|
1193
|
+
},
|
|
1194
|
+
],
|
|
1195
|
+
serviceTiers: {
|
|
1196
|
+
flex: { inputPerMTok: 15, outputPerMTok: 90, tiers: openAiLongBand(30, 135) },
|
|
1197
|
+
},
|
|
1198
|
+
capability: 'frontier',
|
|
1199
|
+
tier: 'frontier',
|
|
1200
|
+
notes: OPENAI_EARLIER_LONG_NOTE,
|
|
1201
|
+
},
|
|
1202
|
+
{
|
|
1203
|
+
id: 'gpt-5.4-mini',
|
|
1204
|
+
aliases: ['gpt-5.4-mini-2026-03-17'],
|
|
1205
|
+
provider: 'openai',
|
|
1206
|
+
displayName: 'GPT-5.4 mini',
|
|
1207
|
+
inputPerMTok: 0.75,
|
|
1208
|
+
outputPerMTok: 4.5,
|
|
1209
|
+
contextWindow: 400_000,
|
|
1210
|
+
cacheMinTokens: 1024,
|
|
1211
|
+
caching: 'automatic',
|
|
1212
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1213
|
+
serviceTiers: {
|
|
1214
|
+
flex: { inputPerMTok: 0.375, outputPerMTok: 2.25 },
|
|
1215
|
+
fast: { inputPerMTok: 1.5, outputPerMTok: 9 },
|
|
1216
|
+
},
|
|
1217
|
+
capability: 'mid',
|
|
1218
|
+
tier: 'sonnet',
|
|
1219
|
+
notes: OPENAI_EARLIER_NOTE,
|
|
1220
|
+
},
|
|
1221
|
+
{
|
|
1222
|
+
id: 'gpt-5.4-nano',
|
|
1223
|
+
aliases: ['gpt-5.4-nano-2026-03-17'],
|
|
1224
|
+
provider: 'openai',
|
|
1225
|
+
displayName: 'GPT-5.4 nano',
|
|
1226
|
+
recommendable: false,
|
|
1227
|
+
inputPerMTok: 0.2,
|
|
1228
|
+
outputPerMTok: 1.25,
|
|
1229
|
+
contextWindow: 400_000,
|
|
1230
|
+
cacheMinTokens: 1024,
|
|
1231
|
+
caching: 'automatic',
|
|
1232
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1233
|
+
serviceTiers: {
|
|
1234
|
+
flex: { inputPerMTok: 0.1, outputPerMTok: 0.625 },
|
|
1235
|
+
},
|
|
1236
|
+
capability: 'small',
|
|
1237
|
+
tier: 'haiku',
|
|
1238
|
+
notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
|
|
1239
|
+
},
|
|
1240
|
+
{
|
|
1241
|
+
id: 'gpt-5.2',
|
|
1242
|
+
aliases: ['gpt-5.2-2025-12-11'],
|
|
1243
|
+
provider: 'openai',
|
|
1244
|
+
displayName: 'GPT-5.2',
|
|
1245
|
+
inputPerMTok: 1.75,
|
|
1246
|
+
outputPerMTok: 14,
|
|
1247
|
+
contextWindow: 400_000,
|
|
1248
|
+
cacheMinTokens: 1024,
|
|
1249
|
+
caching: 'automatic',
|
|
1250
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1251
|
+
serviceTiers: {
|
|
1252
|
+
flex: { inputPerMTok: 0.875, outputPerMTok: 7 },
|
|
1253
|
+
fast: { inputPerMTok: 3.5, outputPerMTok: 28 },
|
|
1254
|
+
},
|
|
1255
|
+
capability: 'frontier',
|
|
1256
|
+
tier: 'frontier',
|
|
1257
|
+
notes: OPENAI_EARLIER_NOTE,
|
|
1258
|
+
},
|
|
1259
|
+
{
|
|
1260
|
+
id: 'gpt-5.2-pro',
|
|
1261
|
+
aliases: ['gpt-5.2-pro-2025-12-11'],
|
|
1262
|
+
provider: 'openai',
|
|
1263
|
+
displayName: 'GPT-5.2 pro',
|
|
1264
|
+
inputPerMTok: 21,
|
|
1265
|
+
outputPerMTok: 168,
|
|
1266
|
+
contextWindow: 400_000,
|
|
1267
|
+
cacheMinTokens: 0,
|
|
1268
|
+
caching: 'none',
|
|
1269
|
+
multipliers: { batch: 0.5 },
|
|
1270
|
+
capability: 'frontier',
|
|
1271
|
+
tier: 'frontier',
|
|
1272
|
+
notes: OPENAI_EARLIER_NO_CACHE_NOTE,
|
|
1273
|
+
},
|
|
1274
|
+
{
|
|
1275
|
+
id: 'gpt-5.1',
|
|
1276
|
+
aliases: ['gpt-5.1-2025-11-13'],
|
|
1277
|
+
provider: 'openai',
|
|
1278
|
+
displayName: 'GPT-5.1',
|
|
1279
|
+
recommendable: false,
|
|
1280
|
+
inputPerMTok: 1.25,
|
|
1281
|
+
outputPerMTok: 10,
|
|
1282
|
+
contextWindow: 400_000,
|
|
1283
|
+
cacheMinTokens: 1024,
|
|
1284
|
+
caching: 'automatic',
|
|
1285
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1286
|
+
serviceTiers: {
|
|
1287
|
+
flex: { inputPerMTok: 0.625, outputPerMTok: 5 },
|
|
1288
|
+
fast: { inputPerMTok: 2.5, outputPerMTok: 20 },
|
|
1289
|
+
},
|
|
1290
|
+
capability: 'frontier',
|
|
1291
|
+
tier: 'frontier',
|
|
1292
|
+
notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
|
|
1293
|
+
},
|
|
1294
|
+
{
|
|
1295
|
+
id: 'gpt-5-pro',
|
|
1296
|
+
aliases: ['gpt-5-pro-2025-10-06'],
|
|
1297
|
+
provider: 'openai',
|
|
1298
|
+
displayName: 'GPT-5 pro',
|
|
1299
|
+
recommendable: false,
|
|
1300
|
+
inputPerMTok: 15,
|
|
1301
|
+
outputPerMTok: 120,
|
|
1302
|
+
contextWindow: 400_000,
|
|
1303
|
+
cacheMinTokens: 0,
|
|
1304
|
+
caching: 'none',
|
|
1305
|
+
multipliers: { batch: 0.5 },
|
|
1306
|
+
capability: 'frontier',
|
|
1307
|
+
tier: 'frontier',
|
|
1308
|
+
notes: OPENAI_EARLIER_NO_CACHE_NOTE + OPENAI_DEPRECATED_SUFFIX,
|
|
1309
|
+
},
|
|
1310
|
+
{
|
|
1311
|
+
id: 'gpt-4.1',
|
|
1312
|
+
aliases: ['gpt-4.1-2025-04-14'],
|
|
1313
|
+
provider: 'openai',
|
|
1314
|
+
displayName: 'GPT-4.1',
|
|
1315
|
+
recommendable: false,
|
|
1316
|
+
inputPerMTok: 2,
|
|
1317
|
+
outputPerMTok: 8,
|
|
1318
|
+
contextWindow: 1_047_576,
|
|
1319
|
+
cacheMinTokens: 1024,
|
|
1320
|
+
caching: 'automatic',
|
|
1321
|
+
multipliers: { cacheRead: 0.25, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1322
|
+
serviceTiers: {
|
|
1323
|
+
fast: { inputPerMTok: 3.5, outputPerMTok: 14 },
|
|
1324
|
+
},
|
|
1325
|
+
capability: 'large',
|
|
1326
|
+
tier: 'opus',
|
|
1327
|
+
notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
|
|
1328
|
+
},
|
|
1329
|
+
{
|
|
1330
|
+
id: 'gpt-4.1-mini',
|
|
1331
|
+
aliases: ['gpt-4.1-mini-2025-04-14'],
|
|
1332
|
+
provider: 'openai',
|
|
1333
|
+
displayName: 'GPT-4.1 mini',
|
|
1334
|
+
recommendable: false,
|
|
1335
|
+
inputPerMTok: 0.4,
|
|
1336
|
+
outputPerMTok: 1.6,
|
|
1337
|
+
contextWindow: 1_047_576,
|
|
1338
|
+
cacheMinTokens: 1024,
|
|
1339
|
+
caching: 'automatic',
|
|
1340
|
+
multipliers: { cacheRead: 0.25, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1341
|
+
serviceTiers: {
|
|
1342
|
+
fast: { inputPerMTok: 0.7, outputPerMTok: 2.8 },
|
|
1343
|
+
},
|
|
1344
|
+
capability: 'mid',
|
|
1345
|
+
tier: 'sonnet',
|
|
1346
|
+
notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
|
|
1347
|
+
},
|
|
1348
|
+
{
|
|
1349
|
+
id: 'gpt-4o',
|
|
1350
|
+
aliases: ['gpt-4o-2024-11-20', 'gpt-4o-2024-08-06'],
|
|
1351
|
+
provider: 'openai',
|
|
1352
|
+
displayName: 'GPT-4o',
|
|
1353
|
+
recommendable: false,
|
|
1354
|
+
inputPerMTok: 2.5,
|
|
1355
|
+
outputPerMTok: 10,
|
|
1356
|
+
contextWindow: 128_000,
|
|
1357
|
+
cacheMinTokens: 1024,
|
|
1358
|
+
caching: 'automatic',
|
|
1359
|
+
multipliers: { cacheRead: 0.5, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1360
|
+
serviceTiers: {
|
|
1361
|
+
fast: { inputPerMTok: 4.25, outputPerMTok: 17 },
|
|
1362
|
+
},
|
|
1363
|
+
capability: 'large',
|
|
1364
|
+
tier: 'opus',
|
|
1365
|
+
notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
|
|
1366
|
+
},
|
|
1367
|
+
{
|
|
1368
|
+
id: 'gpt-4o-mini',
|
|
1369
|
+
aliases: ['gpt-4o-mini-2024-07-18'],
|
|
1370
|
+
provider: 'openai',
|
|
1371
|
+
displayName: 'GPT-4o mini',
|
|
1372
|
+
recommendable: false,
|
|
1373
|
+
inputPerMTok: 0.15,
|
|
1374
|
+
outputPerMTok: 0.6,
|
|
1375
|
+
contextWindow: 128_000,
|
|
1376
|
+
cacheMinTokens: 1024,
|
|
1377
|
+
caching: 'automatic',
|
|
1378
|
+
multipliers: { cacheRead: 0.5, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1379
|
+
serviceTiers: {
|
|
1380
|
+
fast: { inputPerMTok: 0.25, outputPerMTok: 1 },
|
|
1381
|
+
},
|
|
1382
|
+
capability: 'small',
|
|
1383
|
+
tier: 'haiku',
|
|
1384
|
+
notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
|
|
1385
|
+
},
|
|
1386
|
+
{
|
|
1387
|
+
id: 'o3',
|
|
1388
|
+
aliases: ['o3-2025-04-16'],
|
|
1389
|
+
provider: 'openai',
|
|
1390
|
+
displayName: 'o3',
|
|
1391
|
+
recommendable: false,
|
|
1392
|
+
inputPerMTok: 2,
|
|
1393
|
+
outputPerMTok: 8,
|
|
1394
|
+
contextWindow: 200_000,
|
|
1395
|
+
cacheMinTokens: 1024,
|
|
1396
|
+
caching: 'automatic',
|
|
1397
|
+
multipliers: { cacheRead: 0.25, cacheWrite5m: 1, cacheWrite1h: 1, batch: 0.5 },
|
|
1398
|
+
serviceTiers: {
|
|
1399
|
+
flex: { inputPerMTok: 1, outputPerMTok: 4 },
|
|
1400
|
+
fast: { inputPerMTok: 3.5, outputPerMTok: 14 },
|
|
1401
|
+
},
|
|
1402
|
+
capability: 'frontier',
|
|
1403
|
+
tier: 'frontier',
|
|
1404
|
+
notes: OPENAI_EARLIER_NOTE + OPENAI_DEPRECATED_SUFFIX,
|
|
1405
|
+
},
|
|
1406
|
+
{
|
|
1407
|
+
id: 'o3-pro',
|
|
1408
|
+
aliases: ['o3-pro-2025-06-10'],
|
|
1409
|
+
provider: 'openai',
|
|
1410
|
+
displayName: 'o3-pro',
|
|
1411
|
+
recommendable: false,
|
|
1412
|
+
inputPerMTok: 20,
|
|
1413
|
+
outputPerMTok: 80,
|
|
1414
|
+
contextWindow: 200_000,
|
|
1415
|
+
cacheMinTokens: 0,
|
|
1416
|
+
caching: 'none',
|
|
1417
|
+
multipliers: { batch: 0.5 },
|
|
1418
|
+
capability: 'frontier',
|
|
1419
|
+
tier: 'frontier',
|
|
1420
|
+
notes: OPENAI_EARLIER_NO_CACHE_NOTE + OPENAI_DEPRECATED_SUFFIX,
|
|
1421
|
+
},
|
|
1422
|
+
// ------------------------------------------------------------------------
|
|
1423
|
+
// The Codex models and chat-latest. Codex CLI sessions name these, and none
|
|
1424
|
+
// was priced, so every such call read as unpriced. Each from its own model
|
|
1425
|
+
// page (developers.openai.com/api/docs/models/<id>.md), read 2026-11-05,
|
|
1426
|
+
// and gpt-5.3-codex and chat-latest also from the pricing page's
|
|
1427
|
+
// "Specialized models" table. Every page says Batch is "Not supported", so
|
|
1428
|
+
// none has a batch price. gpt-5.3-codex is deprecated and the rest of the
|
|
1429
|
+
// Codex line is shut down; all are priced for the logs that hold them and
|
|
1430
|
+
// never recommended. chat-latest is served and not recommended either: it
|
|
1431
|
+
// points at whatever model ChatGPT uses, so a recommendation would not name
|
|
1432
|
+
// a fixed model. Cache reads are 0.1x everywhere but codex-mini-latest,
|
|
1433
|
+
// whose page gives $0.375 on $1.50, 0.25x. gpt-5-search-api is on the
|
|
1434
|
+
// pricing page too and its model page returns 404, so it has no context
|
|
1435
|
+
// window and is left unpriced (see scripts/price-drift.mjs).
|
|
1436
|
+
// ------------------------------------------------------------------------
|
|
1437
|
+
{
|
|
1438
|
+
id: 'gpt-5.3-codex',
|
|
1439
|
+
provider: 'openai',
|
|
1440
|
+
displayName: 'GPT-5.3-Codex',
|
|
1441
|
+
recommendable: false,
|
|
1442
|
+
inputPerMTok: 1.75,
|
|
1443
|
+
outputPerMTok: 14,
|
|
1444
|
+
contextWindow: 400_000,
|
|
1445
|
+
cacheMinTokens: 1024,
|
|
1446
|
+
caching: 'automatic',
|
|
1447
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
|
|
1448
|
+
// The pricing page's specialized "Fast" table: $3.50/$28, cached $0.35.
|
|
1449
|
+
serviceTiers: { fast: { inputPerMTok: 3.5, outputPerMTok: 28 } },
|
|
1450
|
+
capability: 'frontier',
|
|
1451
|
+
tier: 'frontier',
|
|
1452
|
+
notes: OPENAI_CODEX_NOTE + ' At most 272,000 input tokens.' + OPENAI_DEPRECATED_SUFFIX,
|
|
1453
|
+
},
|
|
1454
|
+
{
|
|
1455
|
+
id: 'gpt-5.2-codex',
|
|
1456
|
+
provider: 'openai',
|
|
1457
|
+
displayName: 'GPT-5.2-Codex',
|
|
1458
|
+
recommendable: false,
|
|
1459
|
+
inputPerMTok: 1.75,
|
|
1460
|
+
outputPerMTok: 14,
|
|
1461
|
+
contextWindow: 400_000,
|
|
1462
|
+
cacheMinTokens: 1024,
|
|
1463
|
+
caching: 'automatic',
|
|
1464
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
|
|
1465
|
+
capability: 'frontier',
|
|
1466
|
+
tier: 'frontier',
|
|
1467
|
+
notes: OPENAI_CODEX_NOTE + ' At most 272,000 input tokens.' + OPENAI_SHUT_DOWN_SUFFIX,
|
|
1468
|
+
},
|
|
1469
|
+
{
|
|
1470
|
+
id: 'gpt-5.1-codex',
|
|
1471
|
+
provider: 'openai',
|
|
1472
|
+
displayName: 'GPT-5.1-Codex',
|
|
1473
|
+
recommendable: false,
|
|
1474
|
+
inputPerMTok: 1.25,
|
|
1475
|
+
outputPerMTok: 10,
|
|
1476
|
+
contextWindow: 400_000,
|
|
1477
|
+
cacheMinTokens: 1024,
|
|
1478
|
+
caching: 'automatic',
|
|
1479
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
|
|
1480
|
+
capability: 'frontier',
|
|
1481
|
+
tier: 'frontier',
|
|
1482
|
+
notes: OPENAI_CODEX_NOTE + OPENAI_SHUT_DOWN_SUFFIX,
|
|
1483
|
+
},
|
|
1484
|
+
{
|
|
1485
|
+
id: 'gpt-5.1-codex-max',
|
|
1486
|
+
provider: 'openai',
|
|
1487
|
+
displayName: 'GPT-5.1-Codex-Max',
|
|
1488
|
+
recommendable: false,
|
|
1489
|
+
inputPerMTok: 1.25,
|
|
1490
|
+
outputPerMTok: 10,
|
|
1491
|
+
contextWindow: 400_000,
|
|
1492
|
+
cacheMinTokens: 1024,
|
|
1493
|
+
caching: 'automatic',
|
|
1494
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
|
|
1495
|
+
capability: 'frontier',
|
|
1496
|
+
tier: 'frontier',
|
|
1497
|
+
notes: OPENAI_CODEX_NOTE + OPENAI_SHUT_DOWN_SUFFIX,
|
|
1498
|
+
},
|
|
1499
|
+
{
|
|
1500
|
+
id: 'gpt-5.1-codex-mini',
|
|
1501
|
+
provider: 'openai',
|
|
1502
|
+
displayName: 'GPT-5.1-Codex Mini',
|
|
1503
|
+
recommendable: false,
|
|
1504
|
+
inputPerMTok: 0.25,
|
|
1505
|
+
outputPerMTok: 2,
|
|
1506
|
+
contextWindow: 400_000,
|
|
1507
|
+
cacheMinTokens: 1024,
|
|
1508
|
+
caching: 'automatic',
|
|
1509
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
|
|
1510
|
+
capability: 'mid',
|
|
1511
|
+
tier: 'sonnet',
|
|
1512
|
+
notes: OPENAI_CODEX_NOTE + OPENAI_SHUT_DOWN_SUFFIX,
|
|
1513
|
+
},
|
|
1514
|
+
{
|
|
1515
|
+
id: 'gpt-5-codex',
|
|
1516
|
+
provider: 'openai',
|
|
1517
|
+
displayName: 'GPT-5-Codex',
|
|
1518
|
+
recommendable: false,
|
|
1519
|
+
inputPerMTok: 1.25,
|
|
1520
|
+
outputPerMTok: 10,
|
|
1521
|
+
contextWindow: 400_000,
|
|
1522
|
+
cacheMinTokens: 1024,
|
|
1523
|
+
caching: 'automatic',
|
|
1524
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
|
|
1525
|
+
capability: 'frontier',
|
|
1526
|
+
tier: 'frontier',
|
|
1527
|
+
notes: OPENAI_CODEX_NOTE + ' At most 272,000 input tokens.' + OPENAI_SHUT_DOWN_SUFFIX,
|
|
1528
|
+
},
|
|
1529
|
+
{
|
|
1530
|
+
id: 'codex-mini-latest',
|
|
1531
|
+
provider: 'openai',
|
|
1532
|
+
displayName: 'codex-mini-latest',
|
|
1533
|
+
recommendable: false,
|
|
1534
|
+
inputPerMTok: 1.5,
|
|
1535
|
+
outputPerMTok: 6,
|
|
1536
|
+
contextWindow: 200_000,
|
|
1537
|
+
cacheMinTokens: 1024,
|
|
1538
|
+
caching: 'automatic',
|
|
1539
|
+
multipliers: { cacheRead: 0.25, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
|
|
1540
|
+
capability: 'mid',
|
|
1541
|
+
tier: 'sonnet',
|
|
1542
|
+
notes: OPENAI_CODEX_NOTE + ' A cache read costs 0.25x input.' + OPENAI_SHUT_DOWN_SUFFIX,
|
|
1543
|
+
},
|
|
1544
|
+
{
|
|
1545
|
+
id: 'chat-latest',
|
|
1546
|
+
provider: 'openai',
|
|
1547
|
+
displayName: 'Chat Latest',
|
|
1548
|
+
recommendable: false,
|
|
1549
|
+
inputPerMTok: 5,
|
|
1550
|
+
outputPerMTok: 30,
|
|
1551
|
+
contextWindow: 400_000,
|
|
1552
|
+
cacheMinTokens: 1024,
|
|
1553
|
+
caching: 'automatic',
|
|
1554
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 1, batch: null },
|
|
1555
|
+
capability: 'large',
|
|
1556
|
+
tier: 'opus',
|
|
1557
|
+
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.',
|
|
734
1558
|
},
|
|
735
1559
|
|
|
736
1560
|
// ------------------------------------------------------------------------
|
|
@@ -891,7 +1715,55 @@ export const MODELS: ModelPricing[] = [
|
|
|
891
1715
|
* $0.30. The K2 series bills no write, and reads at its own hit price. Batch
|
|
892
1716
|
* is 60% of standard on K2.7 Code and K2.6 and not offered on K3 or the
|
|
893
1717
|
* high-speed K2.7. No cache minimum is published for any of them.
|
|
1718
|
+
*
|
|
1719
|
+
* Re-read 2026-11-05. The Markdown form now ships the price tables empty
|
|
1720
|
+
* (`<tbody />`); the figures are in the HTML page's compiled table rows,
|
|
1721
|
+
* read there. Every existing price matched. Three changes: Kimi K3.1 Pro
|
|
1722
|
+
* and its high-speed variant are new; the batch page now lists K3 and K3.1
|
|
1723
|
+
* Pro at 60% ("billed at 60% of the standard price"), so K3 has a batch
|
|
1724
|
+
* price; and the K2 series is closed to accounts registered from 2026-11-01
|
|
1725
|
+
* and retires "by the end of December 2026", so it is no longer recommended.
|
|
894
1726
|
*/
|
|
1727
|
+
{
|
|
1728
|
+
/*
|
|
1729
|
+
* $2/$10, cached input $0.20, cache writes $2.00 for 5 minutes and $4.00
|
|
1730
|
+
* for an hour; batch 60%; 1,048,576 context, as every K3-series model.
|
|
1731
|
+
*/
|
|
1732
|
+
id: 'kimi-k3.1-pro',
|
|
1733
|
+
provider: 'moonshot',
|
|
1734
|
+
displayName: 'Kimi K3.1 Pro',
|
|
1735
|
+
inputPerMTok: 2,
|
|
1736
|
+
outputPerMTok: 10,
|
|
1737
|
+
contextWindow: 1_048_576,
|
|
1738
|
+
cacheMinTokens: null,
|
|
1739
|
+
caching: 'automatic',
|
|
1740
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 2, batch: 0.6 },
|
|
1741
|
+
capability: 'frontier',
|
|
1742
|
+
tier: 'frontier',
|
|
1743
|
+
notes:
|
|
1744
|
+
'Cache writes are billed as their own line: 1x input for a 5-minute entry, 2x for an hour.'
|
|
1745
|
+
+ ` ${NO_PUBLISHED_CACHE_MINIMUM}`,
|
|
1746
|
+
},
|
|
1747
|
+
{
|
|
1748
|
+
/*
|
|
1749
|
+
* $4/$20, cached input $0.20 (5% of its input), writes $4.00 and $8.00.
|
|
1750
|
+
* Not on the batch page's list, so no batch price.
|
|
1751
|
+
*/
|
|
1752
|
+
id: 'kimi-k3.1-pro-highspeed',
|
|
1753
|
+
provider: 'moonshot',
|
|
1754
|
+
displayName: 'Kimi K3.1 Pro (high speed)',
|
|
1755
|
+
inputPerMTok: 4,
|
|
1756
|
+
outputPerMTok: 20,
|
|
1757
|
+
contextWindow: 1_048_576,
|
|
1758
|
+
cacheMinTokens: null,
|
|
1759
|
+
caching: 'automatic',
|
|
1760
|
+
multipliers: { cacheRead: 0.05, cacheWrite5m: 1, cacheWrite1h: 2, batch: null },
|
|
1761
|
+
capability: 'frontier',
|
|
1762
|
+
tier: 'frontier',
|
|
1763
|
+
notes:
|
|
1764
|
+
'Cache writes are billed as their own line: 1x input for a 5-minute entry, 2x for an hour.'
|
|
1765
|
+
+ ` No batch API for this model. ${NO_PUBLISHED_CACHE_MINIMUM}`,
|
|
1766
|
+
},
|
|
895
1767
|
{
|
|
896
1768
|
id: 'kimi-k3',
|
|
897
1769
|
provider: 'moonshot',
|
|
@@ -901,17 +1773,19 @@ export const MODELS: ModelPricing[] = [
|
|
|
901
1773
|
contextWindow: 1_048_576,
|
|
902
1774
|
cacheMinTokens: null,
|
|
903
1775
|
caching: 'automatic',
|
|
904
|
-
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 2, batch:
|
|
1776
|
+
multipliers: { cacheRead: 0.1, cacheWrite5m: 1, cacheWrite1h: 2, batch: 0.6 },
|
|
905
1777
|
capability: 'frontier',
|
|
906
1778
|
tier: 'frontier',
|
|
907
1779
|
notes:
|
|
908
1780
|
'Cache writes are billed as their own line: 1x input for a 5-minute entry, 2x for an hour.'
|
|
909
|
-
+ `
|
|
1781
|
+
+ ` Batch at 60% since the batch page listed it (read 2026-11-05). ${NO_PUBLISHED_CACHE_MINIMUM}`,
|
|
910
1782
|
},
|
|
911
1783
|
{
|
|
912
1784
|
id: 'kimi-k2.7-code',
|
|
913
1785
|
provider: 'moonshot',
|
|
914
1786
|
displayName: 'Kimi K2.7 Code',
|
|
1787
|
+
// Closed to accounts registered from 2026-11-01; the K2 series retires by the end of December 2026.
|
|
1788
|
+
recommendable: false,
|
|
915
1789
|
inputPerMTok: 0.95,
|
|
916
1790
|
outputPerMTok: 4,
|
|
917
1791
|
contextWindow: 262_144,
|
|
@@ -927,6 +1801,8 @@ export const MODELS: ModelPricing[] = [
|
|
|
927
1801
|
id: 'kimi-k2.7-code-highspeed',
|
|
928
1802
|
provider: 'moonshot',
|
|
929
1803
|
displayName: 'Kimi K2.7 Code (high speed)',
|
|
1804
|
+
// Closed to accounts registered from 2026-11-01; the K2 series retires by the end of December 2026.
|
|
1805
|
+
recommendable: false,
|
|
930
1806
|
inputPerMTok: 1.9,
|
|
931
1807
|
outputPerMTok: 8,
|
|
932
1808
|
contextWindow: 262_144,
|
|
@@ -942,6 +1818,8 @@ export const MODELS: ModelPricing[] = [
|
|
|
942
1818
|
id: 'kimi-k2.6',
|
|
943
1819
|
provider: 'moonshot',
|
|
944
1820
|
displayName: 'Kimi K2.6',
|
|
1821
|
+
// Closed to accounts registered from 2026-11-01; the K2 series retires by the end of December 2026.
|
|
1822
|
+
recommendable: false,
|
|
945
1823
|
inputPerMTok: 0.95,
|
|
946
1824
|
outputPerMTok: 4,
|
|
947
1825
|
contextWindow: 262_144,
|
|
@@ -1559,6 +2437,8 @@ interface Rates {
|
|
|
1559
2437
|
*/
|
|
1560
2438
|
floor?: { inputPerMTok: number; outputPerMTok: number };
|
|
1561
2439
|
} | null;
|
|
2440
|
+
/** The service tier whose table priced the call, when it was not the standard one. */
|
|
2441
|
+
serviceTier?: ServiceTier;
|
|
1562
2442
|
}
|
|
1563
2443
|
|
|
1564
2444
|
/**
|
|
@@ -1579,6 +2459,63 @@ interface Rates {
|
|
|
1579
2459
|
export interface PromptSize {
|
|
1580
2460
|
inputTokens?: number;
|
|
1581
2461
|
inputTokensAtMost?: number;
|
|
2462
|
+
/** The response's `usage.speed`, when the log kept it: `"fast"` or `"standard"`. */
|
|
2463
|
+
speed?: string;
|
|
2464
|
+
/**
|
|
2465
|
+
* The response's `service_tier`, when the log kept it: OpenAI's `"flex"`,
|
|
2466
|
+
* `"priority"` or `"fast"`, `"ultrafast"`, or `"default"`. Normalised by
|
|
2467
|
+
* `serviceTierOf`; anything else prices at the standard rate.
|
|
2468
|
+
*/
|
|
2469
|
+
serviceTier?: string;
|
|
2470
|
+
}
|
|
2471
|
+
|
|
2472
|
+
/**
|
|
2473
|
+
* A response's `service_tier` as the tier whose table prices it, or
|
|
2474
|
+
* `undefined` for the standard one.
|
|
2475
|
+
*
|
|
2476
|
+
* OpenAI renamed Priority processing to Fast mode on 2026-07-30, and its guide
|
|
2477
|
+
* says "for GPT-5.6 and earlier models, the response returns `priority`
|
|
2478
|
+
* whether the request specifies `priority` or `fast`", so both spellings are
|
|
2479
|
+
* the Fast table. `"default"` is the standard tier, and is also what a Fast
|
|
2480
|
+
* request downgraded under the ramp-rate limit returns, "and charge standard
|
|
2481
|
+
* rates". `"auto"` and `"scale"`, or a value this table has never seen, are
|
|
2482
|
+
* priced at the standard rate rather than guessed into another tier.
|
|
2483
|
+
*/
|
|
2484
|
+
export function serviceTierOf(value: unknown): ServiceTier | undefined {
|
|
2485
|
+
if (typeof value !== 'string') return undefined;
|
|
2486
|
+
const tier = value.trim().toLowerCase();
|
|
2487
|
+
if (tier === 'flex') return 'flex';
|
|
2488
|
+
if (tier === 'fast' || tier === 'priority') return 'fast';
|
|
2489
|
+
if (tier === 'ultrafast') return 'ultrafast';
|
|
2490
|
+
return undefined;
|
|
2491
|
+
}
|
|
2492
|
+
|
|
2493
|
+
/**
|
|
2494
|
+
* The row as one service tier prices it: that tier's rates and long band, the
|
|
2495
|
+
* row's own cache and batch ratios. Built once per row and tier.
|
|
2496
|
+
*/
|
|
2497
|
+
const serviceTierMemo = new WeakMap<ModelPricing, Map<ServiceTier, ModelPricing>>();
|
|
2498
|
+
|
|
2499
|
+
function serviceTierRow(model: ModelPricing, tier: ServiceTier): ModelPricing | undefined {
|
|
2500
|
+
const sheet = model.serviceTiers?.[tier];
|
|
2501
|
+
if (sheet === undefined) return undefined;
|
|
2502
|
+
let rows = serviceTierMemo.get(model);
|
|
2503
|
+
if (rows === undefined) {
|
|
2504
|
+
rows = new Map();
|
|
2505
|
+
serviceTierMemo.set(model, rows);
|
|
2506
|
+
}
|
|
2507
|
+
let row = rows.get(tier);
|
|
2508
|
+
if (row === undefined) {
|
|
2509
|
+
const { history: _history, promo: _promo, tiers: _tiers, serviceTiers: _serviceTiers, ...rest } = model;
|
|
2510
|
+
row = Object.freeze({
|
|
2511
|
+
...rest,
|
|
2512
|
+
inputPerMTok: sheet.inputPerMTok,
|
|
2513
|
+
outputPerMTok: sheet.outputPerMTok,
|
|
2514
|
+
...(sheet.tiers !== undefined ? { tiers: sheet.tiers } : {}),
|
|
2515
|
+
});
|
|
2516
|
+
rows.set(tier, row);
|
|
2517
|
+
}
|
|
2518
|
+
return row;
|
|
1582
2519
|
}
|
|
1583
2520
|
|
|
1584
2521
|
const pricingMemo = new WeakMap<
|
|
@@ -1599,7 +2536,8 @@ function pricedAt(model: ModelPricing, on: Date): ModelPricing {
|
|
|
1599
2536
|
let periods = periodMemo.get(model);
|
|
1600
2537
|
if (periods === undefined) {
|
|
1601
2538
|
periods = history.map((period) => {
|
|
1602
|
-
|
|
2539
|
+
// A period's own price only: the service tiers below are today's tables.
|
|
2540
|
+
const { history: _history, promo: _promo, tiers: _tiers, multipliers: _multipliers, serviceTiers: _serviceTiers, ...rest } = model;
|
|
1603
2541
|
const row: ModelPricing = Object.freeze({
|
|
1604
2542
|
...rest,
|
|
1605
2543
|
inputPerMTok: period.inputPerMTok,
|
|
@@ -1655,6 +2593,8 @@ function cache(model: ModelPricing): {
|
|
|
1655
2593
|
* collapsing them is the oldest mistake in this repository.
|
|
1656
2594
|
*/
|
|
1657
2595
|
function holds(when: TierCondition, on: Date, size: PromptSize): boolean | null {
|
|
2596
|
+
// Decided either way: a log that does not record a speed never asked for fast mode.
|
|
2597
|
+
if (when.kind === 'speed') return (size.speed ?? 'standard') === when.speed;
|
|
1658
2598
|
if (when.kind === 'utc-hours') {
|
|
1659
2599
|
const day = on.getUTCDay();
|
|
1660
2600
|
if (when.weekdaysOnly && (day === 0 || day === 6)) return false;
|
|
@@ -1694,6 +2634,18 @@ export function effectivePricing(
|
|
|
1694
2634
|
const period = pricedAt(model, on);
|
|
1695
2635
|
if (period !== model) return effectivePricing(period, on, context);
|
|
1696
2636
|
}
|
|
2637
|
+
/*
|
|
2638
|
+
* A response that names another service tier is priced by that tier's own
|
|
2639
|
+
* table, long band included, and by nothing composed out of two.
|
|
2640
|
+
*/
|
|
2641
|
+
if (context.serviceTier !== undefined && model.serviceTiers !== undefined) {
|
|
2642
|
+
const named = serviceTierOf(context.serviceTier);
|
|
2643
|
+
const row = named === undefined ? undefined : serviceTierRow(model, named);
|
|
2644
|
+
if (row !== undefined) {
|
|
2645
|
+
const { serviceTier: _serviceTier, ...size } = context;
|
|
2646
|
+
return { ...effectivePricing(row, on, size), serviceTier: named };
|
|
2647
|
+
}
|
|
2648
|
+
}
|
|
1697
2649
|
const memo = pricingMemo.get(model) ?? cache(model);
|
|
1698
2650
|
|
|
1699
2651
|
/**
|
|
@@ -1769,6 +2721,7 @@ export function effectivePricing(
|
|
|
1769
2721
|
|
|
1770
2722
|
/** One condition as a sentence a reader can check against a provider's page. */
|
|
1771
2723
|
function describe(when: TierCondition): string {
|
|
2724
|
+
if (when.kind === 'speed') return `${when.speed} mode (the response's usage.speed is "${when.speed}")`;
|
|
1772
2725
|
if (when.kind === 'input-tokens-above') {
|
|
1773
2726
|
return `prompts over ${when.tokens.toLocaleString('en-US')} input tokens`;
|
|
1774
2727
|
}
|