@sudobility/shapeshyft_types 1.0.21 → 1.0.22

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/index.cjs CHANGED
@@ -4,9 +4,13 @@
4
4
  * TypeScript types for ShapeShyft API - LLM structured output platform
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.COST_PER_MILLION_TOKENS = exports.PROVIDER_ALLOWS_CUSTOM_MODEL = exports.DEFAULT_PROVIDER_MODEL = exports.PROVIDER_MODELS = exports.LLM_PROVIDERS = void 0;
7
+ exports.COST_PER_MILLION_TOKENS = exports.MODEL_CAPABILITIES = exports.PROVIDER_ALLOWS_CUSTOM_MODEL = exports.DEFAULT_PROVIDER_MODEL = exports.PROVIDER_MODELS = exports.LLM_PROVIDERS = void 0;
8
+ exports.getModelCapabilities = getModelCapabilities;
9
+ exports.hasInputCapability = hasInputCapability;
10
+ exports.hasOutputCapability = hasOutputCapability;
8
11
  exports.getModelPricing = getModelPricing;
9
12
  exports.estimateCost = estimateCost;
13
+ exports.estimateMultimodalCost = estimateMultimodalCost;
10
14
  exports.formatCost = formatCost;
11
15
  exports.formatCostPerMillion = formatCostPerMillion;
12
16
  exports.successResponse = successResponse;
@@ -24,30 +28,75 @@ exports.LLM_PROVIDERS = [
24
28
  'perplexity',
25
29
  'llm_server',
26
30
  ];
27
- /** Models available for each provider */
31
+ /** Models available for each provider (January 2026) */
28
32
  exports.PROVIDER_MODELS = {
29
- openai: ['gpt-4o', 'gpt-4o-mini', 'gpt-4-turbo', 'gpt-3.5-turbo', 'o1', 'o1-mini', 'o1-pro'],
30
- anthropic: ['claude-sonnet-4-20250514', 'claude-opus-4-20250514', 'claude-3-5-haiku-20241022'],
31
- gemini: ['gemini-2.0-flash', 'gemini-2.0-flash-lite', 'gemini-1.5-pro', 'gemini-1.5-flash'],
32
- mistral: ['mistral-large-latest', 'mistral-medium-latest', 'mistral-small-latest', 'codestral-latest', 'mistral-nemo'],
33
- cohere: ['command-r-plus', 'command-r', 'command', 'command-light'],
34
- groq: ['llama-3.3-70b-versatile', 'llama-3.1-8b-instant', 'mixtral-8x7b-32768', 'gemma2-9b-it'],
35
- xai: ['grok-2', 'grok-2-mini'],
36
- deepseek: ['deepseek-chat', 'deepseek-coder', 'deepseek-reasoner'],
37
- perplexity: ['llama-3.1-sonar-small-128k-online', 'llama-3.1-sonar-large-128k-online', 'llama-3.1-sonar-huge-128k-online'],
38
- llm_server: ['qwen/qwen3-30b-a3b-2507', 'meta-llama-3.1-8b-instruct', 'qwen-32b-everything', 'openai/gpt-oss-20b'],
33
+ openai: [
34
+ 'gpt-4.1', 'gpt-4.1-mini', 'gpt-4.1-nano',
35
+ 'gpt-4o', 'gpt-4o-mini',
36
+ 'o3', 'o3-pro', 'o4-mini',
37
+ 'gpt-4-turbo', 'o1',
38
+ ],
39
+ anthropic: [
40
+ 'claude-opus-4-5-20251124', 'claude-sonnet-4-5-20251124',
41
+ 'claude-opus-4-1-20250805',
42
+ 'claude-sonnet-4-20250514', 'claude-opus-4-20250514',
43
+ 'claude-3-5-haiku-20241022',
44
+ ],
45
+ gemini: [
46
+ 'gemini-3-pro-preview', 'gemini-3-flash-preview', 'gemini-3-pro-image-preview',
47
+ 'gemini-2.5-pro', 'gemini-2.5-flash', 'gemini-2.5-flash-lite', 'gemini-2.5-flash-image', 'gemini-2.5-flash-native-audio-preview',
48
+ 'gemini-2.0-flash', 'gemini-2.0-flash-lite',
49
+ ],
50
+ mistral: [
51
+ 'mistral-large-2512', 'mistral-large-latest',
52
+ 'mistral-medium-3.1', 'mistral-medium-latest',
53
+ 'mistral-small-3.2', 'mistral-small-latest',
54
+ 'ministral-3b-2512', 'ministral-8b-2512', 'ministral-14b-2512',
55
+ 'codestral-2501', 'codestral-latest',
56
+ 'pixtral-large-2411', 'pixtral-large-latest',
57
+ 'voxtral-small', 'voxtral-mini',
58
+ 'mistral-ocr-2512',
59
+ ],
60
+ cohere: [
61
+ 'command-a-03-2025', 'command-a-reasoning', 'command-a-vision',
62
+ 'command-r-plus-08-2024', 'command-r-08-2024',
63
+ 'command-r-plus', 'command-r',
64
+ ],
65
+ groq: [
66
+ 'llama-3.3-70b-versatile', 'llama-3.1-8b-instant',
67
+ 'openai/gpt-oss-120b', 'openai/gpt-oss-20b',
68
+ 'groq/compound', 'groq/compound-mini',
69
+ 'meta-llama/llama-guard-4-12b',
70
+ 'whisper-large-v3', 'whisper-large-v3-turbo',
71
+ ],
72
+ xai: [
73
+ 'grok-4', 'grok-4.1-fast',
74
+ 'grok-3', 'grok-3-mini', 'grok-3-vision',
75
+ 'grok-2', 'grok-2-vision',
76
+ ],
77
+ deepseek: ['deepseek-chat', 'deepseek-reasoner'],
78
+ perplexity: [
79
+ 'sonar', 'sonar-pro',
80
+ 'sonar-reasoning', 'sonar-reasoning-pro',
81
+ 'sonar-deep-research',
82
+ ],
83
+ llm_server: [
84
+ 'qwen/qwen3-30b-a3b-2507', 'meta-llama-3.1-8b-instruct', 'qwen-32b-everything', 'openai/gpt-oss-20b',
85
+ 'llava-v1.6-mistral-7b', 'llava-v1.6-vicuna-13b', 'qwen2-vl-7b-instruct', 'phi-3-vision-128k-instruct',
86
+ 'minicpm-v-2_6', 'moondream2', 'internvl2-8b', 'llama-3.2-11b-vision', 'pixtral-12b',
87
+ ],
39
88
  };
