@ai-sdk/fireworks 2.0.16 → 2.0.18

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @ai-sdk/fireworks
2
2
 
3
+ ## 2.0.18
4
+
5
+ ### Patch Changes
6
+
7
+ - 2b8369d: chore: add docs to package dist
8
+
9
+ ## 2.0.17
10
+
11
+ ### Patch Changes
12
+
13
+ - 8dc54db: chore: add src folders to package bundle
14
+ - Updated dependencies [8dc54db]
15
+ - @ai-sdk/openai-compatible@2.0.17
16
+
3
17
  ## 2.0.16
4
18
 
5
19
  ### Patch Changes
package/dist/index.js CHANGED
@@ -174,7 +174,7 @@ var import_provider_utils2 = require("@ai-sdk/provider-utils");
174
174
  var import_v4 = require("zod/v4");
175
175
 
176
176
  // src/version.ts
177
- var VERSION = true ? "2.0.16" : "0.0.0-test";
177
+ var VERSION = true ? "2.0.18" : "0.0.0-test";
178
178
 
179
179
  // src/fireworks-provider.ts
180
180
  var fireworksErrorSchema = import_v4.z.object({
package/dist/index.mjs CHANGED
@@ -159,7 +159,7 @@ import {
159
159
  import { z } from "zod/v4";
160
160
 
161
161
  // src/version.ts
162
- var VERSION = true ? "2.0.16" : "0.0.0-test";
162
+ var VERSION = true ? "2.0.18" : "0.0.0-test";
163
163
 
164
164
  // src/fireworks-provider.ts
165
165
  var fireworksErrorSchema = z.object({
@@ -0,0 +1,289 @@
1
+ ---
2
+ title: Fireworks
3
+ description: Learn how to use Fireworks models with the AI SDK.
4
+ ---
5
+
6
+ # Fireworks Provider
7
+
8
+ [Fireworks](https://fireworks.ai/) is a platform for running and testing LLMs through their [API](https://readme.fireworks.ai/).
9
+
10
+ ## Setup
11
+
12
+ The Fireworks provider is available via the `@ai-sdk/fireworks` module. You can install it with
13
+
14
+ <Tabs items={['pnpm', 'npm', 'yarn', 'bun']}>
15
+ <Tab>
16
+ <Snippet text="pnpm add @ai-sdk/fireworks" dark />
17
+ </Tab>
18
+ <Tab>
19
+ <Snippet text="npm install @ai-sdk/fireworks" dark />
20
+ </Tab>
21
+ <Tab>
22
+ <Snippet text="yarn add @ai-sdk/fireworks" dark />
23
+ </Tab>
24
+
25
+ <Tab>
26
+ <Snippet text="bun add @ai-sdk/fireworks" dark />
27
+ </Tab>
28
+ </Tabs>
29
+
30
+ ## Provider Instance
31
+
32
+ You can import the default provider instance `fireworks` from `@ai-sdk/fireworks`:
33
+
34
+ ```ts
35
+ import { fireworks } from '@ai-sdk/fireworks';
36
+ ```
37
+
38
+ If you need a customized setup, you can import `createFireworks` from `@ai-sdk/fireworks`
39
+ and create a provider instance with your settings:
40
+
41
+ ```ts
42
+ import { createFireworks } from '@ai-sdk/fireworks';
43
+
44
+ const fireworks = createFireworks({
45
+ apiKey: process.env.FIREWORKS_API_KEY ?? '',
46
+ });
47
+ ```
48
+
49
+ You can use the following optional settings to customize the Fireworks provider instance:
50
+
51
+ - **baseURL** _string_
52
+
53
+ Use a different URL prefix for API calls, e.g. to use proxy servers.
54
+ The default prefix is `https://api.fireworks.ai/inference/v1`.
55
+
56
+ - **apiKey** _string_
57
+
58
+ API key that is being sent using the `Authorization` header. It defaults to
59
+ the `FIREWORKS_API_KEY` environment variable.
60
+
61
+ - **headers** _Record&lt;string,string&gt;_
62
+
63
+ Custom headers to include in the requests.
64
+
65
+ - **fetch** _(input: RequestInfo, init?: RequestInit) => Promise&lt;Response&gt;_
66
+
67
+ Custom [fetch](https://developer.mozilla.org/en-US/docs/Web/API/fetch) implementation.
68
+
69
+ ## Language Models
70
+
71
+ You can create [Fireworks models](https://fireworks.ai/models) using a provider instance.
72
+ The first argument is the model id, e.g. `accounts/fireworks/models/firefunction-v1`:
73
+
74
+ ```ts
75
+ const model = fireworks('accounts/fireworks/models/firefunction-v1');
76
+ ```
77
+
78
+ ### Reasoning Models
79
+
80
+ Fireworks exposes the thinking of `deepseek-r1` in the generated text using the `<think>` tag.
81
+ You can use the `extractReasoningMiddleware` to extract this reasoning and expose it as a `reasoning` property on the result:
82
+
83
+ ```ts
84
+ import { fireworks } from '@ai-sdk/fireworks';
85
+ import { wrapLanguageModel, extractReasoningMiddleware } from 'ai';
86
+
87
+ const enhancedModel = wrapLanguageModel({
88
+ model: fireworks('accounts/fireworks/models/deepseek-r1'),
89
+ middleware: extractReasoningMiddleware({ tagName: 'think' }),
90
+ });
91
+ ```
92
+
93
+ You can then use that enhanced model in functions like `generateText` and `streamText`.
94
+
95
+ ### Example
96
+
97
+ You can use Fireworks language models to generate text with the `generateText` function:
98
+
99
+ ```ts
100
+ import { fireworks } from '@ai-sdk/fireworks';
101
+ import { generateText } from 'ai';
102
+
103
+ const { text } = await generateText({
104
+ model: fireworks('accounts/fireworks/models/firefunction-v1'),
105
+ prompt: 'Write a vegetarian lasagna recipe for 4 people.',
106
+ });
107
+ ```
108
+
109
+ Fireworks language models can also be used in the `streamText` function
110
+ (see [AI SDK Core](/docs/ai-sdk-core)).
111
+
112
+ ### Completion Models
113
+
114
+ You can create models that call the Fireworks completions API using the `.completion()` factory method:
115
+
116
+ ```ts
117
+ const model = fireworks.completion('accounts/fireworks/models/firefunction-v1');
118
+ ```
119
+
120
+ ### Model Capabilities
121
+
122
+ | Model | Image Input | Object Generation | Tool Usage | Tool Streaming |
123
+ | ---------------------------------------------------------- | ------------------- | ------------------- | ------------------- | ------------------- |
124
+ | `accounts/fireworks/models/firefunction-v1` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
125
+ | `accounts/fireworks/models/deepseek-r1` | <Cross size={18} /> | <Check size={18} /> | <Cross size={18} /> | <Cross size={18} /> |
126
+ | `accounts/fireworks/models/deepseek-v3` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
127
+ | `accounts/fireworks/models/llama-v3p1-405b-instruct` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
128
+ | `accounts/fireworks/models/llama-v3p1-8b-instruct` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
129
+ | `accounts/fireworks/models/llama-v3p2-3b-instruct` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
130
+ | `accounts/fireworks/models/llama-v3p3-70b-instruct` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
131
+ | `accounts/fireworks/models/mixtral-8x7b-instruct` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
132
+ | `accounts/fireworks/models/mixtral-8x7b-instruct-hf` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
133
+ | `accounts/fireworks/models/mixtral-8x22b-instruct` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
134
+ | `accounts/fireworks/models/qwen2p5-coder-32b-instruct` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
135
+ | `accounts/fireworks/models/qwen2p5-72b-instruct` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
136
+ | `accounts/fireworks/models/qwen-qwq-32b-preview` | <Cross size={18} /> | <Check size={18} /> | <Cross size={18} /> | <Cross size={18} /> |
137
+ | `accounts/fireworks/models/qwen2-vl-72b-instruct` | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> | <Cross size={18} /> |
138
+ | `accounts/fireworks/models/llama-v3p2-11b-vision-instruct` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
139
+ | `accounts/fireworks/models/qwq-32b` | <Cross size={18} /> | <Check size={18} /> | <Cross size={18} /> | <Cross size={18} /> |
140
+ | `accounts/fireworks/models/yi-large` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
141
+ | `accounts/fireworks/models/kimi-k2-instruct` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
142
+
143
+ <Note>
144
+ The table above lists popular models. Please see the [Fireworks models
145
+ page](https://fireworks.ai/models) for a full list of available models.
146
+ </Note>
147
+
148
+ ## Embedding Models
149
+
150
+ You can create models that call the Fireworks embeddings API using the `.embedding()` factory method:
151
+
152
+ ```ts
153
+ const model = fireworks.embedding('nomic-ai/nomic-embed-text-v1.5');
154
+ ```
155
+
156
+ You can use Fireworks embedding models to generate embeddings with the `embed` function:
157
+
158
+ ```ts
159
+ import { fireworks } from '@ai-sdk/fireworks';
160
+ import { embed } from 'ai';
161
+
162
+ const { embedding } = await embed({
163
+ model: fireworks.embedding('nomic-ai/nomic-embed-text-v1.5'),
164
+ value: 'sunny day at the beach',
165
+ });
166
+ ```
167
+
168
+ ### Model Capabilities
169
+
170
+ | Model | Dimensions | Max Tokens |
171
+ | -------------------------------- | ---------- | ---------- |
172
+ | `nomic-ai/nomic-embed-text-v1.5` | 768 | 8192 |
173
+
174
+ <Note>
175
+ For more embedding models, see the [Fireworks models
176
+ page](https://fireworks.ai/models) for a full list of available models.
177
+ </Note>
178
+
179
+ ## Image Models
180
+
181
+ You can create Fireworks image models using the `.image()` factory method.
182
+ For more on image generation with the AI SDK see [generateImage()](/docs/reference/ai-sdk-core/generate-image).
183
+
184
+ ```ts
185
+ import { fireworks } from '@ai-sdk/fireworks';
186
+ import { generateImage } from 'ai';
187
+
188
+ const { image } = await generateImage({
189
+ model: fireworks.image('accounts/fireworks/models/flux-1-dev-fp8'),
190
+ prompt: 'A futuristic cityscape at sunset',
191
+ aspectRatio: '16:9',
192
+ });
193
+ ```
194
+
195
+ <Note>
196
+ Model support for `size` and `aspectRatio` parameters varies. See the [Model
197
+ Capabilities](#model-capabilities-1) section below for supported dimensions,
198
+ or check the model's documentation on [Fireworks models
199
+ page](https://fireworks.ai/models) for more details.
200
+ </Note>
201
+
202
+ ### Image Editing
203
+
204
+ Fireworks supports image editing through FLUX Kontext models (`flux-kontext-pro` and `flux-kontext-max`). Pass input images via `prompt.images` to transform or edit existing images.
205
+
206
+ <Note>
207
+ Fireworks Kontext models do not support explicit masks. Editing is
208
+ prompt-driven — describe what you want to change in the text prompt.
209
+ </Note>
210
+
211
+ #### Basic Image Editing
212
+
213
+ Transform an existing image using text prompts:
214
+
215
+ ```ts
216
+ const imageBuffer = readFileSync('./input-image.png');
217
+
218
+ const { images } = await generateImage({
219
+ model: fireworks.image('accounts/fireworks/models/flux-kontext-pro'),
220
+ prompt: {
221
+ text: 'Turn the cat into a golden retriever dog',
222
+ images: [imageBuffer],
223
+ },
224
+ providerOptions: {
225
+ fireworks: {
226
+ output_format: 'jpeg',
227
+ },
228
+ },
229
+ });
230
+ ```
231
+
232
+ #### Style Transfer
233
+
234
+ Apply artistic styles to an image:
235
+
236
+ ```ts
237
+ const imageBuffer = readFileSync('./input-image.png');
238
+
239
+ const { images } = await generateImage({
240
+ model: fireworks.image('accounts/fireworks/models/flux-kontext-pro'),
241
+ prompt: {
242
+ text: 'Transform this into a watercolor painting style',
243
+ images: [imageBuffer],
244
+ },
245
+ aspectRatio: '1:1',
246
+ });
247
+ ```
248
+
249
+ <Note>
250
+ Input images can be provided as `Buffer`, `ArrayBuffer`, `Uint8Array`, or
251
+ base64-encoded strings. Fireworks only supports a single input image per
252
+ request.
253
+ </Note>
254
+
255
+ ### Model Capabilities
256
+
257
+ For all models supporting aspect ratios, the following aspect ratios are supported:
258
+
259
+ `1:1 (default), 2:3, 3:2, 4:5, 5:4, 16:9, 9:16, 9:21, 21:9`
260
+
261
+ For all models supporting size, the following sizes are supported:
262
+
263
+ `640 x 1536, 768 x 1344, 832 x 1216, 896 x 1152, 1024x1024 (default), 1152 x 896, 1216 x 832, 1344 x 768, 1536 x 640`
264
+
265
+ | Model | Dimensions Specification | Image Editing |
266
+ | ------------------------------------------------------------ | ------------------------ | ------------------- |
267
+ | `accounts/fireworks/models/flux-kontext-pro` | Aspect Ratio | <Check size={18} /> |
268
+ | `accounts/fireworks/models/flux-kontext-max` | Aspect Ratio | <Check size={18} /> |
269
+ | `accounts/fireworks/models/flux-1-dev-fp8` | Aspect Ratio | <Cross size={18} /> |
270
+ | `accounts/fireworks/models/flux-1-schnell-fp8` | Aspect Ratio | <Cross size={18} /> |
271
+ | `accounts/fireworks/models/playground-v2-5-1024px-aesthetic` | Size | <Cross size={18} /> |
272
+ | `accounts/fireworks/models/japanese-stable-diffusion-xl` | Size | <Cross size={18} /> |
273
+ | `accounts/fireworks/models/playground-v2-1024px-aesthetic` | Size | <Cross size={18} /> |
274
+ | `accounts/fireworks/models/SSD-1B` | Size | <Cross size={18} /> |
275
+ | `accounts/fireworks/models/stable-diffusion-xl-1024-v1-0` | Size | <Cross size={18} /> |
276
+
277
+ For more details, see the [Fireworks models page](https://fireworks.ai/models).
278
+
279
+ #### Stability AI Models
280
+
281
+ Fireworks also presents several Stability AI models backed by Stability AI API
282
+ keys and endpoint. The AI SDK Fireworks provider does not currently include
283
+ support for these models:
284
+
285
+ | Model ID |
286
+ | -------------------------------------- |
287
+ | `accounts/stability/models/sd3-turbo` |
288
+ | `accounts/stability/models/sd3-medium` |
289
+ | `accounts/stability/models/sd3` |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/fireworks",
3
- "version": "2.0.16",
3
+ "version": "2.0.18",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -8,9 +8,14 @@
8
8
  "types": "./dist/index.d.ts",
9
9
  "files": [
10
10
  "dist/**/*",
11
+ "docs/**/*",
12
+ "src",
11
13
  "CHANGELOG.md",
12
14
  "README.md"
13
15
  ],
16
+ "directories": {
17
+ "doc": "./docs"
18
+ },
14
19
  "exports": {
15
20
  "./package.json": "./package.json",
16
21
  ".": {
@@ -20,7 +25,7 @@
20
25
  }
21
26
  },
22
27
  "dependencies": {
23
- "@ai-sdk/openai-compatible": "2.0.16",
28
+ "@ai-sdk/openai-compatible": "2.0.17",
24
29
  "@ai-sdk/provider": "3.0.4",
25
30
  "@ai-sdk/provider-utils": "4.0.8"
26
31
  },
@@ -29,7 +34,7 @@
29
34
  "tsup": "^8",
30
35
  "typescript": "5.8.3",
31
36
  "zod": "3.25.76",
32
- "@ai-sdk/test-server": "1.0.1",
37
+ "@ai-sdk/test-server": "1.0.2",
33
38
  "@vercel/ai-tsconfig": "0.0.0"
34
39
  },
35
40
  "peerDependencies": {
@@ -55,7 +60,7 @@
55
60
  "scripts": {
56
61
  "build": "pnpm clean && tsup --tsconfig tsconfig.build.json",
57
62
  "build:watch": "pnpm clean && tsup --watch",
58
- "clean": "del-cli dist *.tsbuildinfo",
63
+ "clean": "del-cli dist docs *.tsbuildinfo",
59
64
  "lint": "eslint \"./**/*.ts*\"",
60
65
  "type-check": "tsc --build",
61
66
  "prettier-check": "prettier --check \"./**/*.ts*\"",
@@ -0,0 +1,20 @@
1
+ // https://docs.fireworks.ai/docs/serverless-models#chat-models
2
+ // Below is just a subset of the available models.
3
+ export type FireworksChatModelId =
4
+ | 'accounts/fireworks/models/deepseek-v3'
5
+ | 'accounts/fireworks/models/llama-v3p3-70b-instruct'
6
+ | 'accounts/fireworks/models/llama-v3p2-3b-instruct'
7
+ | 'accounts/fireworks/models/llama-v3p1-405b-instruct'
8
+ | 'accounts/fireworks/models/llama-v3p1-8b-instruct'
9
+ | 'accounts/fireworks/models/mixtral-8x7b-instruct'
10
+ | 'accounts/fireworks/models/mixtral-8x22b-instruct'
11
+ | 'accounts/fireworks/models/mixtral-8x7b-instruct-hf'
12
+ | 'accounts/fireworks/models/qwen2p5-coder-32b-instruct'
13
+ | 'accounts/fireworks/models/qwen2p5-72b-instruct'
14
+ | 'accounts/fireworks/models/qwen-qwq-32b-preview'
15
+ | 'accounts/fireworks/models/qwen2-vl-72b-instruct'
16
+ | 'accounts/fireworks/models/llama-v3p2-11b-vision-instruct'
17
+ | 'accounts/fireworks/models/qwq-32b'
18
+ | 'accounts/fireworks/models/yi-large'
19
+ | 'accounts/fireworks/models/kimi-k2-instruct'
20
+ | (string & {});
@@ -0,0 +1,5 @@
1
+ // Below is just a subset of the available models.
2
+ export type FireworksCompletionModelId =
3
+ | 'accounts/fireworks/models/llama-v3-8b-instruct'
4
+ | 'accounts/fireworks/models/llama-v2-34b-code'
5
+ | (string & {});
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod/v4';
2
+
3
+ // Below is just a subset of the available models.
4
+ export type FireworksEmbeddingModelId =
5
+ | 'nomic-ai/nomic-embed-text-v1.5'
6
+ | (string & {});
7
+
8
+ export const fireworksEmbeddingProviderOptions = z.object({});
9
+
10
+ export type FireworksEmbeddingProviderOptions = z.infer<
11
+ typeof fireworksEmbeddingProviderOptions
12
+ >;