@jaypie/llm 1.3.15 → 1.3.17
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/cjs/constants.d.ts +72 -8
- package/dist/cjs/index.cjs +239 -13
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +77 -11
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/operate/adapters/BedrockAdapter.d.ts +3 -1
- package/dist/esm/constants.d.ts +72 -8
- package/dist/esm/index.d.ts +77 -11
- package/dist/esm/index.js +239 -13
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/operate/adapters/BedrockAdapter.d.ts +3 -1
- package/package.json +2 -2
package/dist/cjs/index.d.cts
CHANGED
|
@@ -21,6 +21,8 @@ declare const EFFORT: {
|
|
|
21
21
|
};
|
|
22
22
|
type LlmEffort = (typeof EFFORT)[keyof typeof EFFORT];
|
|
23
23
|
declare const MODEL: {
|
|
24
|
+
NOVA_LITE: string;
|
|
25
|
+
NOVA_PRO: string;
|
|
24
26
|
FABLE: string;
|
|
25
27
|
OPUS: string;
|
|
26
28
|
SONNET: string;
|
|
@@ -29,6 +31,7 @@ declare const MODEL: {
|
|
|
29
31
|
FIREWORKS: {
|
|
30
32
|
DEEPSEEK: string;
|
|
31
33
|
GLM: string;
|
|
34
|
+
GPT_OSS: string;
|
|
32
35
|
KIMI: string;
|
|
33
36
|
MINIMAX: string;
|
|
34
37
|
QWEN: string;
|
|
@@ -52,17 +55,78 @@ declare const MODEL: {
|
|
|
52
55
|
SONNET: string;
|
|
53
56
|
};
|
|
54
57
|
};
|
|
58
|
+
/** Price of one million tokens, in US dollars. */
|
|
59
|
+
interface LlmModelCost {
|
|
60
|
+
/**
|
|
61
|
+
* Cache-read (cached input) tokens. Omitted when the provider does not price
|
|
62
|
+
* cache reads separately from uncached input.
|
|
63
|
+
*/
|
|
64
|
+
cachedInputRead?: number;
|
|
65
|
+
/**
|
|
66
|
+
* Cache-write tokens. A scalar when the rate does not vary by TTL (`0` where
|
|
67
|
+
* the provider publishes a free write); keyed by the same `"5m"` / `"1h"`
|
|
68
|
+
* literals as `LlmCache` when it does, so a cost calculation reads the TTL
|
|
69
|
+
* straight off `OperateRequest.cache`. Omitted means cache writes bill at the
|
|
70
|
+
* `input` rate.
|
|
71
|
+
*/
|
|
72
|
+
cachedInputWrite?: number | {
|
|
73
|
+
"1h": number;
|
|
74
|
+
"5m": number;
|
|
75
|
+
};
|
|
76
|
+
/** Uncached input tokens. */
|
|
77
|
+
input: number;
|
|
78
|
+
/** Output tokens. */
|
|
79
|
+
output: number;
|
|
80
|
+
/**
|
|
81
|
+
* Reasoning tokens, when billed at a rate other than `output`. Omitted means
|
|
82
|
+
* reasoning bills as output, which is true of every provider listed here.
|
|
83
|
+
*/
|
|
84
|
+
reasoning?: number;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Standard list price per million tokens, keyed by literal model id (verified
|
|
88
|
+
* 2026-07-21). Keys are string literals rather than `MODEL.*` references so a
|
|
89
|
+
* model retired from the catalog keeps its price here: historic ids stay
|
|
90
|
+
* priceable after they leave `MODEL.*`, which is what makes replaying old
|
|
91
|
+
* usage records possible.
|
|
92
|
+
*
|
|
93
|
+
* Caveats the numbers cannot carry:
|
|
94
|
+
* - **Standard rate only.** Introductory, batch, flex, priority, fast-mode, and
|
|
95
|
+
* data-residency rates are excluded. Sonnet 5 is listed at its standard
|
|
96
|
+
* $3/$15, not the introductory rate.
|
|
97
|
+
* - **Cache writes are Anthropic-only.** Bedrock publishes a literal $0 write
|
|
98
|
+
* for Amazon's own models, recorded here as `cachedInputWrite: 0`. Fireworks
|
|
99
|
+
* writes bill at the input rate. OpenAI and xAI discount reads automatically
|
|
100
|
+
* and publish no write premium. Google charges nothing to write an implicit
|
|
101
|
+
* cache; explicit caching bills storage per hour, a unit this table does not
|
|
102
|
+
* carry (and one `@jaypie/llm` does not wire).
|
|
103
|
+
* - **Short-context tier.** Long-prompt surcharges are not modeled: Gemini 3.1
|
|
104
|
+
* Pro doubles above 200K, Grok doubles at 200K, GPT-5.5 is 2x in / 1.5x out
|
|
105
|
+
* above 272K.
|
|
106
|
+
* - **Text rates.** Gemini prices audio input higher than text/image/video.
|
|
107
|
+
* - **Proxy routes are deliberately absent.** `MODEL.OPENROUTER.*`, and any
|
|
108
|
+
* uncatalogued Bedrock id reselling a third-party model, are another vendor's
|
|
109
|
+
* model behind a gateway, priced per route and per region, so no single rate
|
|
110
|
+
* here would be correct. Price those against the backend model, or against
|
|
111
|
+
* the gateway's own published rate. Amazon's own Nova models are first-class,
|
|
112
|
+
* not proxies, and are priced below at the standard US on-demand rate (`us.`
|
|
113
|
+
* geo profile for Nova 2 Lite; the `global.` profile is cheaper and is not
|
|
114
|
+
* modeled).
|
|
115
|
+
*
|
|
116
|
+
* Unlisted ids return `undefined` — callers must handle a miss.
|
|
117
|
+
*/
|
|
118
|
+
declare const COST: Record<string, LlmModelCost>;
|
|
55
119
|
declare const PROVIDER: {
|
|
56
120
|
readonly BEDROCK: {
|
|
57
|
-
readonly DEFAULT:
|
|
58
|
-
/** @deprecated Size tiers are retired in 2.0. Use PROVIDER.BEDROCK.DEFAULT. */
|
|
121
|
+
readonly DEFAULT: string;
|
|
122
|
+
/** @deprecated Size tiers are retired in 2.0. Use PROVIDER.BEDROCK.DEFAULT, or pick a specific model from MODEL.NOVA_*. */
|
|
59
123
|
readonly MODEL: {
|
|
60
|
-
readonly DEFAULT:
|
|
61
|
-
readonly LARGE:
|
|
62
|
-
readonly SMALL:
|
|
63
|
-
readonly TINY:
|
|
124
|
+
readonly DEFAULT: string;
|
|
125
|
+
readonly LARGE: string;
|
|
126
|
+
readonly SMALL: string;
|
|
127
|
+
readonly TINY: string;
|
|
64
128
|
};
|
|
65
|
-
readonly MODEL_MATCH_WORDS: readonly ["amazon.nova", "amazon.titan", "anthropic.claude", "cohere.command", "meta.llama", "mistral.mistral", "
|
|
129
|
+
readonly MODEL_MATCH_WORDS: readonly ["ai21.", "amazon.nova", "amazon.titan", "anthropic.claude", "cohere.command", "deepseek.", "google.gemma", "meta.llama", "mistral.mistral", "moonshotai.", "openai.gpt-oss", "qwen."];
|
|
66
130
|
readonly NAME: "bedrock";
|
|
67
131
|
readonly REGION: "AWS_REGION";
|
|
68
132
|
};
|
|
@@ -206,22 +270,24 @@ declare const DEFAULT: {
|
|
|
206
270
|
*/
|
|
207
271
|
declare const ALL: {
|
|
208
272
|
readonly BASE: readonly ["claude-sonnet-4-6", "gemini-3.1-pro-preview", "gpt-5.4", "grok-latest"];
|
|
209
|
-
readonly COMBINED: readonly ("claude-opus-4-8" | "claude-haiku-4-5" | "gemini-3.
|
|
273
|
+
readonly COMBINED: readonly ("claude-opus-4-8" | "claude-haiku-4-5" | "gemini-3.1-pro-preview" | "gpt-5.5" | "gpt-5.4-mini" | "gpt-5.4-nano" | "grok-latest" | "claude-sonnet-4-6" | "gemini-3.5-flash" | "gemini-3.1-flash-lite" | "gpt-5.4" | "grok-4-1-fast-reasoning" | "grok-4-1-fast-non-reasoning")[];
|
|
210
274
|
readonly LARGE: readonly ["claude-opus-4-8", "gemini-3.1-pro-preview", "gpt-5.5", "grok-latest"];
|
|
211
275
|
readonly SMALL: readonly ["claude-sonnet-4-6", "gemini-3.5-flash", "gpt-5.4-mini", "grok-4-1-fast-reasoning"];
|
|
212
276
|
readonly TINY: readonly ["claude-haiku-4-5", "gemini-3.1-flash-lite", "gpt-5.4-nano", "grok-4-1-fast-non-reasoning"];
|
|
213
277
|
};
|
|
214
278
|
|
|
215
279
|
declare const constants_ALL: typeof ALL;
|
|
280
|
+
declare const constants_COST: typeof COST;
|
|
216
281
|
declare const constants_DEFAULT: typeof DEFAULT;
|
|
217
282
|
declare const constants_EFFORT: typeof EFFORT;
|
|
218
283
|
type constants_LlmEffort = LlmEffort;
|
|
284
|
+
type constants_LlmModelCost = LlmModelCost;
|
|
219
285
|
type constants_LlmProviderName = LlmProviderName;
|
|
220
286
|
declare const constants_MODEL: typeof MODEL;
|
|
221
287
|
declare const constants_PROVIDER: typeof PROVIDER;
|
|
222
288
|
declare namespace constants {
|
|
223
|
-
export { constants_ALL as ALL, constants_DEFAULT as DEFAULT, constants_EFFORT as EFFORT, constants_MODEL as MODEL, constants_PROVIDER as PROVIDER };
|
|
224
|
-
export type { constants_LlmEffort as LlmEffort, constants_LlmProviderName as LlmProviderName };
|
|
289
|
+
export { constants_ALL as ALL, constants_COST as COST, constants_DEFAULT as DEFAULT, constants_EFFORT as EFFORT, constants_MODEL as MODEL, constants_PROVIDER as PROVIDER };
|
|
290
|
+
export type { constants_LlmEffort as LlmEffort, constants_LlmModelCost as LlmModelCost, constants_LlmProviderName as LlmProviderName };
|
|
225
291
|
}
|
|
226
292
|
|
|
227
293
|
interface LlmTool {
|
|
@@ -1042,4 +1108,4 @@ declare class XaiProvider implements LlmProvider {
|
|
|
1042
1108
|
}
|
|
1043
1109
|
|
|
1044
1110
|
export { BedrockProvider, ErrorCategory, FireworksProvider, GoogleProvider as GeminiProvider, GoogleProvider, JaypieToolkit, constants as LLM, Llm, LlmError, LlmMessageRole, LlmMessageType, LlmProgressEventType, LlmQuotaError, LlmRateLimitError, LlmStreamChunkType, LlmTransientError, LlmUnrecoverableError, OpenRouterProvider, Toolkit, XaiProvider, extractReasoning, isLlmOperateInput, isLlmOperateInputContent, isLlmOperateInputFile, isLlmOperateInputImage, jsonSchemaToNaturalSchema, naturalSchemaToJsonSchema, toolkit, tools };
|
|
1045
|
-
export type { LlmCache, LlmEffort, LlmErrorOptions, LlmExchangeCallback, LlmExchangeEnvelope, LlmExchangeRequest, LlmExchangeResolution, LlmExchangeResponse, LlmExchangeTiming, LlmFallbackConfig, LlmHistory, LlmInputContent, LlmInputContentFile, LlmInputContentImage, LlmInputContentText, LlmInputMessage, LlmMessageOptions, LlmModelOption, LlmOperateInput, LlmOperateInputContent, LlmOperateInputFile, LlmOperateInputImage, LlmOperateOptions, LlmOperateResponse, LlmOptions, LlmProgressCallback, LlmProgressEvent, LlmProgressToolCall, LlmProvider, LlmStreamChunk, LlmStreamChunkDone, LlmStreamChunkError, LlmStreamChunkText, LlmStreamChunkToolCall, LlmStreamChunkToolResult, LlmTool };
|
|
1111
|
+
export type { LlmCache, LlmEffort, LlmErrorOptions, LlmExchangeCallback, LlmExchangeEnvelope, LlmExchangeRequest, LlmExchangeResolution, LlmExchangeResponse, LlmExchangeTiming, LlmFallbackConfig, LlmHistory, LlmInputContent, LlmInputContentFile, LlmInputContentImage, LlmInputContentText, LlmInputMessage, LlmMessageOptions, LlmModelCost, LlmModelOption, LlmOperateInput, LlmOperateInputContent, LlmOperateInputFile, LlmOperateInputImage, LlmOperateOptions, LlmOperateResponse, LlmOptions, LlmProgressCallback, LlmProgressEvent, LlmProgressToolCall, LlmProvider, LlmStreamChunk, LlmStreamChunkDone, LlmStreamChunkError, LlmStreamChunkText, LlmStreamChunkToolCall, LlmStreamChunkToolResult, LlmTool };
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { default as Llm } from "./Llm.js";
|
|
2
2
|
export * as LLM from "./constants.js";
|
|
3
|
-
export type { LlmEffort } from "./constants.js";
|
|
3
|
+
export type { LlmEffort, LlmModelCost } from "./constants.js";
|
|
4
4
|
export type { LlmCache, LlmExchangeCallback, LlmExchangeEnvelope, LlmExchangeRequest, LlmExchangeResolution, LlmExchangeResponse, LlmExchangeTiming, LlmFallbackConfig, LlmHistory, LlmInputContent, LlmInputContentFile, LlmInputContentImage, LlmInputContentText, LlmInputMessage, LlmMessageOptions, LlmModelOption, LlmOperateInput, LlmOperateInputContent, LlmOperateInputFile, LlmOperateInputImage, LlmOperateOptions, LlmOperateResponse, LlmOptions, LlmProgressCallback, LlmProgressEvent, LlmProgressToolCall, LlmProvider, } from "./types/LlmProvider.interface.js";
|
|
5
5
|
export { LlmMessageRole, LlmMessageType, LlmProgressEventType, } from "./types/LlmProvider.interface.js";
|
|
6
6
|
export { isLlmOperateInput, isLlmOperateInputContent, isLlmOperateInputFile, isLlmOperateInputImage, } from "./types/LlmOperateInput.guards.js";
|
|
@@ -47,9 +47,11 @@ type BedrockRequest = Omit<ConverseCommandInput, "messages"> & {
|
|
|
47
47
|
type AnnotatedBedrockResponse = ConverseCommandOutput & {
|
|
48
48
|
__jaypieStructuredOutput?: boolean;
|
|
49
49
|
};
|
|
50
|
+
/** Exported for tests; not part of the package's public surface. */
|
|
51
|
+
export declare function isCachePointUnsupportedError(error: unknown): boolean;
|
|
50
52
|
export declare class BedrockAdapter extends BaseProviderAdapter {
|
|
51
53
|
readonly name: "bedrock";
|
|
52
|
-
readonly defaultModel:
|
|
54
|
+
readonly defaultModel: string;
|
|
53
55
|
private _modelsFallbackToStructuredOutputTool;
|
|
54
56
|
private _modelsWithoutTemperature;
|
|
55
57
|
private _modelsWithoutCachePoint;
|
package/dist/esm/constants.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export declare const EFFORT: {
|
|
|
16
16
|
};
|
|
17
17
|
export type LlmEffort = (typeof EFFORT)[keyof typeof EFFORT];
|
|
18
18
|
export declare const MODEL: {
|
|
19
|
+
NOVA_LITE: string;
|
|
20
|
+
NOVA_PRO: string;
|
|
19
21
|
FABLE: string;
|
|
20
22
|
OPUS: string;
|
|
21
23
|
SONNET: string;
|
|
@@ -24,6 +26,7 @@ export declare const MODEL: {
|
|
|
24
26
|
FIREWORKS: {
|
|
25
27
|
DEEPSEEK: string;
|
|
26
28
|
GLM: string;
|
|
29
|
+
GPT_OSS: string;
|
|
27
30
|
KIMI: string;
|
|
28
31
|
MINIMAX: string;
|
|
29
32
|
QWEN: string;
|
|
@@ -47,17 +50,78 @@ export declare const MODEL: {
|
|
|
47
50
|
SONNET: string;
|
|
48
51
|
};
|
|
49
52
|
};
|
|
53
|
+
/** Price of one million tokens, in US dollars. */
|
|
54
|
+
export interface LlmModelCost {
|
|
55
|
+
/**
|
|
56
|
+
* Cache-read (cached input) tokens. Omitted when the provider does not price
|
|
57
|
+
* cache reads separately from uncached input.
|
|
58
|
+
*/
|
|
59
|
+
cachedInputRead?: number;
|
|
60
|
+
/**
|
|
61
|
+
* Cache-write tokens. A scalar when the rate does not vary by TTL (`0` where
|
|
62
|
+
* the provider publishes a free write); keyed by the same `"5m"` / `"1h"`
|
|
63
|
+
* literals as `LlmCache` when it does, so a cost calculation reads the TTL
|
|
64
|
+
* straight off `OperateRequest.cache`. Omitted means cache writes bill at the
|
|
65
|
+
* `input` rate.
|
|
66
|
+
*/
|
|
67
|
+
cachedInputWrite?: number | {
|
|
68
|
+
"1h": number;
|
|
69
|
+
"5m": number;
|
|
70
|
+
};
|
|
71
|
+
/** Uncached input tokens. */
|
|
72
|
+
input: number;
|
|
73
|
+
/** Output tokens. */
|
|
74
|
+
output: number;
|
|
75
|
+
/**
|
|
76
|
+
* Reasoning tokens, when billed at a rate other than `output`. Omitted means
|
|
77
|
+
* reasoning bills as output, which is true of every provider listed here.
|
|
78
|
+
*/
|
|
79
|
+
reasoning?: number;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Standard list price per million tokens, keyed by literal model id (verified
|
|
83
|
+
* 2026-07-21). Keys are string literals rather than `MODEL.*` references so a
|
|
84
|
+
* model retired from the catalog keeps its price here: historic ids stay
|
|
85
|
+
* priceable after they leave `MODEL.*`, which is what makes replaying old
|
|
86
|
+
* usage records possible.
|
|
87
|
+
*
|
|
88
|
+
* Caveats the numbers cannot carry:
|
|
89
|
+
* - **Standard rate only.** Introductory, batch, flex, priority, fast-mode, and
|
|
90
|
+
* data-residency rates are excluded. Sonnet 5 is listed at its standard
|
|
91
|
+
* $3/$15, not the introductory rate.
|
|
92
|
+
* - **Cache writes are Anthropic-only.** Bedrock publishes a literal $0 write
|
|
93
|
+
* for Amazon's own models, recorded here as `cachedInputWrite: 0`. Fireworks
|
|
94
|
+
* writes bill at the input rate. OpenAI and xAI discount reads automatically
|
|
95
|
+
* and publish no write premium. Google charges nothing to write an implicit
|
|
96
|
+
* cache; explicit caching bills storage per hour, a unit this table does not
|
|
97
|
+
* carry (and one `@jaypie/llm` does not wire).
|
|
98
|
+
* - **Short-context tier.** Long-prompt surcharges are not modeled: Gemini 3.1
|
|
99
|
+
* Pro doubles above 200K, Grok doubles at 200K, GPT-5.5 is 2x in / 1.5x out
|
|
100
|
+
* above 272K.
|
|
101
|
+
* - **Text rates.** Gemini prices audio input higher than text/image/video.
|
|
102
|
+
* - **Proxy routes are deliberately absent.** `MODEL.OPENROUTER.*`, and any
|
|
103
|
+
* uncatalogued Bedrock id reselling a third-party model, are another vendor's
|
|
104
|
+
* model behind a gateway, priced per route and per region, so no single rate
|
|
105
|
+
* here would be correct. Price those against the backend model, or against
|
|
106
|
+
* the gateway's own published rate. Amazon's own Nova models are first-class,
|
|
107
|
+
* not proxies, and are priced below at the standard US on-demand rate (`us.`
|
|
108
|
+
* geo profile for Nova 2 Lite; the `global.` profile is cheaper and is not
|
|
109
|
+
* modeled).
|
|
110
|
+
*
|
|
111
|
+
* Unlisted ids return `undefined` — callers must handle a miss.
|
|
112
|
+
*/
|
|
113
|
+
export declare const COST: Record<string, LlmModelCost>;
|
|
50
114
|
export declare const PROVIDER: {
|
|
51
115
|
readonly BEDROCK: {
|
|
52
|
-
readonly DEFAULT:
|
|
53
|
-
/** @deprecated Size tiers are retired in 2.0. Use PROVIDER.BEDROCK.DEFAULT. */
|
|
116
|
+
readonly DEFAULT: string;
|
|
117
|
+
/** @deprecated Size tiers are retired in 2.0. Use PROVIDER.BEDROCK.DEFAULT, or pick a specific model from MODEL.NOVA_*. */
|
|
54
118
|
readonly MODEL: {
|
|
55
|
-
readonly DEFAULT:
|
|
56
|
-
readonly LARGE:
|
|
57
|
-
readonly SMALL:
|
|
58
|
-
readonly TINY:
|
|
119
|
+
readonly DEFAULT: string;
|
|
120
|
+
readonly LARGE: string;
|
|
121
|
+
readonly SMALL: string;
|
|
122
|
+
readonly TINY: string;
|
|
59
123
|
};
|
|
60
|
-
readonly MODEL_MATCH_WORDS: readonly ["amazon.nova", "amazon.titan", "anthropic.claude", "cohere.command", "meta.llama", "mistral.mistral", "
|
|
124
|
+
readonly MODEL_MATCH_WORDS: readonly ["ai21.", "amazon.nova", "amazon.titan", "anthropic.claude", "cohere.command", "deepseek.", "google.gemma", "meta.llama", "mistral.mistral", "moonshotai.", "openai.gpt-oss", "qwen."];
|
|
61
125
|
readonly NAME: "bedrock";
|
|
62
126
|
readonly REGION: "AWS_REGION";
|
|
63
127
|
};
|
|
@@ -201,7 +265,7 @@ export declare const DEFAULT: {
|
|
|
201
265
|
*/
|
|
202
266
|
export declare const ALL: {
|
|
203
267
|
readonly BASE: readonly ["claude-sonnet-4-6", "gemini-3.1-pro-preview", "gpt-5.4", "grok-latest"];
|
|
204
|
-
readonly COMBINED: readonly ("claude-opus-4-8" | "claude-haiku-4-5" | "gemini-3.
|
|
268
|
+
readonly COMBINED: readonly ("claude-opus-4-8" | "claude-haiku-4-5" | "gemini-3.1-pro-preview" | "gpt-5.5" | "gpt-5.4-mini" | "gpt-5.4-nano" | "grok-latest" | "claude-sonnet-4-6" | "gemini-3.1-flash-lite" | "gemini-3.5-flash" | "gpt-5.4" | "grok-4-1-fast-non-reasoning" | "grok-4-1-fast-reasoning")[];
|
|
205
269
|
readonly LARGE: readonly ["claude-opus-4-8", "gemini-3.1-pro-preview", "gpt-5.5", "grok-latest"];
|
|
206
270
|
readonly SMALL: readonly ["claude-sonnet-4-6", "gemini-3.5-flash", "gpt-5.4-mini", "grok-4-1-fast-reasoning"];
|
|
207
271
|
readonly TINY: readonly ["claude-haiku-4-5", "gemini-3.1-flash-lite", "gpt-5.4-nano", "grok-4-1-fast-non-reasoning"];
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -21,6 +21,8 @@ declare const EFFORT: {
|
|
|
21
21
|
};
|
|
22
22
|
type LlmEffort = (typeof EFFORT)[keyof typeof EFFORT];
|
|
23
23
|
declare const MODEL: {
|
|
24
|
+
NOVA_LITE: string;
|
|
25
|
+
NOVA_PRO: string;
|
|
24
26
|
FABLE: string;
|
|
25
27
|
OPUS: string;
|
|
26
28
|
SONNET: string;
|
|
@@ -29,6 +31,7 @@ declare const MODEL: {
|
|
|
29
31
|
FIREWORKS: {
|
|
30
32
|
DEEPSEEK: string;
|
|
31
33
|
GLM: string;
|
|
34
|
+
GPT_OSS: string;
|
|
32
35
|
KIMI: string;
|
|
33
36
|
MINIMAX: string;
|
|
34
37
|
QWEN: string;
|
|
@@ -52,17 +55,78 @@ declare const MODEL: {
|
|
|
52
55
|
SONNET: string;
|
|
53
56
|
};
|
|
54
57
|
};
|
|
58
|
+
/** Price of one million tokens, in US dollars. */
|
|
59
|
+
interface LlmModelCost {
|
|
60
|
+
/**
|
|
61
|
+
* Cache-read (cached input) tokens. Omitted when the provider does not price
|
|
62
|
+
* cache reads separately from uncached input.
|
|
63
|
+
*/
|
|
64
|
+
cachedInputRead?: number;
|
|
65
|
+
/**
|
|
66
|
+
* Cache-write tokens. A scalar when the rate does not vary by TTL (`0` where
|
|
67
|
+
* the provider publishes a free write); keyed by the same `"5m"` / `"1h"`
|
|
68
|
+
* literals as `LlmCache` when it does, so a cost calculation reads the TTL
|
|
69
|
+
* straight off `OperateRequest.cache`. Omitted means cache writes bill at the
|
|
70
|
+
* `input` rate.
|
|
71
|
+
*/
|
|
72
|
+
cachedInputWrite?: number | {
|
|
73
|
+
"1h": number;
|
|
74
|
+
"5m": number;
|
|
75
|
+
};
|
|
76
|
+
/** Uncached input tokens. */
|
|
77
|
+
input: number;
|
|
78
|
+
/** Output tokens. */
|
|
79
|
+
output: number;
|
|
80
|
+
/**
|
|
81
|
+
* Reasoning tokens, when billed at a rate other than `output`. Omitted means
|
|
82
|
+
* reasoning bills as output, which is true of every provider listed here.
|
|
83
|
+
*/
|
|
84
|
+
reasoning?: number;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Standard list price per million tokens, keyed by literal model id (verified
|
|
88
|
+
* 2026-07-21). Keys are string literals rather than `MODEL.*` references so a
|
|
89
|
+
* model retired from the catalog keeps its price here: historic ids stay
|
|
90
|
+
* priceable after they leave `MODEL.*`, which is what makes replaying old
|
|
91
|
+
* usage records possible.
|
|
92
|
+
*
|
|
93
|
+
* Caveats the numbers cannot carry:
|
|
94
|
+
* - **Standard rate only.** Introductory, batch, flex, priority, fast-mode, and
|
|
95
|
+
* data-residency rates are excluded. Sonnet 5 is listed at its standard
|
|
96
|
+
* $3/$15, not the introductory rate.
|
|
97
|
+
* - **Cache writes are Anthropic-only.** Bedrock publishes a literal $0 write
|
|
98
|
+
* for Amazon's own models, recorded here as `cachedInputWrite: 0`. Fireworks
|
|
99
|
+
* writes bill at the input rate. OpenAI and xAI discount reads automatically
|
|
100
|
+
* and publish no write premium. Google charges nothing to write an implicit
|
|
101
|
+
* cache; explicit caching bills storage per hour, a unit this table does not
|
|
102
|
+
* carry (and one `@jaypie/llm` does not wire).
|
|
103
|
+
* - **Short-context tier.** Long-prompt surcharges are not modeled: Gemini 3.1
|
|
104
|
+
* Pro doubles above 200K, Grok doubles at 200K, GPT-5.5 is 2x in / 1.5x out
|
|
105
|
+
* above 272K.
|
|
106
|
+
* - **Text rates.** Gemini prices audio input higher than text/image/video.
|
|
107
|
+
* - **Proxy routes are deliberately absent.** `MODEL.OPENROUTER.*`, and any
|
|
108
|
+
* uncatalogued Bedrock id reselling a third-party model, are another vendor's
|
|
109
|
+
* model behind a gateway, priced per route and per region, so no single rate
|
|
110
|
+
* here would be correct. Price those against the backend model, or against
|
|
111
|
+
* the gateway's own published rate. Amazon's own Nova models are first-class,
|
|
112
|
+
* not proxies, and are priced below at the standard US on-demand rate (`us.`
|
|
113
|
+
* geo profile for Nova 2 Lite; the `global.` profile is cheaper and is not
|
|
114
|
+
* modeled).
|
|
115
|
+
*
|
|
116
|
+
* Unlisted ids return `undefined` — callers must handle a miss.
|
|
117
|
+
*/
|
|
118
|
+
declare const COST: Record<string, LlmModelCost>;
|
|
55
119
|
declare const PROVIDER: {
|
|
56
120
|
readonly BEDROCK: {
|
|
57
|
-
readonly DEFAULT:
|
|
58
|
-
/** @deprecated Size tiers are retired in 2.0. Use PROVIDER.BEDROCK.DEFAULT. */
|
|
121
|
+
readonly DEFAULT: string;
|
|
122
|
+
/** @deprecated Size tiers are retired in 2.0. Use PROVIDER.BEDROCK.DEFAULT, or pick a specific model from MODEL.NOVA_*. */
|
|
59
123
|
readonly MODEL: {
|
|
60
|
-
readonly DEFAULT:
|
|
61
|
-
readonly LARGE:
|
|
62
|
-
readonly SMALL:
|
|
63
|
-
readonly TINY:
|
|
124
|
+
readonly DEFAULT: string;
|
|
125
|
+
readonly LARGE: string;
|
|
126
|
+
readonly SMALL: string;
|
|
127
|
+
readonly TINY: string;
|
|
64
128
|
};
|
|
65
|
-
readonly MODEL_MATCH_WORDS: readonly ["amazon.nova", "amazon.titan", "anthropic.claude", "cohere.command", "meta.llama", "mistral.mistral", "
|
|
129
|
+
readonly MODEL_MATCH_WORDS: readonly ["ai21.", "amazon.nova", "amazon.titan", "anthropic.claude", "cohere.command", "deepseek.", "google.gemma", "meta.llama", "mistral.mistral", "moonshotai.", "openai.gpt-oss", "qwen."];
|
|
66
130
|
readonly NAME: "bedrock";
|
|
67
131
|
readonly REGION: "AWS_REGION";
|
|
68
132
|
};
|
|
@@ -206,22 +270,24 @@ declare const DEFAULT: {
|
|
|
206
270
|
*/
|
|
207
271
|
declare const ALL: {
|
|
208
272
|
readonly BASE: readonly ["claude-sonnet-4-6", "gemini-3.1-pro-preview", "gpt-5.4", "grok-latest"];
|
|
209
|
-
readonly COMBINED: readonly ("claude-opus-4-8" | "claude-haiku-4-5" | "gemini-3.
|
|
273
|
+
readonly COMBINED: readonly ("claude-opus-4-8" | "claude-haiku-4-5" | "gemini-3.1-pro-preview" | "gpt-5.5" | "gpt-5.4-mini" | "gpt-5.4-nano" | "grok-latest" | "claude-sonnet-4-6" | "gemini-3.5-flash" | "gemini-3.1-flash-lite" | "gpt-5.4" | "grok-4-1-fast-reasoning" | "grok-4-1-fast-non-reasoning")[];
|
|
210
274
|
readonly LARGE: readonly ["claude-opus-4-8", "gemini-3.1-pro-preview", "gpt-5.5", "grok-latest"];
|
|
211
275
|
readonly SMALL: readonly ["claude-sonnet-4-6", "gemini-3.5-flash", "gpt-5.4-mini", "grok-4-1-fast-reasoning"];
|
|
212
276
|
readonly TINY: readonly ["claude-haiku-4-5", "gemini-3.1-flash-lite", "gpt-5.4-nano", "grok-4-1-fast-non-reasoning"];
|
|
213
277
|
};
|
|
214
278
|
|
|
215
279
|
declare const constants_ALL: typeof ALL;
|
|
280
|
+
declare const constants_COST: typeof COST;
|
|
216
281
|
declare const constants_DEFAULT: typeof DEFAULT;
|
|
217
282
|
declare const constants_EFFORT: typeof EFFORT;
|
|
218
283
|
type constants_LlmEffort = LlmEffort;
|
|
284
|
+
type constants_LlmModelCost = LlmModelCost;
|
|
219
285
|
type constants_LlmProviderName = LlmProviderName;
|
|
220
286
|
declare const constants_MODEL: typeof MODEL;
|
|
221
287
|
declare const constants_PROVIDER: typeof PROVIDER;
|
|
222
288
|
declare namespace constants {
|
|
223
|
-
export { constants_ALL as ALL, constants_DEFAULT as DEFAULT, constants_EFFORT as EFFORT, constants_MODEL as MODEL, constants_PROVIDER as PROVIDER };
|
|
224
|
-
export type { constants_LlmEffort as LlmEffort, constants_LlmProviderName as LlmProviderName };
|
|
289
|
+
export { constants_ALL as ALL, constants_COST as COST, constants_DEFAULT as DEFAULT, constants_EFFORT as EFFORT, constants_MODEL as MODEL, constants_PROVIDER as PROVIDER };
|
|
290
|
+
export type { constants_LlmEffort as LlmEffort, constants_LlmModelCost as LlmModelCost, constants_LlmProviderName as LlmProviderName };
|
|
225
291
|
}
|
|
226
292
|
|
|
227
293
|
interface LlmTool {
|
|
@@ -1042,4 +1108,4 @@ declare class XaiProvider implements LlmProvider {
|
|
|
1042
1108
|
}
|
|
1043
1109
|
|
|
1044
1110
|
export { BedrockProvider, ErrorCategory, FireworksProvider, GoogleProvider as GeminiProvider, GoogleProvider, JaypieToolkit, constants as LLM, Llm, LlmError, LlmMessageRole, LlmMessageType, LlmProgressEventType, LlmQuotaError, LlmRateLimitError, LlmStreamChunkType, LlmTransientError, LlmUnrecoverableError, OpenRouterProvider, Toolkit, XaiProvider, extractReasoning, isLlmOperateInput, isLlmOperateInputContent, isLlmOperateInputFile, isLlmOperateInputImage, jsonSchemaToNaturalSchema, naturalSchemaToJsonSchema, toolkit, tools };
|
|
1045
|
-
export type { LlmCache, LlmEffort, LlmErrorOptions, LlmExchangeCallback, LlmExchangeEnvelope, LlmExchangeRequest, LlmExchangeResolution, LlmExchangeResponse, LlmExchangeTiming, LlmFallbackConfig, LlmHistory, LlmInputContent, LlmInputContentFile, LlmInputContentImage, LlmInputContentText, LlmInputMessage, LlmMessageOptions, LlmModelOption, LlmOperateInput, LlmOperateInputContent, LlmOperateInputFile, LlmOperateInputImage, LlmOperateOptions, LlmOperateResponse, LlmOptions, LlmProgressCallback, LlmProgressEvent, LlmProgressToolCall, LlmProvider, LlmStreamChunk, LlmStreamChunkDone, LlmStreamChunkError, LlmStreamChunkText, LlmStreamChunkToolCall, LlmStreamChunkToolResult, LlmTool };
|
|
1111
|
+
export type { LlmCache, LlmEffort, LlmErrorOptions, LlmExchangeCallback, LlmExchangeEnvelope, LlmExchangeRequest, LlmExchangeResolution, LlmExchangeResponse, LlmExchangeTiming, LlmFallbackConfig, LlmHistory, LlmInputContent, LlmInputContentFile, LlmInputContentImage, LlmInputContentText, LlmInputMessage, LlmMessageOptions, LlmModelCost, LlmModelOption, LlmOperateInput, LlmOperateInputContent, LlmOperateInputFile, LlmOperateInputImage, LlmOperateOptions, LlmOperateResponse, LlmOptions, LlmProgressCallback, LlmProgressEvent, LlmProgressToolCall, LlmProvider, LlmStreamChunk, LlmStreamChunkDone, LlmStreamChunkError, LlmStreamChunkText, LlmStreamChunkToolCall, LlmStreamChunkToolResult, LlmTool };
|