40
- /** Default model for each provider */
89
+ /** Default model for each provider (January 2026) */
41
90
  exports.DEFAULT_PROVIDER_MODEL = {
42
- openai: 'gpt-4o-mini',
43
- anthropic: 'claude-sonnet-4-20250514',
44
- gemini: 'gemini-2.0-flash',
91
+ openai: 'gpt-4.1-mini',
92
+ anthropic: 'claude-sonnet-4-5-20251124',
93
+ gemini: 'gemini-2.5-flash',
45
94
  mistral: 'mistral-small-latest',
46
- cohere: 'command-r',
95
+ cohere: 'command-r-08-2024',
47
96
  groq: 'llama-3.3-70b-versatile',
48
- xai: 'grok-2-mini',
97
+ xai: 'grok-3-mini',
49
98
  deepseek: 'deepseek-chat',
50
- perplexity: 'llama-3.1-sonar-small-128k-online',
99
+ perplexity: 'sonar',
51
100
  llm_server: 'meta-llama-3.1-8b-instruct',
52
101
  };
53
102
  /** Providers that allow custom model input (user can type any model name) */
@@ -63,84 +112,420 @@ exports.PROVIDER_ALLOWS_CUSTOM_MODEL = {
63
112
  perplexity: false,
64
113
  llm_server: true, // Users can type any model name for custom LLM servers
65
114
  };
