@sudobility/shapeshyft_engine 1.0.2 → 1.0.4
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/config/providers.d.ts +26 -6
- package/dist/config/providers.d.ts.map +1 -1
- package/dist/config/providers.js +320 -142
- package/dist/config/providers.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/cost-estimation.d.ts +52 -0
- package/dist/lib/cost-estimation.d.ts.map +1 -0
- package/dist/lib/cost-estimation.js +121 -0
- package/dist/lib/cost-estimation.js.map +1 -0
- package/dist/services/llm/anthropic.d.ts.map +1 -1
- package/dist/services/llm/anthropic.js +9 -6
- package/dist/services/llm/anthropic.js.map +1 -1
- package/dist/services/llm/cohere-schema.d.ts +26 -0
- package/dist/services/llm/cohere-schema.d.ts.map +1 -0
- package/dist/services/llm/cohere-schema.js +103 -0
- package/dist/services/llm/cohere-schema.js.map +1 -0
- package/dist/services/llm/compatible-usage.d.ts +29 -0
- package/dist/services/llm/compatible-usage.d.ts.map +1 -0
- package/dist/services/llm/compatible-usage.js +116 -0
- package/dist/services/llm/compatible-usage.js.map +1 -0
- package/dist/services/llm/custom.d.ts.map +1 -1
- package/dist/services/llm/custom.js +12 -3
- package/dist/services/llm/custom.js.map +1 -1
- package/dist/services/llm/gemini.d.ts +9 -1
- package/dist/services/llm/gemini.d.ts.map +1 -1
- package/dist/services/llm/gemini.js +63 -10
- package/dist/services/llm/gemini.js.map +1 -1
- package/dist/services/llm/groq.d.ts +6 -0
- package/dist/services/llm/groq.d.ts.map +1 -1
- package/dist/services/llm/groq.js +81 -14
- package/dist/services/llm/groq.js.map +1 -1
- package/dist/services/llm/index.d.ts +2 -2
- package/dist/services/llm/index.d.ts.map +1 -1
- package/dist/services/llm/index.js +13 -6
- package/dist/services/llm/index.js.map +1 -1
- package/dist/services/llm/openai.d.ts +19 -2
- package/dist/services/llm/openai.d.ts.map +1 -1
- package/dist/services/llm/openai.js +119 -73
- package/dist/services/llm/openai.js.map +1 -1
- package/dist/services/llm/types.d.ts +48 -4
- package/dist/services/llm/types.d.ts.map +1 -1
- package/dist/services/llm/usage-error.d.ts +23 -0
- package/dist/services/llm/usage-error.d.ts.map +1 -0
- package/dist/services/llm/usage-error.js +34 -0
- package/dist/services/llm/usage-error.js.map +1 -0
- package/dist/types/index.d.ts +52 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +8 -4
- package/dist/types/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -6,16 +6,17 @@
|
|
|
6
6
|
*
|
|
7
7
|
* ## Supported Providers
|
|
8
8
|
*
|
|
9
|
-
* Catalog verified against provider documentation on 2026-08-18
|
|
9
|
+
* Catalog verified against provider documentation on 2026-08-18; pricing
|
|
10
|
+
* re-verified against each provider's pricing page on 2026-09-14.
|
|
10
11
|
*
|
|
11
12
|
* - **openai**: GPT-5.6 (Sol/Terra/Luna), GPT-5.5, GPT-5.4, GPT-5, GPT-4.1, GPT-4o
|
|
12
13
|
* - **anthropic**: Claude Fable 5, Opus 5, Sonnet 5, Haiku 4.5 (+ Opus 4.8/4.7/4.6, Sonnet 4.6)
|
|
13
14
|
* - **gemini**: Gemini 3.7/3.6/3.5/3.1 and 2.5, Nano Banana image models, Veo 3.1 video
|
|
14
|
-
* - **mistral**: Mistral Large 3, Medium 3.5, Small 4, Ministral 3, Codestral
|
|
15
|
+
* - **mistral**: Mistral Large 3, Medium 3.5, Small 4, Ministral 3, Codestral
|
|
15
16
|
* - **cohere**: Command A+, Command A (reasoning/vision/translate), Command R
|
|
16
17
|
* - **groq**: GPT-OSS, Qwen3.6, MiniMax M2.7, Compound, Whisper
|
|
17
18
|
* - **xai**: Grok 4.6, 4.5, 4.3, Grok 4.20 variants, Grok Build
|
|
18
|
-
* - **deepseek**: DeepSeek V4
|
|
19
|
+
* - **deepseek**: DeepSeek V4.1 Flash and V4 Pro
|
|
19
20
|
* - **perplexity**: Sonar models with live web search grounding
|
|
20
21
|
* - **lm_studio**: Local LLM server (LM Studio or any OpenAI-compatible endpoint)
|
|
21
22
|
*
|
|
@@ -30,6 +31,10 @@
|
|
|
30
31
|
* `llama-3.1-8b-instant` on 2026-08-16, and both were listed here until then.
|
|
31
32
|
*
|
|
32
33
|
* Pricing is in **cents per 1M tokens** (image per image, audio/video per minute).
|
|
34
|
+
* `estimateUsageCost` (`lib/cost-estimation.ts`) prices a call from these rates
|
|
35
|
+
* plus the optional refinements on `ModelPricing`: cached and audio input,
|
|
36
|
+
* long-context tiers, peak hours, and per-request and per-search fees. A rate a
|
|
37
|
+
* provider does not publish is left out rather than guessed.
|
|
33
38
|
*
|
|
34
39
|
* ## LM Studio Model Identifiers
|
|
35
40
|
*
|
|
@@ -96,13 +101,28 @@ export declare function getModelsForProvider(providerId: LlmProvider): string[];
|
|
|
96
101
|
* @returns Model capabilities
|
|
97
102
|
*/
|
|
98
103
|
export declare function getModelCapabilities(model: string): ModelCapabilities;
|
|
104
|
+
export interface ModelPricingLookup {
|
|
105
|
+
/** The provider serving the model. `lm_studio` is always free. */
|
|
106
|
+
provider?: LlmProvider;
|
|
107
|
+
/** The model the endpoint asked for, tried when the reported one is unknown. */
|
|
108
|
+
configuredModel?: string | null;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Pricing for a model, or undefined when the catalog does not know it.
|
|
112
|
+
*
|
|
113
|
+
* Tries the model as reported, then without a snapshot suffix, then the same
|
|
114
|
+
* for `configuredModel`.
|
|
115
|
+
*/
|
|
116
|
+
export declare function findModelPricing(model: string, options?: ModelPricingLookup): ModelPricing | undefined;
|
|
99
117
|
/**
|
|
100
118
|
* Get pricing for a specific model (cents per 1M tokens).
|
|
101
|
-
* Returns DEFAULT_MODEL_PRICING for unknown models
|
|
102
|
-
*
|
|
119
|
+
* Returns DEFAULT_MODEL_PRICING for unknown models, and zero for any model on a
|
|
120
|
+
* self-hosted (`lm_studio`) server.
|
|
121
|
+
* @param model - The model identifier, as reported by the provider
|
|
122
|
+
* @param options - Provider and configured model, for a more reliable match
|
|
103
123
|
* @returns Model pricing
|
|
104
124
|
*/
|
|
105
|
-
export declare function getModelPricing(model: string): ModelPricing;
|
|
125
|
+
export declare function getModelPricing(model: string, options?: ModelPricingLookup): ModelPricing;
|
|
106
126
|
/**
|
|
107
127
|
* Get the provider for a given model name.
|
|
108
128
|
* Searches through PROVIDER_MODELS to find which provider owns this model.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/config/providers.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/config/providers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6EG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACf,MAAM,mBAAmB,CAAC;AAM3B,eAAO,MAAM,SAAS,EAAE,cAAc,EAoFrC,CAAC;AAMF,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,CAgKzD,CAAC;AAMF,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAq8BhE,CAAC;AAeF,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAwVtD,CAAC;AAGF,eAAO,MAAM,qBAAqB,EAAE,YAA0C,CAAC;AAM/E;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,WAAW,GACtB,cAAc,GAAG,SAAS,CAE5B;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,WAAW,GAAG,MAAM,EAAE,CAEtE;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,iBAAiB,CAErE;AAYD,MAAM,WAAW,kBAAkB;IACjC,kEAAkE;IAClE,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,gFAAgF;IAChF,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AASD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,kBAAuB,GAC/B,YAAY,GAAG,SAAS,CAG1B;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,kBAAuB,GAC/B,YAAY,CAEd;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAQ9D"}
|
package/dist/config/providers.js
CHANGED
|
@@ -6,16 +6,17 @@
|
|
|
6
6
|
*
|
|
7
7
|
* ## Supported Providers
|
|
8
8
|
*
|
|
9
|
-
* Catalog verified against provider documentation on 2026-08-18
|
|
9
|
+
* Catalog verified against provider documentation on 2026-08-18; pricing
|
|
10
|
+
* re-verified against each provider's pricing page on 2026-09-14.
|
|
10
11
|
*
|
|
11
12
|
* - **openai**: GPT-5.6 (Sol/Terra/Luna), GPT-5.5, GPT-5.4, GPT-5, GPT-4.1, GPT-4o
|
|
12
13
|
* - **anthropic**: Claude Fable 5, Opus 5, Sonnet 5, Haiku 4.5 (+ Opus 4.8/4.7/4.6, Sonnet 4.6)
|
|
13
14
|
* - **gemini**: Gemini 3.7/3.6/3.5/3.1 and 2.5, Nano Banana image models, Veo 3.1 video
|
|
14
|
-
* - **mistral**: Mistral Large 3, Medium 3.5, Small 4, Ministral 3, Codestral
|
|
15
|
+
* - **mistral**: Mistral Large 3, Medium 3.5, Small 4, Ministral 3, Codestral
|
|
15
16
|
* - **cohere**: Command A+, Command A (reasoning/vision/translate), Command R
|
|
16
17
|
* - **groq**: GPT-OSS, Qwen3.6, MiniMax M2.7, Compound, Whisper
|
|
17
18
|
* - **xai**: Grok 4.6, 4.5, 4.3, Grok 4.20 variants, Grok Build
|
|
18
|
-
* - **deepseek**: DeepSeek V4
|
|
19
|
+
* - **deepseek**: DeepSeek V4.1 Flash and V4 Pro
|
|
19
20
|
* - **perplexity**: Sonar models with live web search grounding
|
|
20
21
|
* - **lm_studio**: Local LLM server (LM Studio or any OpenAI-compatible endpoint)
|
|
21
22
|
*
|
|
@@ -30,6 +31,10 @@
|
|
|
30
31
|
* `llama-3.1-8b-instant` on 2026-08-16, and both were listed here until then.
|
|
31
32
|
*
|
|
32
33
|
* Pricing is in **cents per 1M tokens** (image per image, audio/video per minute).
|
|
34
|
+
* `estimateUsageCost` (`lib/cost-estimation.ts`) prices a call from these rates
|
|
35
|
+
* plus the optional refinements on `ModelPricing`: cached and audio input,
|
|
36
|
+
* long-context tiers, peak hours, and per-request and per-search fees. A rate a
|
|
37
|
+
* provider does not publish is left out rather than guessed.
|
|
33
38
|
*
|
|
34
39
|
* ## LM Studio Model Identifiers
|
|
35
40
|
*
|
|
@@ -134,9 +139,9 @@ export const PROVIDERS = [
|
|
|
134
139
|
{
|
|
135
140
|
id: "deepseek",
|
|
136
141
|
name: "DeepSeek",
|
|
137
|
-
description: "DeepSeek V4
|
|
142
|
+
description: "DeepSeek V4.1 Flash and V4 Pro models",
|
|
138
143
|
allowsCustomModel: false,
|
|
139
|
-
defaultModel: "deepseek-
|
|
144
|
+
defaultModel: "deepseek-flash",
|
|
140
145
|
requiresEndpointUrl: false,
|
|
141
146
|
},
|
|
142
147
|
{
|
|
@@ -230,7 +235,7 @@ export const PROVIDER_MODELS = {
|
|
|
230
235
|
"ministral-3b-2512",
|
|
231
236
|
"codestral-latest",
|
|
232
237
|
"codestral-2508",
|
|
233
|
-
|
|
238
|
+
// No OCR model: Mistral serves OCR only at /v1/ocr, never chat completions.
|
|
234
239
|
],
|
|
235
240
|
cohere: [
|
|
236
241
|
"command-a-plus-05-2026",
|
|
@@ -262,7 +267,12 @@ export const PROVIDER_MODELS = {
|
|
|
262
267
|
"grok-4.20-multi-agent-0309",
|
|
263
268
|
"grok-build-0.1",
|
|
264
269
|
],
|
|
265
|
-
deepseek: [
|
|
270
|
+
deepseek: [
|
|
271
|
+
"deepseek-flash", // V4.1 Flash (2026-09-10)
|
|
272
|
+
"deepseek-v4-pro",
|
|
273
|
+
// Retired V4 Flash ID; DeepSeek currently serves it with V4.1 Flash
|
|
274
|
+
"deepseek-v4-flash",
|
|
275
|
+
],
|
|
266
276
|
perplexity: [
|
|
267
277
|
"sonar",
|
|
268
278
|
"sonar-pro",
|
|
@@ -844,15 +854,6 @@ export const MODEL_CAPABILITIES = {
|
|
|
844
854
|
audioOutput: false,
|
|
845
855
|
videoOutput: false,
|
|
846
856
|
},
|
|
847
|
-
"mistral-ocr-latest": {
|
|
848
|
-
visionInput: true,
|
|
849
|
-
audioInput: false,
|
|
850
|
-
videoInput: false,
|
|
851
|
-
imageOutput: false,
|
|
852
|
-
audioOutput: false,
|
|
853
|
-
videoOutput: false,
|
|
854
|
-
mediaFormats: { imageFormats: ["url", "base64"] },
|
|
855
|
-
},
|
|
856
857
|
// Cohere — https://docs.cohere.com/docs/models
|
|
857
858
|
"command-a-plus-05-2026": {
|
|
858
859
|
visionInput: true,
|
|
@@ -1065,6 +1066,14 @@ export const MODEL_CAPABILITIES = {
|
|
|
1065
1066
|
mediaFormats: { imageFormats: ["url", "base64"] },
|
|
1066
1067
|
},
|
|
1067
1068
|
// DeepSeek — https://api-docs.deepseek.com/quick_start/pricing (standard, cache miss)
|
|
1069
|
+
"deepseek-flash": {
|
|
1070
|
+
visionInput: false,
|
|
1071
|
+
audioInput: false,
|
|
1072
|
+
videoInput: false,
|
|
1073
|
+
imageOutput: false,
|
|
1074
|
+
audioOutput: false,
|
|
1075
|
+
videoOutput: false,
|
|
1076
|
+
},
|
|
1068
1077
|
"deepseek-v4-pro": {
|
|
1069
1078
|
visionInput: false,
|
|
1070
1079
|
audioInput: false,
|
|
@@ -1279,24 +1288,87 @@ export const MODEL_CAPABILITIES = {
|
|
|
1279
1288
|
// =============================================================================
|
|
1280
1289
|
// Model Pricing (cents per 1M tokens)
|
|
1281
1290
|
// =============================================================================
|
|
1291
|
+
/** DeepSeek bills 2x during these weekday UTC hours. */
|
|
1292
|
+
const DEEPSEEK_PEAK = {
|
|
1293
|
+
multiplier: 2,
|
|
1294
|
+
windowsUtc: [
|
|
1295
|
+
{ days: [1, 2, 3, 4, 5], startHour: 1, endHour: 4 },
|
|
1296
|
+
{ days: [1, 2, 3, 4, 5], startHour: 6, endHour: 10 },
|
|
1297
|
+
],
|
|
1298
|
+
};
|
|
1282
1299
|
export const MODEL_PRICING = {
|
|
1283
|
-
// OpenAI — https://developers.openai.com/api/docs/
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
"
|
|
1288
|
-
"gpt-5.
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
+
// OpenAI — https://developers.openai.com/api/docs/pricing
|
|
1301
|
+
// Cached input is 0.1x. GPT-5.6 also bills cache writes at 1.25x input.
|
|
1302
|
+
// web_search_preview: $10 / 1K calls on reasoning models (GPT-5 family),
|
|
1303
|
+
// $25 / 1K on GPT-4.1 and GPT-4o.
|
|
1304
|
+
// Sol is on promotion "at least through November 21, 2026"; list is 500 / 3000.
|
|
1305
|
+
"gpt-5.6-sol": {
|
|
1306
|
+
input: 400,
|
|
1307
|
+
output: 2000,
|
|
1308
|
+
cachedInput: 40,
|
|
1309
|
+
cacheWriteInput: 500,
|
|
1310
|
+
searchCall: 1,
|
|
1311
|
+
longContext: {
|
|
1312
|
+
minPromptTokens: 272_001,
|
|
1313
|
+
input: 800,
|
|
1314
|
+
output: 3000,
|
|
1315
|
+
cachedInput: 80,
|
|
1316
|
+
},
|
|
1317
|
+
},
|
|
1318
|
+
"gpt-5.6-terra": {
|
|
1319
|
+
input: 200,
|
|
1320
|
+
output: 1200,
|
|
1321
|
+
cachedInput: 20,
|
|
1322
|
+
cacheWriteInput: 250,
|
|
1323
|
+
searchCall: 1,
|
|
1324
|
+
longContext: {
|
|
1325
|
+
minPromptTokens: 272_001,
|
|
1326
|
+
input: 400,
|
|
1327
|
+
output: 1800,
|
|
1328
|
+
cachedInput: 40,
|
|
1329
|
+
},
|
|
1330
|
+
},
|
|
1331
|
+
"gpt-5.6-luna": {
|
|
1332
|
+
input: 20,
|
|
1333
|
+
output: 120,
|
|
1334
|
+
cachedInput: 2,
|
|
1335
|
+
cacheWriteInput: 25,
|
|
1336
|
+
searchCall: 1,
|
|
1337
|
+
longContext: {
|
|
1338
|
+
minPromptTokens: 272_001,
|
|
1339
|
+
input: 40,
|
|
1340
|
+
output: 180,
|
|
1341
|
+
cachedInput: 4,
|
|
1342
|
+
},
|
|
1343
|
+
},
|
|
1344
|
+
// 5.5 / 5.4 long context: "2x input and 1.5x output for the full session"
|
|
1345
|
+
"gpt-5.5": {
|
|
1346
|
+
input: 500,
|
|
1347
|
+
output: 3000,
|
|
1348
|
+
cachedInput: 50,
|
|
1349
|
+
searchCall: 1,
|
|
1350
|
+
longContext: { minPromptTokens: 272_001, input: 1000, output: 4500 },
|
|
1351
|
+
},
|
|
1352
|
+
"gpt-5.4": {
|
|
1353
|
+
input: 250,
|
|
1354
|
+
output: 1500,
|
|
1355
|
+
cachedInput: 25,
|
|
1356
|
+
searchCall: 1,
|
|
1357
|
+
longContext: { minPromptTokens: 272_001, input: 500, output: 2250 },
|
|
1358
|
+
},
|
|
1359
|
+
"gpt-5.4-mini": { input: 75, output: 450, cachedInput: 7.5, searchCall: 1 },
|
|
1360
|
+
"gpt-5.4-nano": { input: 20, output: 125, cachedInput: 2, searchCall: 1 },
|
|
1361
|
+
"gpt-5": { input: 125, output: 1000, cachedInput: 12.5, searchCall: 1 },
|
|
1362
|
+
"gpt-5-mini": { input: 25, output: 200, cachedInput: 2.5, searchCall: 1 },
|
|
1363
|
+
"gpt-5-nano": { input: 5, output: 40, cachedInput: 0.5, searchCall: 1 },
|
|
1364
|
+
"gpt-4.1": { input: 200, output: 800, cachedInput: 50, searchCall: 2.5 },
|
|
1365
|
+
"gpt-4.1-mini": { input: 40, output: 160, cachedInput: 10, searchCall: 2.5 },
|
|
1366
|
+
"gpt-4.1-nano": { input: 10, output: 40, cachedInput: 2.5, searchCall: 2.5 }, // Shuts down 2026-10-23
|
|
1367
|
+
"gpt-4o": { input: 250, output: 1000, cachedInput: 125, searchCall: 2.5 },
|
|
1368
|
+
"gpt-4o-mini": { input: 15, output: 60, cachedInput: 7.5, searchCall: 2.5 },
|
|
1369
|
+
// Anthropic — https://platform.claude.com/docs/en/about-claude/pricing
|
|
1370
|
+
// 4.6 and later: full 1M context at standard rates, no long-context surcharge.
|
|
1371
|
+
// No cachedInput: the adapter sends no cache_control, so nothing is cached.
|
|
1300
1372
|
"claude-fable-5": { input: 1000, output: 5000 },
|
|
1301
1373
|
"claude-opus-5": { input: 500, output: 2500 },
|
|
1302
1374
|
"claude-sonnet-5": { input: 200, output: 1000 },
|
|
@@ -1306,111 +1378,89 @@ export const MODEL_PRICING = {
|
|
|
1306
1378
|
"claude-opus-4-6": { input: 500, output: 2500 },
|
|
1307
1379
|
"claude-sonnet-4-6": { input: 300, output: 1500 },
|
|
1308
1380
|
"claude-opus-4-5-20251101": { input: 500, output: 2500 },
|
|
1309
|
-
"claude-sonnet-4-5-20250929": { input: 300, output: 1500 },
|
|
1310
|
-
// Google Gemini — https://ai.google.dev/gemini-api/docs/
|
|
1381
|
+
"claude-sonnet-4-5-20250929": { input: 300, output: 1500 }, // Retires 2026-09-29
|
|
1382
|
+
// Google Gemini — https://ai.google.dev/gemini-api/docs/pricing
|
|
1383
|
+
// Images, video and (unless audioTokenInput says otherwise) audio are billed
|
|
1384
|
+
// as input tokens at `input`; output includes thinking tokens.
|
|
1311
1385
|
"gemini-3.7-flash": {
|
|
1312
1386
|
input: 75,
|
|
1313
1387
|
output: 375,
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1388
|
+
cachedInput: 7.5,
|
|
1389
|
+
priceChanges: [
|
|
1390
|
+
{ from: "2027-01-01", input: 150, output: 750, cachedInput: 15 },
|
|
1391
|
+
],
|
|
1317
1392
|
},
|
|
1318
1393
|
"gemini-3.6-flash": {
|
|
1319
1394
|
input: 75,
|
|
1320
1395
|
output: 375,
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
"gemini-3.5-flash": {
|
|
1326
|
-
input: 150,
|
|
1327
|
-
output: 900,
|
|
1328
|
-
imageInput: 39,
|
|
1329
|
-
audioInput: 10,
|
|
1330
|
-
videoInput: 39,
|
|
1331
|
-
},
|
|
1332
|
-
"gemini-3.5-flash-lite": {
|
|
1333
|
-
input: 30,
|
|
1334
|
-
output: 250,
|
|
1335
|
-
imageInput: 30,
|
|
1336
|
-
audioInput: 50,
|
|
1337
|
-
videoInput: 30,
|
|
1396
|
+
cachedInput: 7.5,
|
|
1397
|
+
priceChanges: [
|
|
1398
|
+
{ from: "2027-01-01", input: 150, output: 750, cachedInput: 15 },
|
|
1399
|
+
],
|
|
1338
1400
|
},
|
|
1401
|
+
"gemini-3.5-flash": { input: 150, output: 900, cachedInput: 15 },
|
|
1402
|
+
"gemini-3.5-flash-lite": { input: 30, output: 250, cachedInput: 3 },
|
|
1339
1403
|
"gemini-3.1-flash-lite": {
|
|
1340
1404
|
input: 25,
|
|
1341
1405
|
output: 150,
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
},
|
|
1406
|
+
cachedInput: 2.5,
|
|
1407
|
+
audioTokenInput: 50,
|
|
1408
|
+
}, // Shuts down 2027-05-07
|
|
1346
1409
|
"gemini-3.1-pro-preview": {
|
|
1347
1410
|
input: 200,
|
|
1348
1411
|
output: 1200,
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1412
|
+
cachedInput: 20,
|
|
1413
|
+
longContext: {
|
|
1414
|
+
minPromptTokens: 200_001,
|
|
1415
|
+
input: 400,
|
|
1416
|
+
output: 1800,
|
|
1417
|
+
cachedInput: 40,
|
|
1418
|
+
},
|
|
1352
1419
|
},
|
|
1353
1420
|
"gemini-3-flash-preview": {
|
|
1354
|
-
input:
|
|
1355
|
-
output:
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
},
|
|
1360
|
-
"gemini-3.1-flash-image": {
|
|
1361
|
-
|
|
1362
|
-
output: 375,
|
|
1363
|
-
imageInput: 39,
|
|
1364
|
-
imageOutput: 3.9,
|
|
1365
|
-
}, // Nano Banana 2
|
|
1366
|
-
"gemini-3.1-flash-lite-image": {
|
|
1367
|
-
input: 25,
|
|
1368
|
-
output: 150,
|
|
1369
|
-
imageInput: 25,
|
|
1370
|
-
imageOutput: 2.4,
|
|
1371
|
-
}, // Nano Banana 2 Lite
|
|
1372
|
-
"gemini-3-pro-image": {
|
|
1373
|
-
input: 125,
|
|
1374
|
-
output: 1000,
|
|
1375
|
-
imageInput: 32.9,
|
|
1376
|
-
imageOutput: 12,
|
|
1377
|
-
}, // Nano Banana Pro
|
|
1421
|
+
input: 50,
|
|
1422
|
+
output: 300,
|
|
1423
|
+
cachedInput: 5,
|
|
1424
|
+
audioTokenInput: 100,
|
|
1425
|
+
},
|
|
1426
|
+
"gemini-3.1-flash-image": { input: 50, output: 300, imageOutput: 6.7 }, // Nano Banana 2; per image at 1K (4.5 at 0.5K, 10.1 at 2K, 15.1 at 4K)
|
|
1427
|
+
"gemini-3.1-flash-lite-image": { input: 25, output: 150, imageOutput: 3.36 }, // Nano Banana 2 Lite; per image at 1K
|
|
1428
|
+
"gemini-3-pro-image": { input: 200, output: 1200, imageOutput: 13.4 }, // Nano Banana Pro; per image at 1K/2K (24 at 4K)
|
|
1378
1429
|
"gemini-2.5-pro": {
|
|
1379
1430
|
input: 125,
|
|
1380
1431
|
output: 1000,
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1432
|
+
cachedInput: 12.5,
|
|
1433
|
+
longContext: {
|
|
1434
|
+
minPromptTokens: 200_001,
|
|
1435
|
+
input: 250,
|
|
1436
|
+
output: 1500,
|
|
1437
|
+
cachedInput: 25,
|
|
1438
|
+
},
|
|
1384
1439
|
},
|
|
1385
1440
|
"gemini-2.5-flash": {
|
|
1386
1441
|
input: 30,
|
|
1387
1442
|
output: 250,
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
videoInput: 30,
|
|
1443
|
+
cachedInput: 3,
|
|
1444
|
+
audioTokenInput: 100,
|
|
1391
1445
|
},
|
|
1392
1446
|
"gemini-2.5-flash-lite": {
|
|
1393
1447
|
input: 10,
|
|
1394
1448
|
output: 40,
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
videoInput: 10,
|
|
1398
|
-
},
|
|
1399
|
-
"gemini-2.5-flash-image": {
|
|
1400
|
-
input: 30,
|
|
1401
|
-
output: 250,
|
|
1402
|
-
imageInput: 30,
|
|
1403
|
-
imageOutput: 3.9,
|
|
1449
|
+
cachedInput: 1,
|
|
1450
|
+
audioTokenInput: 30,
|
|
1404
1451
|
},
|
|
1452
|
+
"gemini-2.5-flash-image": { input: 30, output: 250, imageOutput: 3.9 }, // Shuts down 2026-10-02
|
|
1405
1453
|
"gemini-2.5-flash-native-audio-preview-12-2025": {
|
|
1406
|
-
input:
|
|
1407
|
-
output:
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
"veo-3.1-generate-preview": { input: 0, output: 0, videoOutput:
|
|
1412
|
-
"veo-3.1-lite-generate-preview": { input: 0, output: 0, videoOutput:
|
|
1413
|
-
// Mistral — https://
|
|
1454
|
+
input: 50,
|
|
1455
|
+
output: 200,
|
|
1456
|
+
audioTokenInput: 300,
|
|
1457
|
+
}, // Audio output is $12 / 1M tokens
|
|
1458
|
+
// Veo is billed per second of video; stored per minute as ModelPricing expects.
|
|
1459
|
+
"veo-3.1-generate-preview": { input: 0, output: 0, videoOutput: 2400 }, // $0.40/s at 720p/1080p, $0.60/s at 4K
|
|
1460
|
+
"veo-3.1-lite-generate-preview": { input: 0, output: 0, videoOutput: 300 }, // $0.05/s at 720p, $0.08/s at 1080p
|
|
1461
|
+
// Mistral — https://mistral.ai/pricing/api
|
|
1462
|
+
// Cached input is "up to 90%" cheaper; the exact rate is unpublished, so
|
|
1463
|
+
// cached tokens are priced at the full input rate.
|
|
1414
1464
|
"mistral-large-latest": { input: 50, output: 150 },
|
|
1415
1465
|
"mistral-large-2512": { input: 50, output: 150 },
|
|
1416
1466
|
"mistral-medium-latest": { input: 150, output: 750 },
|
|
@@ -1421,10 +1471,12 @@ export const MODEL_PRICING = {
|
|
|
1421
1471
|
"ministral-3b-2512": { input: 10, output: 10 },
|
|
1422
1472
|
"codestral-latest": { input: 30, output: 90 },
|
|
1423
1473
|
"codestral-2508": { input: 30, output: 90 },
|
|
1424
|
-
"mistral-ocr-latest": { input: 100, output: 300 }, // document OCR
|
|
1425
1474
|
// Cohere — https://docs.cohere.com/docs/models
|
|
1426
|
-
"command-a-plus-05-2026": { input: 250, output: 1000 },
|
|
1427
1475
|
"command-a-03-2025": { input: 250, output: 1000 },
|
|
1476
|
+
// No published token price for A+, Reasoning, Vision, or Translate: free up
|
|
1477
|
+
// to rate limits, production use via Model Vault or sales. Command A's rate
|
|
1478
|
+
// is assumed.
|
|
1479
|
+
"command-a-plus-05-2026": { input: 250, output: 1000 },
|
|
1428
1480
|
"command-a-reasoning-08-2025": { input: 250, output: 1000 },
|
|
1429
1481
|
"command-a-vision-07-2025": { input: 250, output: 1000 },
|
|
1430
1482
|
"command-a-translate-08-2025": { input: 250, output: 1000 },
|
|
@@ -1432,31 +1484,135 @@ export const MODEL_PRICING = {
|
|
|
1432
1484
|
"command-r-plus-08-2024": { input: 250, output: 1000 },
|
|
1433
1485
|
"command-r-08-2024": { input: 15, output: 60 },
|
|
1434
1486
|
// Groq — https://console.groq.com/docs/models
|
|
1435
|
-
"openai/gpt-oss-120b": { input: 15, output:
|
|
1436
|
-
"openai/gpt-oss-20b": { input:
|
|
1437
|
-
"qwen/qwen3.6-27b": { input:
|
|
1487
|
+
"openai/gpt-oss-120b": { input: 15, output: 60, cachedInput: 7.5 },
|
|
1488
|
+
"openai/gpt-oss-20b": { input: 7.5, output: 30, cachedInput: 3.75 },
|
|
1489
|
+
"qwen/qwen3.6-27b": { input: 60, output: 300 },
|
|
1490
|
+
// Enterprise only, "Contact Sales"; no public price. Last public rate kept.
|
|
1438
1491
|
"minimaxai/minimax-m2.7": { input: 29, output: 115 },
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
"
|
|
1442
|
-
"
|
|
1492
|
+
// Compound is priced from its per-model and per-tool breakdown
|
|
1493
|
+
// (`compoundCostCents`); these rates apply only when a response lacks one.
|
|
1494
|
+
"groq/compound": { input: 15, output: 60 },
|
|
1495
|
+
"groq/compound-mini": { input: 15, output: 60 },
|
|
1496
|
+
// Whisper, per minute of audio ($0.111 and $0.04 per hour), 10 s minimum
|
|
1497
|
+
"whisper-large-v3": { input: 0, output: 0, audioInput: 0.185 },
|
|
1498
|
+
"whisper-large-v3-turbo": { input: 0, output: 0, audioInput: 0.04 / 0.6 },
|
|
1443
1499
|
// xAI — https://docs.x.ai/docs/models
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
"grok-4.
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
"
|
|
1458
|
-
|
|
1459
|
-
|
|
1500
|
+
// Responses carry the billed amount (`cost_in_usd_ticks`), which is used when
|
|
1501
|
+
// present. Prompts of 200K tokens or more bill every token at 2x.
|
|
1502
|
+
"grok-4.6": {
|
|
1503
|
+
input: 200,
|
|
1504
|
+
output: 600,
|
|
1505
|
+
cachedInput: 50,
|
|
1506
|
+
longContext: {
|
|
1507
|
+
minPromptTokens: 200_000,
|
|
1508
|
+
input: 400,
|
|
1509
|
+
output: 1200,
|
|
1510
|
+
cachedInput: 100,
|
|
1511
|
+
},
|
|
1512
|
+
},
|
|
1513
|
+
"grok-4.5": {
|
|
1514
|
+
input: 200,
|
|
1515
|
+
output: 600,
|
|
1516
|
+
cachedInput: 30,
|
|
1517
|
+
longContext: {
|
|
1518
|
+
minPromptTokens: 200_000,
|
|
1519
|
+
input: 400,
|
|
1520
|
+
output: 1200,
|
|
1521
|
+
cachedInput: 60,
|
|
1522
|
+
},
|
|
1523
|
+
},
|
|
1524
|
+
"grok-4.3": {
|
|
1525
|
+
input: 125,
|
|
1526
|
+
output: 250,
|
|
1527
|
+
cachedInput: 20,
|
|
1528
|
+
longContext: {
|
|
1529
|
+
minPromptTokens: 200_000,
|
|
1530
|
+
input: 250,
|
|
1531
|
+
output: 500,
|
|
1532
|
+
cachedInput: 40,
|
|
1533
|
+
},
|
|
1534
|
+
},
|
|
1535
|
+
"grok-4.20-0309-reasoning": {
|
|
1536
|
+
input: 125,
|
|
1537
|
+
output: 250,
|
|
1538
|
+
cachedInput: 20,
|
|
1539
|
+
longContext: {
|
|
1540
|
+
minPromptTokens: 200_000,
|
|
1541
|
+
input: 250,
|
|
1542
|
+
output: 500,
|
|
1543
|
+
cachedInput: 40,
|
|
1544
|
+
},
|
|
1545
|
+
},
|
|
1546
|
+
"grok-4.20-0309-non-reasoning": {
|
|
1547
|
+
input: 125,
|
|
1548
|
+
output: 250,
|
|
1549
|
+
cachedInput: 20,
|
|
1550
|
+
longContext: {
|
|
1551
|
+
minPromptTokens: 200_000,
|
|
1552
|
+
input: 250,
|
|
1553
|
+
output: 500,
|
|
1554
|
+
cachedInput: 40,
|
|
1555
|
+
},
|
|
1556
|
+
},
|
|
1557
|
+
"grok-4.20-multi-agent-0309": {
|
|
1558
|
+
input: 125,
|
|
1559
|
+
output: 250,
|
|
1560
|
+
cachedInput: 20,
|
|
1561
|
+
longContext: {
|
|
1562
|
+
minPromptTokens: 200_000,
|
|
1563
|
+
input: 250,
|
|
1564
|
+
output: 500,
|
|
1565
|
+
cachedInput: 40,
|
|
1566
|
+
},
|
|
1567
|
+
},
|
|
1568
|
+
"grok-build-0.1": {
|
|
1569
|
+
input: 100,
|
|
1570
|
+
output: 200,
|
|
1571
|
+
cachedInput: 20,
|
|
1572
|
+
longContext: {
|
|
1573
|
+
minPromptTokens: 200_000,
|
|
1574
|
+
input: 200,
|
|
1575
|
+
output: 400,
|
|
1576
|
+
cachedInput: 40,
|
|
1577
|
+
},
|
|
1578
|
+
},
|
|
1579
|
+
// DeepSeek — https://api-docs.deepseek.com/quick_start/pricing
|
|
1580
|
+
// Off-peak rates; peak hours (01:00-04:00 and 06:00-10:00 UTC, Mon-Fri) bill
|
|
1581
|
+
// at 2x. V4.1 Flash repriced 2026-09-10; `deepseek-v4-flash` now runs on it.
|
|
1582
|
+
"deepseek-flash": {
|
|
1583
|
+
input: 15,
|
|
1584
|
+
output: 60,
|
|
1585
|
+
cachedInput: 0.3,
|
|
1586
|
+
peak: DEEPSEEK_PEAK,
|
|
1587
|
+
},
|
|
1588
|
+
"deepseek-v4-pro": {
|
|
1589
|
+
input: 66,
|
|
1590
|
+
output: 198,
|
|
1591
|
+
cachedInput: 2.2,
|
|
1592
|
+
peak: DEEPSEEK_PEAK,
|
|
1593
|
+
},
|
|
1594
|
+
"deepseek-v4-flash": {
|
|
1595
|
+
input: 15,
|
|
1596
|
+
output: 60,
|
|
1597
|
+
cachedInput: 0.3,
|
|
1598
|
+
peak: DEEPSEEK_PEAK,
|
|
1599
|
+
},
|
|
1600
|
+
// Perplexity — https://docs.perplexity.ai/docs/getting-started/pricing
|
|
1601
|
+
// Responses carry the billed amount (`usage.cost.total_cost`), which is used
|
|
1602
|
+
// when present. The request fee below is the default (low) search context.
|
|
1603
|
+
// Sonar is supported until 2026-09-27, then replaced by the Agent API.
|
|
1604
|
+
sonar: { input: 100, output: 100, requestFee: 0.5 },
|
|
1605
|
+
"sonar-pro": { input: 300, output: 1500, requestFee: 0.6 },
|
|
1606
|
+
// Not a real model ID: Pro Search is sonar-pro with search_type "pro"
|
|
1607
|
+
"sonar-pro-search": { input: 300, output: 1500, requestFee: 1.4 },
|
|
1608
|
+
"sonar-reasoning-pro": { input: 200, output: 800, requestFee: 0.6 },
|
|
1609
|
+
"sonar-deep-research": {
|
|
1610
|
+
input: 200,
|
|
1611
|
+
output: 800,
|
|
1612
|
+
citationTokens: 200,
|
|
1613
|
+
reasoningTokens: 300,
|
|
1614
|
+
searchCall: 0.5,
|
|
1615
|
+
},
|
|
1460
1616
|
// LM Studio / custom OpenAI-compatible servers — self-hosted, no per-token cost
|
|
1461
1617
|
"qwen3-8b": { input: 0, output: 0 },
|
|
1462
1618
|
"qwen3-14b": { input: 0, output: 0 },
|
|
@@ -1506,18 +1662,40 @@ export function getModelsForProvider(providerId) {
|
|
|
1506
1662
|
export function getModelCapabilities(model) {
|
|
1507
1663
|
return MODEL_CAPABILITIES[model] ?? {};
|
|
1508
1664
|
}
|
|
1665
|
+
/** Self-hosted models cost nothing per token, whatever they are called. */
|
|
1666
|
+
const FREE_PRICING = { input: 0, output: 0 };
|
|
1667
|
+
/**
|
|
1668
|
+
* Snapshot suffixes providers append to a model they report back:
|
|
1669
|
+
* `gpt-4.1-mini-2025-04-14` (OpenAI) and `claude-haiku-4-5-20251001`
|
|
1670
|
+
* (Anthropic, for an alias).
|
|
1671
|
+
*/
|
|
1672
|
+
const SNAPSHOT_SUFFIX = /-(\d{4}-\d{2}-\d{2}|\d{8})$/;
|
|
1673
|
+
function catalogPricing(model) {
|
|
1674
|
+
if (!model)
|
|
1675
|
+
return undefined;
|
|
1676
|
+
return (MODEL_PRICING[model] ?? MODEL_PRICING[model.replace(SNAPSHOT_SUFFIX, "")]);
|
|
1677
|
+
}
|
|
1678
|
+
/**
|
|
1679
|
+
* Pricing for a model, or undefined when the catalog does not know it.
|
|
1680
|
+
*
|
|
1681
|
+
* Tries the model as reported, then without a snapshot suffix, then the same
|
|
1682
|
+
* for `configuredModel`.
|
|
1683
|
+
*/
|
|
1684
|
+
export function findModelPricing(model, options = {}) {
|
|
1685
|
+
if (options.provider === "lm_studio")
|
|
1686
|
+
return FREE_PRICING;
|
|
1687
|
+
return catalogPricing(model) ?? catalogPricing(options.configuredModel);
|
|
1688
|
+
}
|
|
1509
1689
|
/**
|
|
1510
1690
|
* Get pricing for a specific model (cents per 1M tokens).
|
|
1511
|
-
* Returns DEFAULT_MODEL_PRICING for unknown models
|
|
1512
|
-
*
|
|
1691
|
+
* Returns DEFAULT_MODEL_PRICING for unknown models, and zero for any model on a
|
|
1692
|
+
* self-hosted (`lm_studio`) server.
|
|
1693
|
+
* @param model - The model identifier, as reported by the provider
|
|
1694
|
+
* @param options - Provider and configured model, for a more reliable match
|
|
1513
1695
|
* @returns Model pricing
|
|
1514
1696
|
*/
|
|
1515
|
-
export function getModelPricing(model) {
|
|
1516
|
-
|
|
1517
|
-
if (MODEL_PRICING[model])
|
|
1518
|
-
return MODEL_PRICING[model];
|
|
1519
|
-
const baseModel = model.replace(/-\d{4}-\d{2}-\d{2}$/, "");
|
|
1520
|
-
return MODEL_PRICING[baseModel] ?? DEFAULT_MODEL_PRICING;
|
|
1697
|
+
export function getModelPricing(model, options = {}) {
|
|
1698
|
+
return findModelPricing(model, options) ?? DEFAULT_MODEL_PRICING;
|
|
1521
1699
|
}
|
|
1522
1700
|
/**
|
|
1523
1701
|
* Get the provider for a given model name.
|