@ai-sdk/fireworks 3.0.100 → 3.0.102

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.
@@ -5,6 +5,7 @@ import type {
5
5
  } from '@ai-sdk/openai-compatible';
6
6
  import type {
7
7
  ModelCapabilities,
8
+ ModelCapability,
8
9
  ModelEntry,
9
10
  ProviderOptionDefinition,
10
11
  ProviderOptionDefinitions,
@@ -12,7 +13,6 @@ import type {
12
13
  import type { FireworksLanguageModelOptions } from './fireworks-chat-options';
13
14
  import type { FireworksEmbeddingModelOptions } from './fireworks-embedding-options';
14
15
  import type { FireworksImageModelOptions } from './fireworks-image-model-options';
15
- import type { FireworksImageModelId } from './fireworks-image-options';
16
16
  const compatiblelanguageProviderOptions = {
17
17
  user: {
18
18
  description:
@@ -119,244 +119,441 @@ export const fireworksProviderOptions = {
119
119
  >,
120
120
  } as const satisfies ProviderOptionDefinitions;
121
121
 
122
- const languageDefinitions = {
123
- 'accounts/fireworks/models/deepseek-v3': { endpoints: ['chat'] },
124
- 'accounts/fireworks/models/llama-v3p3-70b-instruct': { endpoints: ['chat'] },
125
- 'accounts/fireworks/models/llama-v3p2-3b-instruct': { endpoints: ['chat'] },
126
- 'accounts/fireworks/models/llama-v3p1-405b-instruct': { endpoints: ['chat'] },
127
- 'accounts/fireworks/models/llama-v3p1-8b-instruct': { endpoints: ['chat'] },
128
- 'accounts/fireworks/models/mixtral-8x7b-instruct': { endpoints: ['chat'] },
129
- 'accounts/fireworks/models/mixtral-8x22b-instruct': { endpoints: ['chat'] },
130
- 'accounts/fireworks/models/mixtral-8x7b-instruct-hf': { endpoints: ['chat'] },
131
- 'accounts/fireworks/models/qwen2p5-coder-32b-instruct': {
132
- endpoints: ['chat'],
133
- },
134
- 'accounts/fireworks/models/qwen2p5-72b-instruct': { endpoints: ['chat'] },
135
- 'accounts/fireworks/models/qwen-qwq-32b-preview': { endpoints: ['chat'] },
136
- 'accounts/fireworks/models/qwen2-vl-72b-instruct': { endpoints: ['chat'] },
137
- 'accounts/fireworks/models/llama-v3p2-11b-vision-instruct': {
122
+ /** A reasoning effort that Fireworks accepts in `reasoning_effort`. */
123
+ type FireworksReasoningEffort =
124
+ | 'none'
125
+ | 'minimal'
126
+ | 'low'
127
+ | 'medium'
128
+ | 'high'
129
+ | 'xhigh'
130
+ | 'max';
131
+
132
+ type FireworksLanguageModelEntry = {
133
+ capabilities: {
134
+ language: NonNullable<ModelCapabilities['language']> & {
135
+ structuredOutput: { jsonSchema: boolean };
136
+ };
137
+ };
138
+ providerOptions: { language: Record<string, ModelCapability> };
139
+ requestConfig: {
140
+ language: {
141
+ reasoningEffortMap: Partial<
142
+ Record<FireworksReasoningEffort, FireworksReasoningEffort>
143
+ >;
144
+ };
145
+ };
146
+ };
147
+
148
+ /**
149
+ * One row of the language model matrix. Every capability that differs between
150
+ * models is one flat cell, and every listed model fills in every cell. Nothing
151
+ * is derived from the model ID.
152
+ *
153
+ * Facts that depend on each other share one cell, so a row cannot contradict
154
+ * itself: a cell is a single value, one of a fixed set of values, or the list
155
+ * of what the model supports.
156
+ */
157
+ export type FireworksLanguageModelRow = {
158
+ /**
159
+ * The Fireworks APIs whose model ID types list this model ID. Empty: the
160
+ * model ID is only in the catalog. It does not change a request.
161
+ */
162
+ endpoints: readonly ('chat' | 'completion')[];
163
+ image: ModelCapability;
164
+ objectGeneration: ModelCapability;
165
+ /**
166
+ * `false`: the model does not call function tools. Otherwise it does, and
167
+ * the list holds what it supports on top of that: `streaming` means it
168
+ * also calls tools in a streamed response. `'unknown'`: not documented.
169
+ */
170
+ functionTools: 'unknown' | false | readonly 'streaming'[];
171
+ /**
172
+ * The reasoning efforts the SDK sends for the portable `reasoning`
173
+ * setting. A level that is not listed is sent as the closest listed effort
174
+ * below it, or else above it.
175
+ */
176
+ reasoningEfforts: readonly FireworksReasoningEffort[];
177
+ };
178
+
179
+ /**
180
+ * Language model matrix: model IDs by capability. To add a model, add a row
181
+ * and fill in every column.
182
+ */
183
+ const languageModelDefinitions = {
184
+ 'accounts/fireworks/models/deepseek-v3': {
138
185
  endpoints: ['chat'],
139
- },
140
- 'accounts/fireworks/models/qwq-32b': { endpoints: ['chat'] },
141
- 'accounts/fireworks/models/yi-large': { endpoints: ['chat'] },
142
- 'accounts/fireworks/models/kimi-k2-instruct': { endpoints: ['chat'] },
143
- 'accounts/fireworks/models/kimi-k2-thinking': { endpoints: ['chat'] },
144
- 'accounts/fireworks/models/kimi-k2p6': { endpoints: ['chat'] },
145
- 'accounts/fireworks/models/minimax-m2': { endpoints: ['chat'] },
146
- 'accounts/fireworks/models/llama-v3-8b-instruct': {
147
- endpoints: ['completion'],
148
- },
149
- 'accounts/fireworks/models/llama-v2-34b-code': { endpoints: ['completion'] },
150
- } as const;
151
- const embeddingModelIds = ['nomic-ai/nomic-embed-text-v1.5'] as const;
152
- const imageModelIds = [
153
- 'accounts/fireworks/models/flux-1-dev-fp8',
154
- 'accounts/fireworks/models/flux-1-schnell-fp8',
155
- 'accounts/fireworks/models/flux-kontext-pro',
156
- 'accounts/fireworks/models/flux-kontext-max',
157
- 'accounts/fireworks/models/playground-v2-5-1024px-aesthetic',
158
- 'accounts/fireworks/models/japanese-stable-diffusion-xl',
159
- 'accounts/fireworks/models/playground-v2-1024px-aesthetic',
160
- 'accounts/fireworks/models/SSD-1B',
161
- 'accounts/fireworks/models/stable-diffusion-xl-1024-v1-0',
162
- ] as const;
163
- const documentedLanguageCapabilities: Record<
164
- string,
165
- NonNullable<ModelCapabilities['language']>
166
- > = {
167
- 'accounts/fireworks/models/firefunction-v1': {
168
- inputs: { image: false, audio: 'unknown' },
186
+ image: false,
169
187
  objectGeneration: true,
170
- tools: { usage: true, streaming: true },
171
- reasoning: { support: 'unknown' },
172
- sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
188
+ functionTools: [],
189
+ reasoningEfforts: [
190
+ 'none',
191
+ 'minimal',
192
+ 'low',
193
+ 'medium',
194
+ 'high',
195
+ 'xhigh',
196
+ 'max',
197
+ ],
173
198
  },
174
- 'accounts/fireworks/models/deepseek-r1': {
175
- inputs: { image: false, audio: 'unknown' },
199
+ 'accounts/fireworks/models/llama-v3p3-70b-instruct': {
200
+ endpoints: ['chat'],
201
+ image: false,
176
202
  objectGeneration: true,
177
- tools: { usage: false, streaming: false },
178
- reasoning: { support: 'unknown' },
179
- sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
203
+ functionTools: [],
204
+ reasoningEfforts: [
205
+ 'none',
206
+ 'minimal',
207
+ 'low',
208
+ 'medium',
209
+ 'high',
210
+ 'xhigh',
211
+ 'max',
212
+ ],
180
213
  },
181
- 'accounts/fireworks/models/deepseek-v3': {
182
- inputs: { image: false, audio: 'unknown' },
214
+ 'accounts/fireworks/models/llama-v3p2-3b-instruct': {
215
+ endpoints: ['chat'],
216
+ image: false,
183
217
  objectGeneration: true,
184
- tools: { usage: true, streaming: false },
185
- reasoning: { support: 'unknown' },
186
- sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
218
+ functionTools: [],
219
+ reasoningEfforts: [
220
+ 'none',
221
+ 'minimal',
222
+ 'low',
223
+ 'medium',
224
+ 'high',
225
+ 'xhigh',
226
+ 'max',
227
+ ],
187
228
  },
188
229
  'accounts/fireworks/models/llama-v3p1-405b-instruct': {
189
- inputs: { image: false, audio: 'unknown' },
230
+ endpoints: ['chat'],
231
+ image: false,
190
232
  objectGeneration: true,
191
- tools: { usage: true, streaming: true },
192
- reasoning: { support: 'unknown' },
193
- sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
233
+ functionTools: ['streaming'],
234
+ reasoningEfforts: [
235
+ 'none',
236
+ 'minimal',
237
+ 'low',
238
+ 'medium',
239
+ 'high',
240
+ 'xhigh',
241
+ 'max',
242
+ ],
194
243
  },
195
244
  'accounts/fireworks/models/llama-v3p1-8b-instruct': {
196
- inputs: { image: false, audio: 'unknown' },
197
- objectGeneration: true,
198
- tools: { usage: true, streaming: false },
199
- reasoning: { support: 'unknown' },
200
- sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
201
- },
202
- 'accounts/fireworks/models/llama-v3p2-3b-instruct': {
203
- inputs: { image: false, audio: 'unknown' },
204
- objectGeneration: true,
205
- tools: { usage: true, streaming: false },
206
- reasoning: { support: 'unknown' },
207
- sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
208
- },
209
- 'accounts/fireworks/models/llama-v3p3-70b-instruct': {
210
- inputs: { image: false, audio: 'unknown' },
245
+ endpoints: ['chat'],
246
+ image: false,
211
247
  objectGeneration: true,
212
- tools: { usage: true, streaming: false },
213
- reasoning: { support: 'unknown' },
214
- sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
248
+ functionTools: [],
249
+ reasoningEfforts: [
250
+ 'none',
251
+ 'minimal',
252
+ 'low',
253
+ 'medium',
254
+ 'high',
255
+ 'xhigh',
256
+ 'max',
257
+ ],
215
258
  },
216
259
  'accounts/fireworks/models/mixtral-8x7b-instruct': {
217
- inputs: { image: false, audio: 'unknown' },
260
+ endpoints: ['chat'],
261
+ image: false,
218
262
  objectGeneration: true,
219
- tools: { usage: true, streaming: false },
220
- reasoning: { support: 'unknown' },
221
- sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
263
+ functionTools: [],
264
+ reasoningEfforts: [
265
+ 'none',
266
+ 'minimal',
267
+ 'low',
268
+ 'medium',
269
+ 'high',
270
+ 'xhigh',
271
+ 'max',
272
+ ],
222
273
  },
223
- 'accounts/fireworks/models/mixtral-8x7b-instruct-hf': {
224
- inputs: { image: false, audio: 'unknown' },
274
+ 'accounts/fireworks/models/mixtral-8x22b-instruct': {
275
+ endpoints: ['chat'],
276
+ image: false,
225
277
  objectGeneration: true,
226
- tools: { usage: true, streaming: false },
227
- reasoning: { support: 'unknown' },
228
- sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
278
+ functionTools: [],
279
+ reasoningEfforts: [
280
+ 'none',
281
+ 'minimal',
282
+ 'low',
283
+ 'medium',
284
+ 'high',
285
+ 'xhigh',
286
+ 'max',
287
+ ],
229
288
  },
230
- 'accounts/fireworks/models/mixtral-8x22b-instruct': {
231
- inputs: { image: false, audio: 'unknown' },
289
+ 'accounts/fireworks/models/mixtral-8x7b-instruct-hf': {
290
+ endpoints: ['chat'],
291
+ image: false,
232
292
  objectGeneration: true,
233
- tools: { usage: true, streaming: false },
234
- reasoning: { support: 'unknown' },
235
- sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
293
+ functionTools: [],
294
+ reasoningEfforts: [
295
+ 'none',
296
+ 'minimal',
297
+ 'low',
298
+ 'medium',
299
+ 'high',
300
+ 'xhigh',
301
+ 'max',
302
+ ],
236
303
  },
237
304
  'accounts/fireworks/models/qwen2p5-coder-32b-instruct': {
238
- inputs: { image: false, audio: 'unknown' },
305
+ endpoints: ['chat'],
306
+ image: false,
239
307
  objectGeneration: true,
240
- tools: { usage: true, streaming: false },
241
- reasoning: { support: 'unknown' },
242
- sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
308
+ functionTools: [],
309
+ reasoningEfforts: [
310
+ 'none',
311
+ 'minimal',
312
+ 'low',
313
+ 'medium',
314
+ 'high',
315
+ 'xhigh',
316
+ 'max',
317
+ ],
243
318
  },
244
319
  'accounts/fireworks/models/qwen2p5-72b-instruct': {
245
- inputs: { image: false, audio: 'unknown' },
320
+ endpoints: ['chat'],
321
+ image: false,
246
322
  objectGeneration: true,
247
- tools: { usage: true, streaming: false },
248
- reasoning: { support: 'unknown' },
249
- sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
323
+ functionTools: [],
324
+ reasoningEfforts: [
325
+ 'none',
326
+ 'minimal',
327
+ 'low',
328
+ 'medium',
329
+ 'high',
330
+ 'xhigh',
331
+ 'max',
332
+ ],
250
333
  },
251
334
  'accounts/fireworks/models/qwen-qwq-32b-preview': {
252
- inputs: { image: false, audio: 'unknown' },
335
+ endpoints: ['chat'],
336
+ image: false,
253
337
  objectGeneration: true,
254
- tools: { usage: false, streaming: false },
255
- reasoning: { support: 'unknown' },
256
- sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
338
+ functionTools: false,
339
+ reasoningEfforts: [
340
+ 'none',
341
+ 'minimal',
342
+ 'low',
343
+ 'medium',
344
+ 'high',
345
+ 'xhigh',
346
+ 'max',
347
+ ],
257
348
  },
258
349
  'accounts/fireworks/models/qwen2-vl-72b-instruct': {
259
- inputs: { image: true, audio: 'unknown' },
350
+ endpoints: ['chat'],
351
+ image: true,
260
352
  objectGeneration: true,
261
- tools: { usage: false, streaming: false },
262
- reasoning: { support: 'unknown' },
263
- sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
353
+ functionTools: false,
354
+ reasoningEfforts: [
355
+ 'none',
356
+ 'minimal',
357
+ 'low',
358
+ 'medium',
359
+ 'high',
360
+ 'xhigh',
361
+ 'max',
362
+ ],
264
363
  },
265
364
  'accounts/fireworks/models/llama-v3p2-11b-vision-instruct': {
266
- inputs: { image: true, audio: 'unknown' },
365
+ endpoints: ['chat'],
366
+ image: true,
267
367
  objectGeneration: true,
268
- tools: { usage: true, streaming: false },
269
- reasoning: { support: 'unknown' },
270
- sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
368
+ functionTools: [],
369
+ reasoningEfforts: [
370
+ 'none',
371
+ 'minimal',
372
+ 'low',
373
+ 'medium',
374
+ 'high',
375
+ 'xhigh',
376
+ 'max',
377
+ ],
271
378
  },
272
379
  'accounts/fireworks/models/qwq-32b': {
273
- inputs: { image: false, audio: 'unknown' },
380
+ endpoints: ['chat'],
381
+ image: false,
274
382
  objectGeneration: true,
275
- tools: { usage: false, streaming: false },
276
- reasoning: { support: 'unknown' },
277
- sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
383
+ functionTools: false,
384
+ reasoningEfforts: [
385
+ 'none',
386
+ 'minimal',
387
+ 'low',
388
+ 'medium',
389
+ 'high',
390
+ 'xhigh',
391
+ 'max',
392
+ ],
278
393
  },
279
394
  'accounts/fireworks/models/yi-large': {
280
- inputs: { image: false, audio: 'unknown' },
395
+ endpoints: ['chat'],
396
+ image: false,
281
397
  objectGeneration: true,
282
- tools: { usage: true, streaming: false },
283
- reasoning: { support: 'unknown' },
284
- sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
398
+ functionTools: [],
399
+ reasoningEfforts: [
400
+ 'none',
401
+ 'minimal',
402
+ 'low',
403
+ 'medium',
404
+ 'high',
405
+ 'xhigh',
406
+ 'max',
407
+ ],
285
408
  },
286
409
  'accounts/fireworks/models/kimi-k2-instruct': {
287
- inputs: { image: false, audio: 'unknown' },
410
+ endpoints: ['chat'],
411
+ image: false,
288
412
  objectGeneration: true,
289
- tools: { usage: true, streaming: false },
290
- reasoning: { support: 'unknown' },
291
- sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
413
+ functionTools: [],
414
+ reasoningEfforts: [
415
+ 'none',
416
+ 'minimal',
417
+ 'low',
418
+ 'medium',
419
+ 'high',
420
+ 'xhigh',
421
+ 'max',
422
+ ],
292
423
  },
293
424
  'accounts/fireworks/models/kimi-k2-thinking': {
294
- inputs: { image: false, audio: 'unknown' },
425
+ endpoints: ['chat'],
426
+ image: false,
295
427
  objectGeneration: true,
296
- tools: { usage: true, streaming: false },
297
- reasoning: { support: 'unknown' },
298
- sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
428
+ functionTools: [],
429
+ reasoningEfforts: [
430
+ 'none',
431
+ 'minimal',
432
+ 'low',
433
+ 'medium',
434
+ 'high',
435
+ 'xhigh',
436
+ 'max',
437
+ ],
299
438
  },
300
439
  'accounts/fireworks/models/kimi-k2p6': {
301
- inputs: { image: true, audio: 'unknown' },
440
+ endpoints: ['chat'],
441
+ image: true,
302
442
  objectGeneration: true,
303
- tools: { usage: true, streaming: false },
304
- reasoning: { support: 'unknown' },
305
- sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
443
+ functionTools: [],
444
+ reasoningEfforts: [
445
+ 'none',
446
+ 'minimal',
447
+ 'low',
448
+ 'medium',
449
+ 'high',
450
+ 'xhigh',
451
+ 'max',
452
+ ],
306
453
  },
307
454
  'accounts/fireworks/models/minimax-m2': {
308
- inputs: { image: false, audio: 'unknown' },
455
+ endpoints: ['chat'],
456
+ image: false,
309
457
  objectGeneration: true,
310
- tools: { usage: true, streaming: false },
311
- reasoning: { support: 'unknown' },
312
- sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
458
+ functionTools: [],
459
+ reasoningEfforts: [
460
+ 'none',
461
+ 'minimal',
462
+ 'low',
463
+ 'medium',
464
+ 'high',
465
+ 'xhigh',
466
+ 'max',
467
+ ],
313
468
  },
314
- };
315
- const unknownLanguageCapabilities: NonNullable<ModelCapabilities['language']> =
316
- {
317
- inputs: { image: 'unknown', audio: 'unknown' },
469
+ 'accounts/fireworks/models/llama-v3-8b-instruct': {
470
+ endpoints: ['completion'],
471
+ image: 'unknown',
318
472
  objectGeneration: 'unknown',
319
- tools: { usage: 'unknown', streaming: 'unknown' },
320
- reasoning: { support: 'unknown' },
321
- sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
322
- };
323
-
324
- // Model families that always reason and reject reasoning effort 'none'.
325
- const modelsWithoutNoneReasoningEffort = /^(?:gpt-oss|glm-5p3|muse-spark)/;
326
-
327
- // Model families that reject reasoning effort 'minimal'.
328
- const modelsWithoutMinimalReasoningEffort = /^(?:nemotron|inkling)/;
329
-
330
- /**
331
- * Fireworks accepts every reasoning effort for most models, so reasoning
332
- * values are sent directly, except to model families known to reject them.
333
- */
334
- function getFireworksReasoningEffortMap(modelId: string) {
335
- const modelName = modelId.slice(modelId.lastIndexOf('/') + 1);
473
+ functionTools: 'unknown',
474
+ reasoningEfforts: [
475
+ 'none',
476
+ 'minimal',
477
+ 'low',
478
+ 'medium',
479
+ 'high',
480
+ 'xhigh',
481
+ 'max',
482
+ ],
483
+ },
484
+ 'accounts/fireworks/models/llama-v2-34b-code': {
485
+ endpoints: ['completion'],
486
+ image: 'unknown',
487
+ objectGeneration: 'unknown',
488
+ functionTools: 'unknown',
489
+ reasoningEfforts: [
490
+ 'none',
491
+ 'minimal',
492
+ 'low',
493
+ 'medium',
494
+ 'high',
495
+ 'xhigh',
496
+ 'max',
497
+ ],
498
+ },
499
+ 'accounts/fireworks/models/firefunction-v1': {
500
+ endpoints: [],
501
+ image: false,
502
+ objectGeneration: true,
503
+ functionTools: ['streaming'],
504
+ reasoningEfforts: [
505
+ 'none',
506
+ 'minimal',
507
+ 'low',
508
+ 'medium',
509
+ 'high',
510
+ 'xhigh',
511
+ 'max',
512
+ ],
513
+ },
514
+ 'accounts/fireworks/models/deepseek-r1': {
515
+ endpoints: [],
516
+ image: false,
517
+ objectGeneration: true,
518
+ functionTools: false,
519
+ reasoningEfforts: [
520
+ 'none',
521
+ 'minimal',
522
+ 'low',
523
+ 'medium',
524
+ 'high',
525
+ 'xhigh',
526
+ 'max',
527
+ ],
528
+ },
529
+ } as const satisfies Record<string, FireworksLanguageModelRow>;
336
530
 
531
+ /** Maps a matrix row to its entry. Nothing here inspects the model ID. */
532
+ function createLanguageModelEntry(
533
+ row: FireworksLanguageModelRow,
534
+ ): FireworksLanguageModelEntry {
337
535
  return {
338
- ...(!modelsWithoutNoneReasoningEffort.test(modelName) && {
339
- none: 'none' as const,
340
- }),
341
- ...(!modelsWithoutMinimalReasoningEffort.test(modelName) && {
342
- minimal: 'minimal' as const,
343
- }),
344
- low: 'low' as const,
345
- medium: 'medium' as const,
346
- high: 'high' as const,
347
- xhigh: 'xhigh' as const,
348
- max: 'max' as const,
349
- };
350
- }
351
-
352
- export function getFireworksLanguageModelEntry(modelId: string) {
353
- const effortMap = getFireworksReasoningEffortMap(modelId);
354
- const entry = {
355
536
  capabilities: {
356
537
  language: {
357
- ...(documentedLanguageCapabilities[modelId] ??
358
- unknownLanguageCapabilities),
359
- reasoning: { support: 'unknown', efforts: Object.values(effortMap) },
538
+ inputs: { image: row.image, audio: 'unknown' },
539
+ objectGeneration: row.objectGeneration,
540
+ tools: {
541
+ usage:
542
+ row.functionTools === 'unknown'
543
+ ? 'unknown'
544
+ : row.functionTools !== false,
545
+ streaming:
546
+ row.functionTools === 'unknown'
547
+ ? 'unknown'
548
+ : row.functionTools !== false &&
549
+ row.functionTools.includes('streaming'),
550
+ },
551
+ reasoning: { support: 'unknown', efforts: [...row.reasoningEfforts] },
552
+ sampling: {
553
+ temperature: 'unknown',
554
+ topP: 'unknown',
555
+ logprobs: 'unknown',
556
+ },
360
557
  structuredOutput: { jsonSchema: true },
361
558
  },
362
559
  },
@@ -368,73 +565,175 @@ export function getFireworksLanguageModelEntry(modelId: string) {
368
565
  ]),
369
566
  ),
370
567
  },
371
- requestConfig: { language: { reasoningEffortMap: effortMap } },
372
- } as const;
373
- return entry satisfies ModelEntry<{
374
- language: { reasoningEffortMap: typeof effortMap };
375
- }>;
568
+ requestConfig: {
569
+ language: {
570
+ reasoningEffortMap: Object.fromEntries(
571
+ row.reasoningEfforts.map(effort => [effort, effort]),
572
+ ),
573
+ },
574
+ },
575
+ };
576
+ }
577
+
578
+ const listedLanguageModelEntries = Object.fromEntries(
579
+ Object.entries<FireworksLanguageModelRow>(languageModelDefinitions).map(
580
+ ([modelId, row]) => [modelId, createLanguageModelEntry(row)],
581
+ ),
582
+ );
583
+
584
+ // Family rules, used only for model IDs that are not listed in the matrix.
585
+ // Model families that always reason and reject reasoning effort 'none'.
586
+ const unlistedModelsWithoutNoneReasoningEffort =
587
+ /^(?:gpt-oss|glm-5p3|muse-spark)/;
588
+
589
+ // Model families that reject reasoning effort 'minimal'.
590
+ const unlistedModelsWithoutMinimalReasoningEffort = /^(?:nemotron|inkling)/;
591
+
592
+ /**
593
+ * Resolves a model ID that is not listed in the matrix to a row. This is the
594
+ * only place that looks at the model ID. Fireworks accepts every reasoning
595
+ * effort for most models, so every effort is sent, except to model families
596
+ * known to reject one.
597
+ */
598
+ function getUnlistedLanguageModelRow(
599
+ modelId: string,
600
+ ): FireworksLanguageModelRow {
601
+ const modelName = modelId.slice(modelId.lastIndexOf('/') + 1);
602
+ return {
603
+ endpoints: [],
604
+ image: 'unknown',
605
+ objectGeneration: 'unknown',
606
+ functionTools: 'unknown',
607
+ reasoningEfforts: [
608
+ ...(unlistedModelsWithoutNoneReasoningEffort.test(modelName)
609
+ ? []
610
+ : ['none' as const]),
611
+ ...(unlistedModelsWithoutMinimalReasoningEffort.test(modelName)
612
+ ? []
613
+ : ['minimal' as const]),
614
+ 'low',
615
+ 'medium',
616
+ 'high',
617
+ 'xhigh',
618
+ 'max',
619
+ ],
620
+ };
376
621
  }
377
- interface FireworksImageModelBackendConfig {
378
- urlFormat: 'workflows' | 'workflows_async' | 'image_generation';
379
- supportsSize?: boolean;
380
- supportsEditing?: boolean;
622
+
623
+ /**
624
+ * Returns the entry of a listed language model ID from its row. Every other
625
+ * model ID uses the fallback for unlisted IDs.
626
+ */
627
+ export function getFireworksLanguageModelEntry(modelId: string) {
628
+ return Object.prototype.hasOwnProperty.call(
629
+ listedLanguageModelEntries,
630
+ modelId,
631
+ )
632
+ ? listedLanguageModelEntries[modelId]
633
+ : createLanguageModelEntry(getUnlistedLanguageModelRow(modelId));
381
634
  }
382
635
 
383
- const modelToBackendConfig: Partial<
384
- Record<FireworksImageModelId, FireworksImageModelBackendConfig>
385
- > = {
636
+ /**
637
+ * The endpoint an image model is called on:
638
+ *
639
+ * - `workflows`: `/workflows/{model}/text_to_image`.
640
+ * - `workflows_async`: `/workflows/{model}`, then polled with `get_result`.
641
+ * - `image_generation`: `/image_generation/{model}`.
642
+ */
643
+ type FireworksImageUrlFormat =
644
+ | 'workflows'
645
+ | 'workflows_async'
646
+ | 'image_generation';
647
+
648
+ /** One row of the image model matrix. Nothing is derived from the model ID. */
649
+ export type FireworksImageModelRow = {
650
+ urlFormat: FireworksImageUrlFormat;
651
+ /**
652
+ * How the output size is set. `true`: an explicit width and height; an
653
+ * aspect ratio is dropped with a warning. `false`: an aspect ratio; a size
654
+ * is dropped with a warning.
655
+ */
656
+ size: boolean;
657
+ /** Accepts an input image (image editing). */
658
+ fileInput: boolean | 'unknown';
659
+ maskInput: boolean | 'unknown';
660
+ };
661
+
662
+ /**
663
+ * Image model matrix: model IDs by capability. To add a model, add a row and
664
+ * fill in every column.
665
+ */
666
+ const imageModelDefinitions = {
386
667
  'accounts/fireworks/models/flux-1-dev-fp8': {
387
668
  urlFormat: 'workflows',
669
+ size: false,
670
+ fileInput: false,
671
+ maskInput: false,
388
672
  },
389
673
  'accounts/fireworks/models/flux-1-schnell-fp8': {
390
674
  urlFormat: 'workflows',
675
+ size: false,
676
+ fileInput: false,
677
+ maskInput: false,
391
678
  },
392
679
  'accounts/fireworks/models/flux-kontext-pro': {
393
680
  urlFormat: 'workflows_async',
394
- supportsEditing: true,
681
+ size: false,
682
+ fileInput: true,
683
+ maskInput: false,
395
684
  },
396
685
  'accounts/fireworks/models/flux-kontext-max': {
397
686
  urlFormat: 'workflows_async',
398
- supportsEditing: true,
687
+ size: false,
688
+ fileInput: true,
689
+ maskInput: false,
399
690
  },
400
691
  'accounts/fireworks/models/playground-v2-5-1024px-aesthetic': {
401
692
  urlFormat: 'image_generation',
402
- supportsSize: true,
693
+ size: true,
694
+ fileInput: false,
695
+ maskInput: false,
403
696
  },
404
697
  'accounts/fireworks/models/japanese-stable-diffusion-xl': {
405
698
  urlFormat: 'image_generation',
406
- supportsSize: true,
699
+ size: true,
700
+ fileInput: false,
701
+ maskInput: false,
407
702
  },
408
703
  'accounts/fireworks/models/playground-v2-1024px-aesthetic': {
409
704
  urlFormat: 'image_generation',
410
- supportsSize: true,
705
+ size: true,
706
+ fileInput: false,
707
+ maskInput: false,
411
708
  },
412
- 'accounts/fireworks/models/stable-diffusion-xl-1024-v1-0': {
709
+ 'accounts/fireworks/models/SSD-1B': {
413
710
  urlFormat: 'image_generation',
414
- supportsSize: true,
711
+ size: true,
712
+ fileInput: false,
713
+ maskInput: false,
415
714
  },
416
- 'accounts/fireworks/models/SSD-1B': {
715
+ 'accounts/fireworks/models/stable-diffusion-xl-1024-v1-0': {
417
716
  urlFormat: 'image_generation',
418
- supportsSize: true,
717
+ size: true,
718
+ fileInput: false,
719
+ maskInput: false,
419
720
  },
420
- };
721
+ } satisfies Record<string, FireworksImageModelRow>;
421
722
 
422
- export function getFireworksImageModelEntry(modelId: string) {
423
- const config = modelToBackendConfig[modelId];
424
- const fileInput =
425
- config == null ? 'unknown' : config.supportsEditing === true;
723
+ /** Maps a matrix row to its entry. Nothing here inspects the model ID. */
724
+ function createImageModelEntry(row: FireworksImageModelRow) {
426
725
  const entry = {
427
726
  capabilities: {
428
727
  image: {
429
728
  sizes: {
430
- description: config?.supportsSize
729
+ description: row.size
431
730
  ? 'Explicit width and height.'
432
731
  : 'Aspect ratio; explicit sizes are not supported.',
433
732
  },
434
- fileInput,
435
- maskInput: config == null ? 'unknown' : false,
733
+ fileInput: row.fileInput,
734
+ maskInput: row.maskInput,
436
735
  maxImagesPerCall: 1,
437
- size: config?.supportsSize === true,
736
+ size: row.size,
438
737
  },
439
738
  },
440
739
  providerOptions: {
@@ -445,55 +744,99 @@ export function getFireworksImageModelEntry(modelId: string) {
445
744
  ]),
446
745
  ),
447
746
  },
448
- requestConfig: { image: { urlFormat: config?.urlFormat ?? 'workflows' } },
449
- } as const;
747
+ requestConfig: { image: { urlFormat: row.urlFormat } },
748
+ };
450
749
  return entry satisfies ModelEntry<{
451
- image: { urlFormat: FireworksImageModelBackendConfig['urlFormat'] };
750
+ image: { urlFormat: FireworksImageUrlFormat };
452
751
  }>;
453
752
  }
454
- export function getFireworksEmbeddingModelEntry(modelId: string) {
753
+
754
+ /** Row for every image model ID that is not listed in the matrix. */
755
+ const unlistedImageModelRow: FireworksImageModelRow = {
756
+ urlFormat: 'workflows',
757
+ size: false,
758
+ fileInput: 'unknown',
759
+ maskInput: 'unknown',
760
+ };
761
+
762
+ export function getFireworksImageModelEntry(modelId: string) {
763
+ return createImageModelEntry(
764
+ Object.prototype.hasOwnProperty.call(imageModelDefinitions, modelId)
765
+ ? imageModelDefinitions[modelId as keyof typeof imageModelDefinitions]
766
+ : unlistedImageModelRow,
767
+ );
768
+ }
769
+
770
+ type EmbeddingCapabilities = NonNullable<ModelCapabilities['embedding']> & {
771
+ maxTokens: number;
772
+ };
773
+
774
+ /** One row of the embedding model matrix. */
775
+ export type FireworksEmbeddingModelRow = {
776
+ defaultDimensions: number;
777
+ maxTokens: number;
778
+ customDimensions: ModelCapability;
779
+ };
780
+
781
+ /**
782
+ * Embedding model matrix: model IDs by capability. To add a model, add a row
783
+ * and fill in every column.
784
+ */
785
+ const embeddingModelDefinitions = {
786
+ 'nomic-ai/nomic-embed-text-v1.5': {
787
+ defaultDimensions: 768,
788
+ maxTokens: 8192,
789
+ customDimensions: 'unknown',
790
+ },
791
+ } satisfies Record<string, FireworksEmbeddingModelRow>;
792
+
793
+ const embeddingProviderOptions = Object.fromEntries(
794
+ Object.keys(fireworksProviderOptions.embedding).map(key => [
795
+ key,
796
+ 'unknown' as const,
797
+ ]),
798
+ );
799
+
800
+ /** Maps a matrix row to its entry. Nothing here inspects the model ID. */
801
+ function createEmbeddingModelEntry(row: FireworksEmbeddingModelRow) {
802
+ const embedding: EmbeddingCapabilities = {
803
+ defaultDimensions: row.defaultDimensions,
804
+ maxTokens: row.maxTokens,
805
+ customDimensions: row.customDimensions,
806
+ };
455
807
  return {
456
- capabilities: {
457
- ...(modelId === 'nomic-ai/nomic-embed-text-v1.5'
458
- ? {
459
- embedding: {
460
- defaultDimensions: 768,
461
- ...{ maxTokens: 8192 },
462
- customDimensions: 'unknown' as const,
463
- },
464
- }
465
- : {}),
466
- },
467
- providerOptions: {
468
- embedding: Object.fromEntries(
469
- Object.keys(fireworksProviderOptions.embedding).map(key => [
470
- key,
471
- 'unknown' as const,
472
- ]),
473
- ),
474
- },
808
+ capabilities: { embedding },
809
+ providerOptions: { embedding: embeddingProviderOptions },
475
810
  } satisfies ModelEntry;
476
811
  }
812
+
813
+ export function getFireworksEmbeddingModelEntry(modelId: string): ModelEntry {
814
+ return Object.prototype.hasOwnProperty.call(
815
+ embeddingModelDefinitions,
816
+ modelId,
817
+ )
818
+ ? createEmbeddingModelEntry(
819
+ embeddingModelDefinitions[
820
+ modelId as keyof typeof embeddingModelDefinitions
821
+ ],
822
+ )
823
+ : // Unlisted model IDs declare no embedding capabilities.
824
+ {
825
+ capabilities: {},
826
+ providerOptions: { embedding: embeddingProviderOptions },
827
+ };
828
+ }
829
+
477
830
  export const fireworksModelCatalog = Object.fromEntries([
478
- ...Object.keys(languageDefinitions).map(
479
- id => [id, getFireworksLanguageModelEntry(id)] as const,
831
+ ...Object.entries(listedLanguageModelEntries),
832
+ ...Object.keys(imageModelDefinitions).map(
833
+ id => [id, getFireworksImageModelEntry(id)] as const,
480
834
  ),
481
- ...imageModelIds.map(id => [id, getFireworksImageModelEntry(id)] as const),
482
- ...embeddingModelIds.map(
835
+ ...Object.keys(embeddingModelDefinitions).map(
483
836
  id => [id, getFireworksEmbeddingModelEntry(id)] as const,
484
837
  ),
485
838
  ]);
486
839
 
487
- Object.assign(
488
- fireworksModelCatalog,
489
- Object.fromEntries(
490
- Object.keys(documentedLanguageCapabilities).map(id => [
491
- id,
492
- getFireworksLanguageModelEntry(id),
493
- ]),
494
- ),
495
- );
496
-
497
840
  export const fireworksStabilityModelCatalog = Object.fromEntries(
498
841
  [
499
842
  'accounts/stability/models/sd3-turbo',
@@ -503,15 +846,15 @@ export const fireworksStabilityModelCatalog = Object.fromEntries(
503
846
  );
504
847
 
505
848
  type FireworksEndpointModelId<Endpoint extends 'chat' | 'completion'> = {
506
- [ModelId in keyof typeof languageDefinitions]: Endpoint extends (typeof languageDefinitions)[ModelId]['endpoints'][number]
849
+ [ModelId in keyof typeof languageModelDefinitions]: Endpoint extends (typeof languageModelDefinitions)[ModelId]['endpoints'][number]
507
850
  ? ModelId
508
851
  : never;
509
- }[keyof typeof languageDefinitions];
852
+ }[keyof typeof languageModelDefinitions];
510
853
 
511
854
  /** Known model IDs, derived from the declarations used to build the catalog. */
512
855
  export type FireworksModelIds = {
513
856
  chat: FireworksEndpointModelId<'chat'>;
514
857
  completion: FireworksEndpointModelId<'completion'>;
515
- embedding: (typeof embeddingModelIds)[number];
516
- image: (typeof imageModelIds)[number];
858
+ embedding: keyof typeof embeddingModelDefinitions;
859
+ image: keyof typeof imageModelDefinitions;
517
860
  };