@molecule/api-resource-ai-models 1.14.0 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -7
- package/dist/lookup.d.ts +21 -1
- package/dist/lookup.d.ts.map +1 -1
- package/dist/lookup.js +30 -2
- package/dist/models.d.ts +3 -2
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js +3 -2
- package/dist/types.d.ts +19 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-10-
|
|
6
|
+
Generated: 2026-10-08T16:53:19.950Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/api-resource-ai-models
|
|
@@ -343,7 +343,16 @@ interface ModelDefinition {
|
|
|
343
343
|
* unchanged. To schedule the END of peak pricing, declare an explicit
|
|
344
344
|
* `{ windows: [], multiplier: 1 }`.
|
|
345
345
|
*
|
|
346
|
-
*
|
|
346
|
+
* `longContextPricing` here, when declared, replaces the model's long-context
|
|
347
|
+
* band from the same instant; when omitted, the existing band carries through
|
|
348
|
+
* unchanged. The band that bills AFTER the instant (declared here, or the
|
|
349
|
+
* carried-through one) must stay strictly dearer than the scheduled base
|
|
350
|
+
* rates — the catalog invariant test enforces that at staging time, so a
|
|
351
|
+
* banded model's price change can never land with a stale band silently
|
|
352
|
+
* under-metering its most expensive prompts.
|
|
353
|
+
*
|
|
354
|
+
* Resolution is `effectiveBaseRates()` / `effectivePeakPricing()` /
|
|
355
|
+
* `effectiveLongContextPricing()`, and every
|
|
347
356
|
* consumer reaches it through `modelRegionRates()` / `priceMultiplierAt()` /
|
|
348
357
|
* the `withEffectivePricing()` projection the list handler serves — so a
|
|
349
358
|
* scheduled change lands everywhere at once with no follow-up edit. Once the
|
|
@@ -368,6 +377,12 @@ interface ModelDefinition {
|
|
|
368
377
|
excludedDatesUtc?: string[]
|
|
369
378
|
rule?: { url: string; text: string }
|
|
370
379
|
}
|
|
380
|
+
/**
|
|
381
|
+
* Long-context band from `effectiveFrom` (omitted → the model's existing
|
|
382
|
+
* band carries through unchanged). Indexed off the model-level field so
|
|
383
|
+
* the two shapes can never drift apart.
|
|
384
|
+
*/
|
|
385
|
+
longContextPricing?: ModelDefinition['longContextPricing']
|
|
371
386
|
/** Where the change was announced, for the re-verify pass after it lands. */
|
|
372
387
|
source?: string
|
|
373
388
|
}
|
|
@@ -397,8 +412,9 @@ interface ModelDefinition {
|
|
|
397
412
|
* whose prompt (fresh input + cache read + cache write tokens) EXCEEDS `aboveInputTokens` bills ALL of its tokens at
|
|
398
413
|
* these rates, not just the excess. Resolved by `modelRegionRates(model, region, at, promptTokens)`; callers must pass
|
|
399
414
|
* ONE provider call's prompt size, never a multi-call sum. All four rates are required for the same never-under-meter
|
|
400
|
-
* reasons as the base rates. A
|
|
401
|
-
*
|
|
415
|
+
* reasons as the base rates. A staged `scheduledPricing` change can carry its own replacement band from the same
|
|
416
|
+
* instant (omitted → this band carries through) — resolved by `effectiveLongContextPricing()`. A `regionPricing`
|
|
417
|
+
* override is a different host's complete rate card, so the band never applies on top of an override.
|
|
402
418
|
*/
|
|
403
419
|
longContextPricing?: {
|
|
404
420
|
/** A prompt larger than this many tokens bills at the long-context rates. */
|
|
@@ -581,6 +597,40 @@ function effectiveBaseRates(modelDef: ModelDefinition, at?: Date): ModelTokenRat
|
|
|
581
597
|
|
|
582
598
|
**Returns:** The base rates in effect at that instant.
|
|
583
599
|
|
|
600
|
+
#### `effectiveLongContextPricing(modelDef, at)`
|
|
601
|
+
|
|
602
|
+
A model's long-context band in effect at a given instant: the staged
|
|
603
|
+
{@link ModelDefinition.scheduledPricing} `longContextPricing` once its
|
|
604
|
+
`effectiveFrom` has passed (when that entry declares one — an omitted one
|
|
605
|
+
leaves the model's existing band in force), else the model's own
|
|
606
|
+
{@link ModelDefinition.longContextPricing}.
|
|
607
|
+
|
|
608
|
+
This is what lets a banded model's price change move BOTH cards at once:
|
|
609
|
+
resolving the static band against landed scheduled base rates would leave
|
|
610
|
+
|
|
611
|
+
> threshold prompts on a stale card (possibly cheaper than the new base —
|
|
612
|
+
> silently under-metering the most expensive traffic).
|
|
613
|
+
|
|
614
|
+
```typescript
|
|
615
|
+
function effectiveLongContextPricing(
|
|
616
|
+
modelDef: ModelDefinition,
|
|
617
|
+
at?: Date,
|
|
618
|
+
):
|
|
619
|
+
| {
|
|
620
|
+
aboveInputTokens: number
|
|
621
|
+
inputPricePerMTok: number
|
|
622
|
+
outputPricePerMTok: number
|
|
623
|
+
cacheReadPricePerMTok: number
|
|
624
|
+
cacheWritePricePerMTok: number
|
|
625
|
+
}
|
|
626
|
+
| undefined
|
|
627
|
+
```
|
|
628
|
+
|
|
629
|
+
- `modelDef` — The model definition.
|
|
630
|
+
- `at` — The instant to evaluate (defaults to now).
|
|
631
|
+
|
|
632
|
+
**Returns:** The long-context band in effect, or `undefined` when none is.
|
|
633
|
+
|
|
584
634
|
#### `effectiveModelRegion(modelDef, requested)`
|
|
585
635
|
|
|
586
636
|
Resolve a model's effective processing region: the requested region when the
|
|
@@ -721,7 +771,10 @@ each request's own timestamp, the same way it must for
|
|
|
721
771
|
|
|
722
772
|
A model priced by prompt length ({@link ModelDefinition.longContextPricing}) bills a request whose
|
|
723
773
|
`promptTokens` EXCEED the threshold at the long-context rates (all of its tokens, not the excess). Pass ONE
|
|
724
|
-
provider call's prompt size (fresh input + cache read + cache write); omit it and the base rates apply.
|
|
774
|
+
provider call's prompt size (fresh input + cache read + cache write); omit it and the base rates apply. The
|
|
775
|
+
band itself is resolved at `at` via {@link effectiveLongContextPricing} — a landed
|
|
776
|
+
{@link ModelDefinition.scheduledPricing} change that declares its own band replaces the static one from
|
|
777
|
+
the same instant (an omitted one carries the static band through).
|
|
725
778
|
|
|
726
779
|
```typescript
|
|
727
780
|
function modelRegionRates(
|
|
@@ -936,8 +989,9 @@ Sources (verified 2026-07-28; OpenAI re-verified 2026-07-31 after the
|
|
|
936
989
|
moves claude-haiku-4-5 to "Legacy models (still available)" → superseded.
|
|
937
990
|
Model page + pricing page: $0.10/$0.50 per MTok for prompts up to 100K
|
|
938
991
|
tokens — the first Anthropic model priced BY PROMPT LENGTH (over 100K:
|
|
939
|
-
$0.50/$2.50, cache read $0.05, 5m write $0.625
|
|
940
|
-
Gemini/Grok >200K and GPT-6 >272K bands
|
|
992
|
+
$0.50/$2.50, cache read $0.05, 5m write $0.625 — modeled by
|
|
993
|
+
`longContextPricing`; the Gemini/Grok >200K and GPT-6 >272K bands are
|
|
994
|
+
NOT) — 5m cache write $0.125, cache
|
|
941
995
|
hits $0.01 (standard 0.1×), web search $10/1k. 1M ctx / 128K out, text +
|
|
942
996
|
image input, reliable knowledge cutoff Jun 2026. Effort page: all five
|
|
943
997
|
levels, default MEDIUM. Model page "Good to know": non-default
|
package/dist/lookup.d.ts
CHANGED
|
@@ -91,6 +91,23 @@ export declare function effectiveBaseRates(modelDef: ModelDefinition, at?: Date)
|
|
|
91
91
|
* @returns The peak-pricing config in effect, or `undefined` when none is.
|
|
92
92
|
*/
|
|
93
93
|
export declare function effectivePeakPricing(modelDef: ModelDefinition, at?: Date): ModelDefinition['peakPricing'];
|
|
94
|
+
/**
|
|
95
|
+
* A model's long-context band in effect at a given instant: the staged
|
|
96
|
+
* {@link ModelDefinition.scheduledPricing} `longContextPricing` once its
|
|
97
|
+
* `effectiveFrom` has passed (when that entry declares one — an omitted one
|
|
98
|
+
* leaves the model's existing band in force), else the model's own
|
|
99
|
+
* {@link ModelDefinition.longContextPricing}.
|
|
100
|
+
*
|
|
101
|
+
* This is what lets a banded model's price change move BOTH cards at once:
|
|
102
|
+
* resolving the static band against landed scheduled base rates would leave
|
|
103
|
+
* >threshold prompts on a stale card (possibly cheaper than the new base —
|
|
104
|
+
* silently under-metering the most expensive traffic).
|
|
105
|
+
*
|
|
106
|
+
* @param modelDef - The model definition.
|
|
107
|
+
* @param at - The instant to evaluate (defaults to now).
|
|
108
|
+
* @returns The long-context band in effect, or `undefined` when none is.
|
|
109
|
+
*/
|
|
110
|
+
export declare function effectiveLongContextPricing(modelDef: ModelDefinition, at?: Date): ModelDefinition['longContextPricing'];
|
|
94
111
|
/**
|
|
95
112
|
* A model projected onto the pricing in effect at a given instant: the staged
|
|
96
113
|
* {@link ModelDefinition.scheduledPricing} rates folded into the base fields
|
|
@@ -172,7 +189,10 @@ export interface ModelTokenRates {
|
|
|
172
189
|
*
|
|
173
190
|
* A model priced by prompt length ({@link ModelDefinition.longContextPricing}) bills a request whose
|
|
174
191
|
* `promptTokens` EXCEED the threshold at the long-context rates (all of its tokens, not the excess). Pass ONE
|
|
175
|
-
* provider call's prompt size (fresh input + cache read + cache write); omit it and the base rates apply.
|
|
192
|
+
* provider call's prompt size (fresh input + cache read + cache write); omit it and the base rates apply. The
|
|
193
|
+
* band itself is resolved at `at` via {@link effectiveLongContextPricing} — a landed
|
|
194
|
+
* {@link ModelDefinition.scheduledPricing} change that declares its own band replaces the static one from
|
|
195
|
+
* the same instant (an omitted one carries the static band through).
|
|
176
196
|
*
|
|
177
197
|
* @param modelDef - The model definition.
|
|
178
198
|
* @param requested - The user's per-model region choice, if any.
|
package/dist/lookup.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lookup.d.ts","sourceRoot":"","sources":["../src/lookup.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAE/D;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,c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,EAAE,MAAM,GACjB,MAAM,CAGR;AAED,2DAA2D;AAC3D,MAAM,WAAW,eAAe;IAC9B,sDAAsD;IACtD,iBAAiB,EAAE,MAAM,CAAA;IACzB,8CAA8C;IAC9C,kBAAkB,EAAE,MAAM,CAAA;IAC1B,yDAAyD;IACzD,qBAAqB,EAAE,MAAM,CAAA;IAC7B,0DAA0D;IAC1D,sBAAsB,EAAE,MAAM,CAAA;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,eAAe,EACzB,SAAS,CAAC,EAAE,MAAM,EAClB,EAAE,GAAE,IAAiB,EACrB,YAAY,CAAC,EAAE,MAAM,GACpB,eAAe,CAqBjB"}
|
package/dist/lookup.js
CHANGED
|
@@ -151,6 +151,29 @@ export function effectivePeakPricing(modelDef, at = new Date()) {
|
|
|
151
151
|
}
|
|
152
152
|
return modelDef.peakPricing;
|
|
153
153
|
}
|
|
154
|
+
/**
|
|
155
|
+
* A model's long-context band in effect at a given instant: the staged
|
|
156
|
+
* {@link ModelDefinition.scheduledPricing} `longContextPricing` once its
|
|
157
|
+
* `effectiveFrom` has passed (when that entry declares one — an omitted one
|
|
158
|
+
* leaves the model's existing band in force), else the model's own
|
|
159
|
+
* {@link ModelDefinition.longContextPricing}.
|
|
160
|
+
*
|
|
161
|
+
* This is what lets a banded model's price change move BOTH cards at once:
|
|
162
|
+
* resolving the static band against landed scheduled base rates would leave
|
|
163
|
+
* >threshold prompts on a stale card (possibly cheaper than the new base —
|
|
164
|
+
* silently under-metering the most expensive traffic).
|
|
165
|
+
*
|
|
166
|
+
* @param modelDef - The model definition.
|
|
167
|
+
* @param at - The instant to evaluate (defaults to now).
|
|
168
|
+
* @returns The long-context band in effect, or `undefined` when none is.
|
|
169
|
+
*/
|
|
170
|
+
export function effectiveLongContextPricing(modelDef, at = new Date()) {
|
|
171
|
+
const scheduled = modelDef.scheduledPricing;
|
|
172
|
+
if (scheduled?.longContextPricing && scheduledPricingApplies(modelDef, at)) {
|
|
173
|
+
return scheduled.longContextPricing;
|
|
174
|
+
}
|
|
175
|
+
return modelDef.longContextPricing;
|
|
176
|
+
}
|
|
154
177
|
/**
|
|
155
178
|
* A model projected onto the pricing in effect at a given instant: the staged
|
|
156
179
|
* {@link ModelDefinition.scheduledPricing} rates folded into the base fields
|
|
@@ -171,10 +194,12 @@ export function withEffectivePricing(modelDef, at = new Date()) {
|
|
|
171
194
|
return modelDef;
|
|
172
195
|
const { scheduledPricing: _scheduledPricing, ...rest } = modelDef;
|
|
173
196
|
const peakPricing = effectivePeakPricing(modelDef, at);
|
|
197
|
+
const longContextPricing = effectiveLongContextPricing(modelDef, at);
|
|
174
198
|
return {
|
|
175
199
|
...rest,
|
|
176
200
|
...effectiveBaseRates(modelDef, at),
|
|
177
201
|
...(peakPricing ? { peakPricing } : {}),
|
|
202
|
+
...(longContextPricing ? { longContextPricing } : {}),
|
|
178
203
|
};
|
|
179
204
|
}
|
|
180
205
|
/**
|
|
@@ -267,7 +292,10 @@ export function effectiveModelRegion(modelDef, requested) {
|
|
|
267
292
|
*
|
|
268
293
|
* A model priced by prompt length ({@link ModelDefinition.longContextPricing}) bills a request whose
|
|
269
294
|
* `promptTokens` EXCEED the threshold at the long-context rates (all of its tokens, not the excess). Pass ONE
|
|
270
|
-
* provider call's prompt size (fresh input + cache read + cache write); omit it and the base rates apply.
|
|
295
|
+
* provider call's prompt size (fresh input + cache read + cache write); omit it and the base rates apply. The
|
|
296
|
+
* band itself is resolved at `at` via {@link effectiveLongContextPricing} — a landed
|
|
297
|
+
* {@link ModelDefinition.scheduledPricing} change that declares its own band replaces the static one from
|
|
298
|
+
* the same instant (an omitted one carries the static band through).
|
|
271
299
|
*
|
|
272
300
|
* @param modelDef - The model definition.
|
|
273
301
|
* @param requested - The user's per-model region choice, if any.
|
|
@@ -279,7 +307,7 @@ export function modelRegionRates(modelDef, requested, at = new Date(), promptTok
|
|
|
279
307
|
const region = effectiveModelRegion(modelDef, requested);
|
|
280
308
|
const override = modelDef.regionPricing?.[region];
|
|
281
309
|
if (!override) {
|
|
282
|
-
const longBand = modelDef
|
|
310
|
+
const longBand = effectiveLongContextPricing(modelDef, at);
|
|
283
311
|
if (longBand && typeof promptTokens === 'number' && promptTokens > longBand.aboveInputTokens) {
|
|
284
312
|
return {
|
|
285
313
|
inputPricePerMTok: longBand.inputPricePerMTok,
|
package/dist/models.d.ts
CHANGED
|
@@ -122,8 +122,9 @@ import type { ModelDefinition } from './types.js';
|
|
|
122
122
|
* moves claude-haiku-4-5 to "Legacy models (still available)" → superseded.
|
|
123
123
|
* Model page + pricing page: $0.10/$0.50 per MTok for prompts up to 100K
|
|
124
124
|
* tokens — the first Anthropic model priced BY PROMPT LENGTH (over 100K:
|
|
125
|
-
* $0.50/$2.50, cache read $0.05, 5m write $0.625
|
|
126
|
-
* Gemini/Grok >200K and GPT-6 >272K bands
|
|
125
|
+
* $0.50/$2.50, cache read $0.05, 5m write $0.625 — modeled by
|
|
126
|
+
* `longContextPricing`; the Gemini/Grok >200K and GPT-6 >272K bands are
|
|
127
|
+
* NOT) — 5m cache write $0.125, cache
|
|
127
128
|
* hits $0.01 (standard 0.1×), web search $10/1k. 1M ctx / 128K out, text +
|
|
128
129
|
* image input, reliable knowledge cutoff Jun 2026. Effort page: all five
|
|
129
130
|
* levels, default MEDIUM. Model page "Good to know": non-default
|
package/dist/models.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAwDjD
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAwDjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4TG;AACH,eAAO,MAAM,MAAM,EAAE,SAAS,eAAe,EA80EnC,CAAA"}
|
package/dist/models.js
CHANGED
|
@@ -171,8 +171,9 @@ const CHINA_PUBLIC_HOLIDAYS = [
|
|
|
171
171
|
* moves claude-haiku-4-5 to "Legacy models (still available)" → superseded.
|
|
172
172
|
* Model page + pricing page: $0.10/$0.50 per MTok for prompts up to 100K
|
|
173
173
|
* tokens — the first Anthropic model priced BY PROMPT LENGTH (over 100K:
|
|
174
|
-
* $0.50/$2.50, cache read $0.05, 5m write $0.625
|
|
175
|
-
* Gemini/Grok >200K and GPT-6 >272K bands
|
|
174
|
+
* $0.50/$2.50, cache read $0.05, 5m write $0.625 — modeled by
|
|
175
|
+
* `longContextPricing`; the Gemini/Grok >200K and GPT-6 >272K bands are
|
|
176
|
+
* NOT) — 5m cache write $0.125, cache
|
|
176
177
|
* hits $0.01 (standard 0.1×), web search $10/1k. 1M ctx / 128K out, text +
|
|
177
178
|
* image input, reliable knowledge cutoff Jun 2026. Effort page: all five
|
|
178
179
|
* levels, default MEDIUM. Model page "Good to know": non-default
|
package/dist/types.d.ts
CHANGED
|
@@ -319,7 +319,16 @@ export interface ModelDefinition {
|
|
|
319
319
|
* unchanged. To schedule the END of peak pricing, declare an explicit
|
|
320
320
|
* `{ windows: [], multiplier: 1 }`.
|
|
321
321
|
*
|
|
322
|
-
*
|
|
322
|
+
* `longContextPricing` here, when declared, replaces the model's long-context
|
|
323
|
+
* band from the same instant; when omitted, the existing band carries through
|
|
324
|
+
* unchanged. The band that bills AFTER the instant (declared here, or the
|
|
325
|
+
* carried-through one) must stay strictly dearer than the scheduled base
|
|
326
|
+
* rates — the catalog invariant test enforces that at staging time, so a
|
|
327
|
+
* banded model's price change can never land with a stale band silently
|
|
328
|
+
* under-metering its most expensive prompts.
|
|
329
|
+
*
|
|
330
|
+
* Resolution is `effectiveBaseRates()` / `effectivePeakPricing()` /
|
|
331
|
+
* `effectiveLongContextPricing()`, and every
|
|
323
332
|
* consumer reaches it through `modelRegionRates()` / `priceMultiplierAt()` /
|
|
324
333
|
* the `withEffectivePricing()` projection the list handler serves — so a
|
|
325
334
|
* scheduled change lands everywhere at once with no follow-up edit. Once the
|
|
@@ -351,6 +360,12 @@ export interface ModelDefinition {
|
|
|
351
360
|
text: string;
|
|
352
361
|
};
|
|
353
362
|
};
|
|
363
|
+
/**
|
|
364
|
+
* Long-context band from `effectiveFrom` (omitted → the model's existing
|
|
365
|
+
* band carries through unchanged). Indexed off the model-level field so
|
|
366
|
+
* the two shapes can never drift apart.
|
|
367
|
+
*/
|
|
368
|
+
longContextPricing?: ModelDefinition['longContextPricing'];
|
|
354
369
|
/** Where the change was announced, for the re-verify pass after it lands. */
|
|
355
370
|
source?: string;
|
|
356
371
|
};
|
|
@@ -380,8 +395,9 @@ export interface ModelDefinition {
|
|
|
380
395
|
* whose prompt (fresh input + cache read + cache write tokens) EXCEEDS `aboveInputTokens` bills ALL of its tokens at
|
|
381
396
|
* these rates, not just the excess. Resolved by `modelRegionRates(model, region, at, promptTokens)`; callers must pass
|
|
382
397
|
* ONE provider call's prompt size, never a multi-call sum. All four rates are required for the same never-under-meter
|
|
383
|
-
* reasons as the base rates. A
|
|
384
|
-
*
|
|
398
|
+
* reasons as the base rates. A staged `scheduledPricing` change can carry its own replacement band from the same
|
|
399
|
+
* instant (omitted → this band carries through) — resolved by `effectiveLongContextPricing()`. A `regionPricing`
|
|
400
|
+
* override is a different host's complete rate card, so the band never applies on top of an override.
|
|
385
401
|
*/
|
|
386
402
|
longContextPricing?: {
|
|
387
403
|
/** A prompt larger than this many tokens bills at the long-context rates. */
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GACpB,WAAW,GACX,QAAQ,GACR,QAAQ,GACR,KAAK,GACL,UAAU,GACV,MAAM,GACN,UAAU,GACV,SAAS,GACT,SAAS,GACT,OAAO;AACT;;;;;GAKG;GACD,QAAQ,CAAA;AAEZ;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAA;AAEhC;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,8DAA8D;IAC9D,EAAE,EAAE,MAAM,CAAA;IACV,2CAA2C;IAC3C,QAAQ,EAAE,YAAY,CAAA;IACtB,yDAAyD;IACzD,KAAK,EAAE,MAAM,CAAA;IACb,wCAAwC;IACxC,WAAW,EAAE,MAAM,CAAA;IACnB,8CAA8C;IAC9C,aAAa,EAAE,MAAM,CAAA;IACrB,0CAA0C;IAC1C,eAAe,EAAE,MAAM,CAAA;IACvB,uEAAuE;IACvE,gBAAgB,EAAE,OAAO,CAAA;IACzB,yFAAyF;IACzF,oBAAoB,EAAE,MAAM,CAAA;IAC5B;;;OAGG;IACH,oBAAoB,EAAE,OAAO,CAAA;IAC7B;;;;;;;;;;;;;;;;;;;OAmBG;IACH,qBAAqB,CAAC,EAAE,WAAW,EAAE,CAAA;IACrC;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,WAAW,CAAA;IAChC;;;;;;;;;;;OAWG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC3C,mEAAmE;IACnE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