115
+ /**
116
+ * Model capabilities map (January 2026).
117
+ * Maps model names to their multimodal capabilities.
118
+ * Models not in this map have undefined capabilities.
119
+ */
120
+ exports.MODEL_CAPABILITIES = {
121
+ // ===========================================================================
122
+ // OpenAI (January 2026)
123
+ // ===========================================================================
124
+ // GPT-4.1 family
125
+ 'gpt-4.1': { visionInput: true, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
126
+ 'gpt-4.1-mini': { visionInput: true, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
127
+ 'gpt-4.1-nano': { visionInput: false, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
128
+ // GPT-4o (omni - multimodal)
129
+ 'gpt-4o': { visionInput: true, audioInput: true, videoInput: false, imageOutput: false, audioOutput: true, videoOutput: false },
130
+ 'gpt-4o-mini': { visionInput: true, audioInput: true, videoInput: false, imageOutput: false, audioOutput: true, videoOutput: false },
131
+ // Reasoning models (o-series)
132
+ 'o3': { visionInput: true, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
133
+ 'o3-pro': { visionInput: true, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
134
+ 'o4-mini': { visionInput: true, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
135
+ // Legacy
136
+ 'gpt-4-turbo': { visionInput: true, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
137
+ 'o1': { visionInput: true, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
138
+ // ===========================================================================
139
+ // Anthropic (January 2026)
140
+ // ===========================================================================
141
+ // Claude 4.5
142
+ 'claude-opus-4-5-20251124': { visionInput: true, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
143
+ 'claude-sonnet-4-5-20251124': { visionInput: true, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
144
+ // Claude 4.1
145
+ 'claude-opus-4-1-20250805': { visionInput: true, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
146
+ // Claude 4
147
+ 'claude-sonnet-4-20250514': { visionInput: true, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
148
+ 'claude-opus-4-20250514': { visionInput: true, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
149
+ // Claude 3.5
150
+ 'claude-3-5-haiku-20241022': { visionInput: true, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
151
+ // ===========================================================================
152
+ // Google Gemini (January 2026)
153
+ // ===========================================================================
154
+ // Gemini 3 (latest)
155
+ 'gemini-3-pro-preview': { visionInput: true, audioInput: true, videoInput: true, imageOutput: false, audioOutput: false, videoOutput: false },
156
+ 'gemini-3-flash-preview': { visionInput: true, audioInput: true, videoInput: true, imageOutput: false, audioOutput: false, videoOutput: false },
157
+ 'gemini-3-pro-image-preview': { visionInput: true, audioInput: false, videoInput: false, imageOutput: true, audioOutput: false, videoOutput: false },
158
+ // Gemini 2.5
159
+ 'gemini-2.5-pro': { visionInput: true, audioInput: true, videoInput: true, imageOutput: false, audioOutput: false, videoOutput: false },
160
+ 'gemini-2.5-flash': { visionInput: true, audioInput: true, videoInput: true, imageOutput: false, audioOutput: false, videoOutput: false },
161
+ 'gemini-2.5-flash-lite': { visionInput: true, audioInput: true, videoInput: true, imageOutput: false, audioOutput: false, videoOutput: false },
162
+ 'gemini-2.5-flash-image': { visionInput: true, audioInput: false, videoInput: false, imageOutput: true, audioOutput: false, videoOutput: false },
163
+ 'gemini-2.5-flash-native-audio-preview': { visionInput: true, audioInput: true, videoInput: true, imageOutput: false, audioOutput: true, videoOutput: false },
164
+ // Gemini 2.0
165
+ 'gemini-2.0-flash': { visionInput: true, audioInput: true, videoInput: true, imageOutput: true, audioOutput: true, videoOutput: false },
166
+ 'gemini-2.0-flash-lite': { visionInput: true, audioInput: true, videoInput: true, imageOutput: false, audioOutput: false, videoOutput: false },
167
+ // ===========================================================================
168
+ // Mistral AI (January 2026)
169
+ // ===========================================================================
170
+ // Large models (Mistral Large 3 has vision)
171
+ 'mistral-large-2512': { visionInput: true, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
172
+ 'mistral-large-latest': { visionInput: true, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
173
+ // Medium models (vision capable)
174
+ 'mistral-medium-3.1': { visionInput: true, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
175
+ 'mistral-medium-latest': { visionInput: true, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
176
+ // Small models (vision capable)
177
+ 'mistral-small-3.2': { visionInput: true, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
178
+ 'mistral-small-latest': { visionInput: false, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
179
+ // Ministral (vision capable)
180
+ 'ministral-3b-2512': { visionInput: true, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
181
+ 'ministral-8b-2512': { visionInput: true, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
182
+ 'ministral-14b-2512': { visionInput: true, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
183
+ // Code models
184
+ 'codestral-2501': { visionInput: false, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
185
+ 'codestral-latest': { visionInput: false, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
186
+ // Vision models (Pixtral)
187
+ 'pixtral-large-2411': { visionInput: true, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
188
+ 'pixtral-large-latest': { visionInput: true, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
189
+ // Audio models (Voxtral)
190
+ 'voxtral-small': { visionInput: false, audioInput: true, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
191
+ 'voxtral-mini': { visionInput: false, audioInput: true, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
192
+ // Document AI
193
+ 'mistral-ocr-2512': { visionInput: true, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
194
+ // ===========================================================================
195
+ // Cohere (January 2026)
196
+ // ===========================================================================
197
+ // Command A family
198
+ 'command-a-03-2025': { visionInput: false, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
199
+ 'command-a-reasoning': { visionInput: false, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
200
+ 'command-a-vision': { visionInput: true, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
201
+ // Command R family
202
+ 'command-r-plus-08-2024': { visionInput: false, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
203
+ 'command-r-08-2024': { visionInput: false, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
204
+ 'command-r-plus': { visionInput: false, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
205
+ 'command-r': { visionInput: false, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
206
+ // ===========================================================================
207
+ // Groq (January 2026)
208
+ // ===========================================================================
209
+ 'llama-3.3-70b-versatile': { visionInput: false, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
210
+ 'llama-3.1-8b-instant': { visionInput: false, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
211
+ 'openai/gpt-oss-120b': { visionInput: false, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
212
+ 'openai/gpt-oss-20b': { visionInput: false, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
213
+ 'groq/compound': { visionInput: false, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
214
+ 'groq/compound-mini': { visionInput: false, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
215
+ 'meta-llama/llama-guard-4-12b': { visionInput: true, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
216
+ 'whisper-large-v3': { visionInput: false, audioInput: true, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
217
+ 'whisper-large-v3-turbo': { visionInput: false, audioInput: true, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
218
+ // ===========================================================================
219
+ // xAI Grok (January 2026)
220
+ // ===========================================================================
221
+ 'grok-4': { visionInput: true, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
222
+ 'grok-4.1-fast': { visionInput: true, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
223
+ 'grok-3': { visionInput: true, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
224
+ 'grok-3-mini': { visionInput: false, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
225
+ 'grok-3-vision': { visionInput: true, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
226
+ 'grok-2': { visionInput: false, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
227
+ 'grok-2-vision': { visionInput: true, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
228
+ // ===========================================================================
229
+ // DeepSeek (January 2026 - V3.2)
230
+ // ===========================================================================
231
+ 'deepseek-chat': { visionInput: false, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
232
+ 'deepseek-reasoner': { visionInput: false, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
233
+ // ===========================================================================
234
+ // Perplexity (January 2026 - Sonar family)
235
+ // ===========================================================================
236
+ 'sonar': { visionInput: false, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
237
+ 'sonar-pro': { visionInput: false, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
238
+ 'sonar-reasoning': { visionInput: false, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
239
+ 'sonar-reasoning-pro': { visionInput: false, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
240
+ 'sonar-deep-research': { visionInput: false, audioInput: false, videoInput: false, imageOutput: false, audioOutput: false, videoOutput: false },
241
+ // ===========================================================================
242
+ // LM Studio / Local Models (common vision models)
243
+ // ===========================================================================
244
+ 'llava-v1.6-mistral-7b': {
245
+ visionInput: true,
246
+ audioInput: false,
247
+ videoInput: false,
248
+ imageOutput: false,
249
+ audioOutput: false,
250
+ videoOutput: false,
251
+ },
252
+ 'llava-v1.6-vicuna-13b': {
253
+ visionInput: true,
254
+ audioInput: false,
255
+ videoInput: false,
256
+ imageOutput: false,
257
+ audioOutput: false,
258
+ videoOutput: false,
259
+ },
260
+ 'qwen2-vl-7b-instruct': {
261
+ visionInput: true,
262
+ audioInput: false,
263
+ videoInput: false,
264
+ imageOutput: false,
265
+ audioOutput: false,
266
+ videoOutput: false,
267
+ },
268
+ 'phi-3-vision-128k-instruct': {
269
+ visionInput: true,
270
+ audioInput: false,
271
+ videoInput: false,
272
+ imageOutput: false,
273
+ audioOutput: false,
274
+ videoOutput: false,
275
+ },
276
+ 'minicpm-v-2_6': {
277
+ visionInput: true,
278
+ audioInput: false,
279
+ videoInput: false,
280
+ imageOutput: false,
281
+ audioOutput: false,
282
+ videoOutput: false,
283
+ },
284
+ 'moondream2': {
285
+ visionInput: true,
286
+ audioInput: false,
287
+ videoInput: false,
288
+ imageOutput: false,
289
+ audioOutput: false,
290
+ videoOutput: false,
291
+ },
292
+ 'internvl2-8b': {
293
+ visionInput: true,
294
+ audioInput: false,
295
+ videoInput: false,
296
+ imageOutput: false,
297
+ audioOutput: false,
298
+ videoOutput: false,
299
+ },
300
+ 'llama-3.2-11b-vision': {
301
+ visionInput: true,
302
+ audioInput: false,
303
+ videoInput: false,
304
+ imageOutput: false,
305
+ audioOutput: false,
306
+ videoOutput: false,
307
+ },
308
+ 'pixtral-12b': {
309
+ visionInput: true,
310
+ audioInput: false,
311
+ videoInput: false,
312
+ imageOutput: false,
313
+ audioOutput: false,
314
+ videoOutput: false,
315
+ },
316
+ };
317
+ /**
318
+ * Get capabilities for a model.
319
+ * Returns undefined for each capability if model is not in the map (unknown).
320
+ */
321
+ function getModelCapabilities(model) {
322
+ return exports.MODEL_CAPABILITIES[model] ?? {};
323
+ }
324
+ /**
325
+ * Check if a model has a specific input capability.
326
+ * Returns undefined if unknown, true/false if known.
327
+ */
328
+ function hasInputCapability(model, capability) {
329
+ const caps = exports.MODEL_CAPABILITIES[model];
330
+ if (!caps)
331
+ return undefined;
332
+ switch (capability) {
333
+ case 'vision': return caps.visionInput;
334
+ case 'audio': return caps.audioInput;
335
+ case 'video': return caps.videoInput;
336
+ }
337
+ }
338
+ /**
339
+ * Check if a model has a specific output capability.
340
+ * Returns undefined if unknown, true/false if known.
341
+ */
342
+ function hasOutputCapability(model, capability) {
343
+ const caps = exports.MODEL_CAPABILITIES[model];
344
+ if (!caps)
345
+ return undefined;
346
+ switch (capability) {
347
+ case 'image': return caps.imageOutput;
348
+ case 'audio': return caps.audioOutput;
349
+ case 'video': return caps.videoOutput;
350
+ }
351
+ }
66
352
  /**
67
353
  * Cost estimation per 1M tokens (in cents)
68
- * Prices sourced from official provider pricing pages as of Jan 2025
354
+ * Prices sourced from official provider pricing pages as of January 2026
69
355
  */
70
356
  exports.COST_PER_MILLION_TOKENS = {
71
357
  // ==========================================================================
72
- // OpenAI (https://openai.com/pricing)
358
+ // OpenAI (https://openai.com/pricing) - January 2026
359
+ // Images: counted as tokens (~765 tokens per 512x512 image)
360
+ // Audio: Realtime API pricing
73
361
  // ==========================================================================
74
- 'gpt-4o': { input: 250, output: 1000 },
75
- 'gpt-4o-mini': { input: 15, output: 60 },
362
+ // GPT-4.1 family (latest non-reasoning)
363
+ 'gpt-4.1': { input: 200, output: 800 },
364
+ 'gpt-4.1-mini': { input: 40, output: 160 },
365
+ 'gpt-4.1-nano': { input: 10, output: 40 },
366
+ // GPT-4o (omni - multimodal)
367
+ 'gpt-4o': {
368
+ input: 250, output: 1000,
369
+ audioInput: 600, // ~$6.00 per minute (Realtime API)
370
+ audioOutput: 1200, // ~$12.00 per minute (Realtime API)
371
+ },
372
+ 'gpt-4o-mini': {
373
+ input: 15, output: 60,
374
+ audioInput: 60, // ~$0.60 per minute (Realtime API)
375
+ audioOutput: 120, // ~$1.20 per minute (Realtime API)
376
+ },
377
+ // Reasoning models (o-series)
378
+ 'o3': { input: 1000, output: 4000 },
379
+ 'o3-pro': { input: 15000, output: 60000 },
380
+ 'o4-mini': { input: 150, output: 600 },
381
+ // Legacy
76
382
  'gpt-4-turbo': { input: 1000, output: 3000 },
77
- 'gpt-3.5-turbo': { input: 50, output: 150 },
78
383
  'o1': { input: 1500, output: 6000 },
79
- 'o1-mini': { input: 300, output: 1200 },
80
- 'o1-pro': { input: 15000, output: 60000 },
81
384
  // ==========================================================================
82
- // Anthropic (https://anthropic.com/pricing)
385
+ // Anthropic (https://anthropic.com/pricing) - January 2026
83
386
  // ==========================================================================
387
+ // Claude 4.5
388
+ 'claude-opus-4-5-20251124': { input: 2000, output: 10000 },
389
+ 'claude-sonnet-4-5-20251124': { input: 400, output: 2000 },
390
+ // Claude 4.1
391
+ 'claude-opus-4-1-20250805': { input: 1800, output: 9000 },
392
+ // Claude 4
84
393
  'claude-sonnet-4-20250514': { input: 300, output: 1500 },
85
394
  'claude-opus-4-20250514': { input: 1500, output: 7500 },
395
+ // Claude 3.5
86
396
  'claude-3-5-haiku-20241022': { input: 80, output: 400 },
87
- // Legacy model names (for backwards compatibility)
88
- 'claude-3-5-sonnet-20241022': { input: 300, output: 1500 },
89
- 'claude-3-opus-20240229': { input: 1500, output: 7500 },
90
- 'claude-3-haiku-20240307': { input: 25, output: 125 },
91
397
  // ==========================================================================
92
- // Google Gemini (https://ai.google.dev/pricing)
398
+ // Google Gemini (https://ai.google.dev/pricing) - January 2026
399
+ // Images: ~258 tokens/image, Audio: ~32 tokens/sec, Video: ~263 tokens/sec
93
400
  // ==========================================================================
94
- 'gemini-2.0-flash': { input: 10, output: 40 },
401
+ // Gemini 3 (latest)
402
+ 'gemini-3-pro-preview': { input: 175, output: 700 },
403
+ 'gemini-3-flash-preview': { input: 15, output: 60 },
404
+ 'gemini-3-pro-image-preview': {
405
+ input: 175, output: 700,
406
+ imageOutput: 8, // ~$0.08 per generated image
407
+ },
408
+ // Gemini 2.5
409
+ 'gemini-2.5-pro': { input: 125, output: 500 },
410
+ 'gemini-2.5-flash': { input: 7.5, output: 30 },
411
+ 'gemini-2.5-flash-lite': { input: 3.75, output: 15 },
412
+ 'gemini-2.5-flash-image': {
413
+ input: 10, output: 40,
414
+ imageOutput: 4, // ~$0.04 per generated image
415
+ },
416
+ 'gemini-2.5-flash-native-audio-preview': {
417
+ input: 10, output: 40,
418
+ audioInput: 10, // ~$0.10 per minute audio input
419
+ audioOutput: 60, // ~$0.60 per minute audio output
420
+ },
421
+ // Gemini 2.0
422
+ 'gemini-2.0-flash': {
423
+ input: 10, output: 40,
424
+ imageOutput: 4, // ~$0.04 per generated image
425
+ audioOutput: 60, // ~$0.60 per minute of audio output
426
+ },
95
427
  'gemini-2.0-flash-lite': { input: 5, output: 20 },
96
- 'gemini-1.5-pro': { input: 125, output: 500 },
97
- 'gemini-1.5-flash': { input: 7.5, output: 30 },
98
428
  // ==========================================================================
99
- // Mistral AI (https://mistral.ai/technology/#pricing)
429
+ // Mistral AI (https://mistral.ai/technology/#pricing) - January 2026
100
430
  // ==========================================================================
431
+ // Large models (Mistral Large 3)
432
+ 'mistral-large-2512': { input: 200, output: 600 },
101
433
  'mistral-large-latest': { input: 200, output: 600 },
102
- 'mistral-medium-latest': { input: 270, output: 810 },
434
+ // Medium models
435
+ 'mistral-medium-3.1': { input: 100, output: 300 },
436
+ 'mistral-medium-latest': { input: 100, output: 300 },
437
+ // Small models
438
+ 'mistral-small-3.2': { input: 20, output: 60 },
103
439
  'mistral-small-latest': { input: 10, output: 30 },
440
+ // Ministral family (small, efficient)
441
+ 'ministral-3b-2512': { input: 4, output: 12 },
442
+ 'ministral-8b-2512': { input: 10, output: 30 },
443
+ 'ministral-14b-2512': { input: 15, output: 45 },
444
+ // Code models
445
+ 'codestral-2501': { input: 30, output: 90 },
104
446
  'codestral-latest': { input: 30, output: 90 },
105
- 'mistral-nemo': { input: 15, output: 15 },
447
+ // Vision models (Pixtral)
448
+ 'pixtral-large-2411': { input: 200, output: 600 },
449
+ 'pixtral-large-latest': { input: 200, output: 600 },
450
+ // Audio models (Voxtral)
451
+ 'voxtral-small': { input: 20, output: 60, audioInput: 15 },
452
+ 'voxtral-mini': { input: 10, output: 30, audioInput: 8 },
453
+ // Document AI
454
+ 'mistral-ocr-2512': { input: 15, output: 45 },
106
455
  // ==========================================================================
107
- // Cohere (https://cohere.com/pricing)
456
+ // Cohere (https://cohere.com/pricing) - January 2026
108
457
  // ==========================================================================
458
+ // Command A family (latest)
459
+ 'command-a-03-2025': { input: 250, output: 1000 },
460
+ 'command-a-reasoning': { input: 400, output: 1600 },
461
+ 'command-a-vision': { input: 300, output: 1200 },
462
+ // Command R family
463
+ 'command-r-plus-08-2024': { input: 250, output: 1000 },
464
+ 'command-r-08-2024': { input: 15, output: 60 },
109
465
  'command-r-plus': { input: 250, output: 1000 },
110
466
  'command-r': { input: 15, output: 60 },
111
- 'command': { input: 100, output: 200 },
112
- 'command-light': { input: 30, output: 60 },
113
467
  // ==========================================================================
114
- // Groq (https://groq.com/pricing) - Fast inference, competitive pricing
468
+ // Groq (https://groq.com/pricing) - Fast inference, January 2026
115
469
  // ==========================================================================
470
+ // Llama models
116
471
  'llama-3.3-70b-versatile': { input: 59, output: 79 },
117
472
  'llama-3.1-8b-instant': { input: 5, output: 8 },
118
- 'mixtral-8x7b-32768': { input: 24, output: 24 },
119
- 'gemma2-9b-it': { input: 20, output: 20 },
473
+ // GPT OSS models
474
+ 'openai/gpt-oss-120b': { input: 150, output: 200 },
475
+ 'openai/gpt-oss-20b': { input: 30, output: 40 },
476
+ // Compound (agentic)
477
+ 'groq/compound': { input: 100, output: 150 },
478
+ 'groq/compound-mini': { input: 30, output: 50 },
479
+ // Safety
480
+ 'meta-llama/llama-guard-4-12b': { input: 20, output: 20 },
481
+ // Audio (Whisper - speech-to-text, per minute)
482
+ 'whisper-large-v3': { input: 11, output: 0, audioInput: 11 },
483
+ 'whisper-large-v3-turbo': { input: 4, output: 0, audioInput: 4 },
120
484
  // ==========================================================================
121
- // xAI Grok (https://x.ai/api)
485
+ // xAI Grok (https://x.ai/api) - January 2026
122
486
  // ==========================================================================
487
+ // Grok 4 (latest)
488
+ 'grok-4': { input: 500, output: 2000 },
489
+ 'grok-4.1-fast': { input: 100, output: 400 },
490
+ // Grok 3
491
+ 'grok-3': { input: 300, output: 1200 },
492
+ 'grok-3-mini': { input: 30, output: 120 },
493
+ 'grok-3-vision': { input: 350, output: 1400 },
494
+ // Grok 2 (legacy)
123
495
  'grok-2': { input: 200, output: 1000 },
124
- 'grok-2-mini': { input: 20, output: 100 },
496
+ 'grok-2-vision': { input: 200, output: 1000 },
125
497
  // ==========================================================================
126
- // DeepSeek (https://platform.deepseek.com/api-docs/pricing)
498
+ // DeepSeek (https://platform.deepseek.com/api-docs/pricing) - January 2026
499
+ // V3.2 pricing (very competitive)
127
500
  // ==========================================================================
128
501
  'deepseek-chat': { input: 14, output: 28 },
129
- 'deepseek-coder': { input: 14, output: 28 },
130
502
  'deepseek-reasoner': { input: 55, output: 219 },
131
503
  // ==========================================================================
132
- // Perplexity (https://docs.perplexity.ai/guides/pricing)
504
+ // Perplexity (https://docs.perplexity.ai/guides/pricing) - January 2026
505
+ // Sonar family (includes search costs)
133
506
  // ==========================================================================
134
- 'llama-3.1-sonar-small-128k-online': { input: 20, output: 20 },
135
- 'llama-3.1-sonar-large-128k-online': { input: 100, output: 100 },
136
- 'llama-3.1-sonar-huge-128k-online': { input: 500, output: 500 },
507
+ 'sonar': { input: 100, output: 100 },
508
+ 'sonar-pro': { input: 300, output: 300 },
509
+ 'sonar-reasoning': { input: 500, output: 500 },
510
+ 'sonar-reasoning-pro': { input: 800, output: 800 },
511
+ 'sonar-deep-research': { input: 1200, output: 1200 },
137
512
  // ==========================================================================
138
- // LLM Server (custom) - Default/estimated pricing
513
+ // LLM Server (custom) - Default/estimated pricing for local models
139
514
  // ==========================================================================
515
+ // Text models
140
516
  'qwen/qwen3-30b-a3b-2507': { input: 50, output: 100 },
141
517
  'meta-llama-3.1-8b-instruct': { input: 20, output: 40 },
142
518
  'qwen-32b-everything': { input: 50, output: 100 },
143
- 'openai/gpt-oss-20b': { input: 30, output: 60 },
519
+ // Vision models (LM Studio / local) - estimated based on model size
520
+ 'llava-v1.6-mistral-7b': { input: 25, output: 50 },
521
+ 'llava-v1.6-vicuna-13b': { input: 40, output: 80 },
522
+ 'qwen2-vl-7b-instruct': { input: 25, output: 50 },
523
+ 'phi-3-vision-128k-instruct': { input: 20, output: 40 },
524
+ 'minicpm-v-2_6': { input: 15, output: 30 },
525
+ 'moondream2': { input: 10, output: 20 },
526
+ 'internvl2-8b': { input: 25, output: 50 },
527
+ 'llama-3.2-11b-vision': { input: 30, output: 60 },
528
+ 'pixtral-12b': { input: 35, output: 70 },
144
529
  // ==========================================================================
145
530
  // Default for unknown models
146
531
  // ==========================================================================
@@ -156,7 +541,7 @@ function getModelPricing(model) {
156
541
  return exports.COST_PER_MILLION_TOKENS[model] ?? DEFAULT_MODEL_PRICING;
157
542
  }
158
543
  /**
159
- * Estimate cost in cents for token usage
544
+ * Estimate cost in cents for token usage (text only, for backwards compatibility)
160
545
  */
161
546
  function estimateCost(model, inputTokens, outputTokens) {
162
547
  const costs = getModelPricing(model);
@@ -164,6 +549,42 @@ function estimateCost(model, inputTokens, outputTokens) {
164
549
  const outputCost = (outputTokens / 1000000) * costs.output;
165
550
  return Math.round((inputCost + outputCost) * 100) / 100; // Round to 2 decimal places
166
551
  }
552
+ /**
553
+ * Estimate cost in cents for multimodal usage
554
+ */
555
+ function estimateMultimodalCost(model, usage) {
556
+ const pricing = getModelPricing(model);
557
+ let totalCost = 0;
558
+ // Text token costs
559
+ if (usage.inputTokens) {
560
+ totalCost += (usage.inputTokens / 1000000) * pricing.input;
561
+ }
562
+ if (usage.outputTokens) {
563
+ totalCost += (usage.outputTokens / 1000000) * pricing.output;
564
+ }
565
+ // Image costs
566
+ if (usage.imagesInput && pricing.imageInput) {
567
+ totalCost += usage.imagesInput * pricing.imageInput;
568
+ }
569
+ if (usage.imagesOutput && pricing.imageOutput) {
570
+ totalCost += usage.imagesOutput * pricing.imageOutput;
571
+ }
572
+ // Audio costs
573
+ if (usage.audioInputMinutes && pricing.audioInput) {
574
+ totalCost += usage.audioInputMinutes * pricing.audioInput;
575
+ }
576
+ if (usage.audioOutputMinutes && pricing.audioOutput) {
577
+ totalCost += usage.audioOutputMinutes * pricing.audioOutput;
578
+ }
579
+ // Video costs
580
+ if (usage.videoInputMinutes && pricing.videoInput) {
581
+ totalCost += usage.videoInputMinutes * pricing.videoInput;
582
+ }
583
+ if (usage.videoOutputMinutes && pricing.videoOutput) {
584
+ totalCost += usage.videoOutputMinutes * pricing.videoOutput;
585
+ }
586
+ return Math.round(totalCost * 100) / 100; // Round to 2 decimal places
587
+ }
167
588
  /**
168
589
  * Format cost in cents to a readable string (e.g., "$0.0015" or "$1.50")
169
590
  */