@ai-sdk/replicate 3.0.0-beta.4 → 3.0.0-beta.51

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,396 @@
1
1
  # @ai-sdk/replicate
2
2
 
3
+ ## 3.0.0-beta.51
4
+
5
+ ### Patch Changes
6
+
7
+ - b8396f0: trigger initial beta release
8
+ - Updated dependencies [b8396f0]
9
+ - @ai-sdk/provider-utils@5.0.0-beta.49
10
+ - @ai-sdk/provider@4.0.0-beta.19
11
+
12
+ ## 3.0.0-canary.50
13
+
14
+ ### Patch Changes
15
+
16
+ - aeda373: fix: only send provider credentials to same-origin response-supplied URLs
17
+
18
+ Several provider clients followed a URL taken from the provider's API response (a polling/status URL or a final media URL such as `polling_url`, `urls.get`, `result_url`, `result.sample`, or `video.uri`) and reused the authenticated headers — or appended `?key=<API_KEY>` — on that request. Because the host of the response-supplied URL was never validated, the long-lived API key was sent to whatever host the response named (a CDN in the benign case, or an attacker-chosen host if the provider response was tampered with), allowing credential exfiltration.
19
+
20
+ A new `isSameOrigin` helper is added to `@ai-sdk/provider-utils`, and the affected fetches in `@ai-sdk/black-forest-labs`, `@ai-sdk/fireworks`, `@ai-sdk/replicate`, `@ai-sdk/gladia`, `@ai-sdk/fal`, and `@ai-sdk/google` now attach credentials only when the followed URL is same-origin with the provider's configured API origin. Requests to a foreign origin are made without the credential.
21
+
22
+ - Updated dependencies [aeda373]
23
+ - Updated dependencies [375fdd7]
24
+ - Updated dependencies [b4507d5]
25
+ - @ai-sdk/provider-utils@5.0.0-canary.48
26
+
27
+ ## 3.0.0-canary.49
28
+
29
+ ### Patch Changes
30
+
31
+ - Updated dependencies [bae5e2b]
32
+ - @ai-sdk/provider-utils@5.0.0-canary.47
33
+
34
+ ## 3.0.0-canary.48
35
+
36
+ ### Patch Changes
37
+
38
+ - Updated dependencies [ce769dd]
39
+ - @ai-sdk/provider@4.0.0-canary.18
40
+ - @ai-sdk/provider-utils@5.0.0-canary.46
41
+
42
+ ## 3.0.0-canary.47
43
+
44
+ ### Patch Changes
45
+
46
+ - Updated dependencies [ee798eb]
47
+ - Updated dependencies [daf6637]
48
+ - @ai-sdk/provider-utils@5.0.0-canary.45
49
+
50
+ ## 3.0.0-canary.46
51
+
52
+ ### Patch Changes
53
+
54
+ - Updated dependencies [6c93e36]
55
+ - Updated dependencies [f617ac2]
56
+ - @ai-sdk/provider-utils@5.0.0-canary.44
57
+
58
+ ## 3.0.0-canary.45
59
+
60
+ ### Patch Changes
61
+
62
+ - 7fc6bd6: Raise minimum supported Node.js version to 22. Supported versions: 22, 24, and 26.
63
+ - Updated dependencies [7fc6bd6]
64
+ - @ai-sdk/provider-utils@5.0.0-canary.43
65
+ - @ai-sdk/provider@4.0.0-canary.17
66
+
67
+ ## 3.0.0-canary.44
68
+
69
+ ### Patch Changes
70
+
71
+ - Updated dependencies [a6617c5]
72
+ - @ai-sdk/provider-utils@5.0.0-canary.42
73
+
74
+ ## 3.0.0-canary.43
75
+
76
+ ### Patch Changes
77
+
78
+ - Updated dependencies [28dfa06]
79
+ - Updated dependencies [e93fa91]
80
+ - @ai-sdk/provider-utils@5.0.0-canary.41
81
+
82
+ ## 3.0.0-canary.42
83
+
84
+ ### Patch Changes
85
+
86
+ - Updated dependencies [a7de9c9]
87
+ - @ai-sdk/provider-utils@5.0.0-canary.40
88
+
89
+ ## 3.0.0-canary.41
90
+
91
+ ### Patch Changes
92
+
93
+ - Updated dependencies [105f95b]
94
+ - @ai-sdk/provider-utils@5.0.0-canary.39
95
+
96
+ ## 3.0.0-canary.40
97
+
98
+ ### Patch Changes
99
+
100
+ - Updated dependencies [ca446f8]
101
+ - @ai-sdk/provider-utils@5.0.0-canary.38
102
+
103
+ ## 3.0.0-canary.39
104
+
105
+ ### Patch Changes
106
+
107
+ - Updated dependencies [d848405]
108
+ - @ai-sdk/provider-utils@5.0.0-canary.37
109
+
110
+ ## 3.0.0-canary.38
111
+
112
+ ### Patch Changes
113
+
114
+ - Updated dependencies [ca39020]
115
+ - @ai-sdk/provider-utils@5.0.0-canary.36
116
+
117
+ ## 3.0.0-canary.37
118
+
119
+ ### Patch Changes
120
+
121
+ - Updated dependencies [f634bac]
122
+ - @ai-sdk/provider-utils@5.0.0-canary.35
123
+
124
+ ## 3.0.0-canary.36
125
+
126
+ ### Patch Changes
127
+
128
+ - Updated dependencies [69254e0]
129
+ - Updated dependencies [3015fc3]
130
+ - @ai-sdk/provider-utils@5.0.0-canary.34
131
+
132
+ ## 3.0.0-canary.35
133
+
134
+ ### Patch Changes
135
+
136
+ - Updated dependencies [2427d88]
137
+ - @ai-sdk/provider-utils@5.0.0-canary.33
138
+
139
+ ## 3.0.0-canary.34
140
+
141
+ ### Patch Changes
142
+
143
+ - Updated dependencies [5463d0d]
144
+ - @ai-sdk/provider-utils@5.0.0-canary.32
145
+ - @ai-sdk/provider@4.0.0-canary.16
146
+
147
+ ## 3.0.0-canary.33
148
+
149
+ ### Patch Changes
150
+
151
+ - 0c4c275: trigger initial canary release
152
+ - Updated dependencies [0c4c275]
153
+ - @ai-sdk/provider-utils@5.0.0-canary.31
154
+ - @ai-sdk/provider@4.0.0-canary.15
155
+
156
+ ## 3.0.0-beta.32
157
+
158
+ ### Major Changes
159
+
160
+ - 04e9009: chore: make provider implementations code patterns more consistent, including renaming certain exported symbols
161
+
162
+ For all externally exported symbols that were renamed, the old names continue to work via deprecated aliases.
163
+
164
+ ### Patch Changes
165
+
166
+ - Updated dependencies [08d2129]
167
+ - @ai-sdk/provider-utils@5.0.0-beta.30
168
+
169
+ ## 3.0.0-beta.31
170
+
171
+ ### Patch Changes
172
+
173
+ - 258c093: chore: ensure consistent import handling and avoid import duplicates or cycles
174
+ - Updated dependencies [9bd6512]
175
+ - Updated dependencies [258c093]
176
+ - Updated dependencies [b6783da]
177
+ - @ai-sdk/provider-utils@5.0.0-beta.29
178
+ - @ai-sdk/provider@4.0.0-beta.14
179
+
180
+ ## 3.0.0-beta.30
181
+
182
+ ### Patch Changes
183
+
184
+ - 9f0e36c: trigger release for all packages after provenance setup
185
+ - Updated dependencies [9f0e36c]
186
+ - @ai-sdk/provider@4.0.0-beta.13
187
+ - @ai-sdk/provider-utils@5.0.0-beta.28
188
+
189
+ ## 3.0.0-beta.29
190
+
191
+ ### Patch Changes
192
+
193
+ - Updated dependencies [785fe16]
194
+ - Updated dependencies [67df0a0]
195
+ - Updated dependencies [befb78c]
196
+ - Updated dependencies [0458559]
197
+ - Updated dependencies [5852c0a]
198
+ - Updated dependencies [fc92055]
199
+ - @ai-sdk/provider-utils@5.0.0-beta.27
200
+
201
+ ## 3.0.0-beta.28
202
+
203
+ ### Patch Changes
204
+
205
+ - Updated dependencies [2e98477]
206
+ - @ai-sdk/provider-utils@5.0.0-beta.26
207
+
208
+ ## 3.0.0-beta.27
209
+
210
+ ### Patch Changes
211
+
212
+ - Updated dependencies [eea8d98]
213
+ - @ai-sdk/provider-utils@5.0.0-beta.25
214
+
215
+ ## 3.0.0-beta.26
216
+
217
+ ### Patch Changes
218
+
219
+ - Updated dependencies [f807e45]
220
+ - @ai-sdk/provider-utils@5.0.0-beta.24
221
+
222
+ ## 3.0.0-beta.25
223
+
224
+ ### Patch Changes
225
+
226
+ - Updated dependencies [350ea38]
227
+ - @ai-sdk/provider-utils@5.0.0-beta.23
228
+
229
+ ## 3.0.0-beta.24
230
+
231
+ ### Patch Changes
232
+
233
+ - Updated dependencies [083947b]
234
+ - @ai-sdk/provider-utils@5.0.0-beta.22
235
+
236
+ ## 3.0.0-beta.23
237
+
238
+ ### Patch Changes
239
+
240
+ - Updated dependencies [add1126]
241
+ - @ai-sdk/provider-utils@5.0.0-beta.21
242
+
243
+ ## 3.0.0-beta.22
244
+
245
+ ### Patch Changes
246
+
247
+ - b3976a2: Add workflow serialization support to all provider models.
248
+
249
+ **`@ai-sdk/provider-utils`:** New `serializeModel()` helper that extracts only serializable properties from a model instance, filtering out functions and objects containing functions. Third-party provider authors can use this to add workflow support to their own models.
250
+
251
+ **All providers:** `headers` is now optional in provider config types. This is non-breaking — existing code that passes `headers` continues to work. Custom provider implementations that construct model configs manually can now omit `headers`, which is useful when models are deserialized from a workflow step boundary where auth is provided separately.
252
+
253
+ All provider model classes now include `WORKFLOW_SERIALIZE` and `WORKFLOW_DESERIALIZE` static methods, enabling them to cross workflow step boundaries without serialization errors.
254
+
255
+ - Updated dependencies [b3976a2]
256
+ - Updated dependencies [ff5eba1]
257
+ - @ai-sdk/provider-utils@5.0.0-beta.20
258
+ - @ai-sdk/provider@4.0.0-beta.12
259
+
260
+ ## 3.0.0-beta.21
261
+
262
+ ### Major Changes
263
+
264
+ - ef992f8: Remove CommonJS exports from all packages. All packages are now ESM-only (`"type": "module"`). Consumers using `require()` must switch to ESM `import` syntax.
265
+
266
+ ### Patch Changes
267
+
268
+ - Updated dependencies [ef992f8]
269
+ - @ai-sdk/provider@4.0.0-beta.11
270
+ - @ai-sdk/provider-utils@5.0.0-beta.19
271
+
272
+ ## 3.0.0-beta.20
273
+
274
+ ### Patch Changes
275
+
276
+ - Updated dependencies [90e2d8a]
277
+ - @ai-sdk/provider-utils@5.0.0-beta.18
278
+
279
+ ## 3.0.0-beta.19
280
+
281
+ ### Patch Changes
282
+
283
+ - Updated dependencies [3ae1786]
284
+ - @ai-sdk/provider-utils@5.0.0-beta.17
285
+
286
+ ## 3.0.0-beta.18
287
+
288
+ ### Patch Changes
289
+
290
+ - Updated dependencies [176466a]
291
+ - @ai-sdk/provider@4.0.0-beta.10
292
+ - @ai-sdk/provider-utils@5.0.0-beta.16
293
+
294
+ ## 3.0.0-beta.17
295
+
296
+ ### Patch Changes
297
+
298
+ - Updated dependencies [e311194]
299
+ - @ai-sdk/provider@4.0.0-beta.9
300
+ - @ai-sdk/provider-utils@5.0.0-beta.15
301
+
302
+ ## 3.0.0-beta.16
303
+
304
+ ### Patch Changes
305
+
306
+ - Updated dependencies [34bd95d]
307
+ - Updated dependencies [008271d]
308
+ - @ai-sdk/provider@4.0.0-beta.8
309
+ - @ai-sdk/provider-utils@5.0.0-beta.14
310
+
311
+ ## 3.0.0-beta.15
312
+
313
+ ### Patch Changes
314
+
315
+ - Updated dependencies [b0c2869]
316
+ - Updated dependencies [7e26e81]
317
+ - @ai-sdk/provider-utils@5.0.0-beta.13
318
+
319
+ ## 3.0.0-beta.14
320
+
321
+ ### Patch Changes
322
+
323
+ - Updated dependencies [46d1149]
324
+ - @ai-sdk/provider-utils@5.0.0-beta.12
325
+
326
+ ## 3.0.0-beta.13
327
+
328
+ ### Patch Changes
329
+
330
+ - Updated dependencies [6fd51c0]
331
+ - @ai-sdk/provider-utils@5.0.0-beta.11
332
+ - @ai-sdk/provider@4.0.0-beta.7
333
+
334
+ ## 3.0.0-beta.12
335
+
336
+ ### Patch Changes
337
+
338
+ - Updated dependencies [c29a26f]
339
+ - @ai-sdk/provider-utils@5.0.0-beta.10
340
+ - @ai-sdk/provider@4.0.0-beta.6
341
+
342
+ ## 3.0.0-beta.11
343
+
344
+ ### Patch Changes
345
+
346
+ - 38fc777: Add AI Gateway hint to provider READMEs
347
+
348
+ ## 3.0.0-beta.10
349
+
350
+ ### Patch Changes
351
+
352
+ - Updated dependencies [2e17091]
353
+ - @ai-sdk/provider-utils@5.0.0-beta.9
354
+
355
+ ## 3.0.0-beta.9
356
+
357
+ ### Patch Changes
358
+
359
+ - Updated dependencies [986c6fd]
360
+ - Updated dependencies [493295c]
361
+ - @ai-sdk/provider-utils@5.0.0-beta.8
362
+
363
+ ## 3.0.0-beta.8
364
+
365
+ ### Patch Changes
366
+
367
+ - Updated dependencies [1f509d4]
368
+ - @ai-sdk/provider-utils@5.0.0-beta.7
369
+ - @ai-sdk/provider@4.0.0-beta.5
370
+
371
+ ## 3.0.0-beta.7
372
+
373
+ ### Patch Changes
374
+
375
+ - Updated dependencies [3887c70]
376
+ - @ai-sdk/provider-utils@5.0.0-beta.6
377
+ - @ai-sdk/provider@4.0.0-beta.4
378
+
379
+ ## 3.0.0-beta.6
380
+
381
+ ### Patch Changes
382
+
383
+ - Updated dependencies [776b617]
384
+ - @ai-sdk/provider-utils@5.0.0-beta.5
385
+ - @ai-sdk/provider@4.0.0-beta.3
386
+
387
+ ## 3.0.0-beta.5
388
+
389
+ ### Patch Changes
390
+
391
+ - Updated dependencies [61753c3]
392
+ - @ai-sdk/provider-utils@5.0.0-beta.4
393
+
3
394
  ## 3.0.0-beta.4
4
395
 
5
396
  ### Patch Changes
@@ -234,13 +625,13 @@
234
625
  Before
235
626
 
236
627
  ```ts
237
- model.textEmbeddingModel('my-model-id');
628
+ model.textEmbeddingModel("my-model-id");
238
629
  ```
239
630
 
240
631
  After
241
632
 
242
633
  ```ts
243
- model.embeddingModel('my-model-id');
634
+ model.embeddingModel("my-model-id");
244
635
  ```
245
636
 
246
637
  - 95f65c2: chore: use import \* from zod/v4
@@ -464,13 +855,13 @@
464
855
  Before
465
856
 
466
857
  ```ts
467
- model.textEmbeddingModel('my-model-id');
858
+ model.textEmbeddingModel("my-model-id");
468
859
  ```
469
860
 
470
861
  After
471
862
 
472
863
  ```ts
473
- model.embeddingModel('my-model-id');
864
+ model.embeddingModel("my-model-id");
474
865
  ```
475
866
 
476
867
  - Updated dependencies [8d9e8ad]
@@ -840,7 +1231,7 @@
840
1231
 
841
1232
  ```js
842
1233
  await generateImage({
843
- model: luma.image('photon-flash-1', {
1234
+ model: luma.image("photon-flash-1", {
844
1235
  maxImagesPerCall: 5,
845
1236
  pollIntervalMillis: 500,
846
1237
  }),
@@ -853,7 +1244,7 @@
853
1244
 
854
1245
  ```js
855
1246
  await generateImage({
856
- model: luma.image('photon-flash-1'),
1247
+ model: luma.image("photon-flash-1"),
857
1248
  prompt,
858
1249
  n: 10,
859
1250
  maxImagesPerCall: 5,
@@ -1089,7 +1480,7 @@
1089
1480
 
1090
1481
  ```js
1091
1482
  await generateImage({
1092
- model: luma.image('photon-flash-1', {
1483
+ model: luma.image("photon-flash-1", {
1093
1484
  maxImagesPerCall: 5,
1094
1485
  pollIntervalMillis: 500,
1095
1486
  }),
@@ -1102,7 +1493,7 @@
1102
1493
 
1103
1494
  ```js
1104
1495
  await generateImage({
1105
- model: luma.image('photon-flash-1'),
1496
+ model: luma.image("photon-flash-1"),
1106
1497
  prompt,
1107
1498
  n: 10,
1108
1499
  maxImagesPerCall: 5,
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  The **[Replicate provider](https://ai-sdk.dev/providers/ai-sdk-providers/replicate)** for the [AI SDK](https://ai-sdk.dev/docs) contains image model support for the Replicate API.
4
4
 
5
+ > **Deploying to Vercel?** With Vercel's AI Gateway you can access Replicate (and hundreds of models from other providers) — no additional packages, API keys, or extra cost. [Get started with AI Gateway](https://vercel.com/ai-gateway).
6
+
5
7
  ## Setup
6
8
 
7
9
  The Replicate provider is available in the `@ai-sdk/replicate` module. You can install it with
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
+ import * as _ai_sdk_provider from '@ai-sdk/provider';
1
2
  import { ImageModelV4, ProviderV4, Experimental_VideoModelV4 } from '@ai-sdk/provider';
2
3
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
- import { Resolvable, FetchFunction, InferSchema } from '@ai-sdk/provider-utils';
4
+ import { WORKFLOW_SERIALIZE, WORKFLOW_DESERIALIZE, Resolvable, FetchFunction, InferSchema } from '@ai-sdk/provider-utils';
4
5
 
5
6
  type ReplicateImageModelId = 'black-forest-labs/flux-1.1-pro' | 'black-forest-labs/flux-1.1-pro-ultra' | 'black-forest-labs/flux-dev' | 'black-forest-labs/flux-pro' | 'black-forest-labs/flux-schnell' | 'bytedance/sdxl-lightning-4step' | 'fofr/aura-flow' | 'fofr/latent-consistency-model' | 'fofr/realvisxl-v3-multi-controlnet-lora' | 'fofr/sdxl-emoji' | 'fofr/sdxl-multi-controlnet-lora' | 'ideogram-ai/ideogram-v2' | 'ideogram-ai/ideogram-v2-turbo' | 'lucataco/dreamshaper-xl-turbo' | 'lucataco/open-dalle-v1.1' | 'lucataco/realvisxl-v2.0' | 'lucataco/realvisxl2-lcm' | 'luma/photon' | 'luma/photon-flash' | 'nvidia/sana' | 'playgroundai/playground-v2.5-1024px-aesthetic' | 'recraft-ai/recraft-v3' | 'recraft-ai/recraft-v3-svg' | 'stability-ai/stable-diffusion-3.5-large' | 'stability-ai/stable-diffusion-3.5-large-turbo' | 'stability-ai/stable-diffusion-3.5-medium' | 'tstramer/material-diffusion' | 'black-forest-labs/flux-fill-pro' | 'black-forest-labs/flux-fill-dev' | 'black-forest-labs/flux-2-pro' | 'black-forest-labs/flux-2-dev' | (string & {});
6
7
 
@@ -20,27 +21,17 @@ declare class ReplicateImageModel implements ImageModelV4 {
20
21
  get maxImagesPerCall(): number;
21
22
  get provider(): string;
22
23
  private get isFlux2Model();
24
+ static [WORKFLOW_SERIALIZE](model: ReplicateImageModel): {
25
+ modelId: string;
26
+ config: _ai_sdk_provider.JSONObject;
27
+ };
28
+ static [WORKFLOW_DESERIALIZE](options: {
29
+ modelId: ReplicateImageModelId;
30
+ config: ReplicateImageModelConfig;
31
+ }): ReplicateImageModel;
23
32
  constructor(modelId: ReplicateImageModelId, config: ReplicateImageModelConfig);
24
33
  doGenerate({ prompt, n, aspectRatio, size, seed, providerOptions, headers, abortSignal, files, mask, }: Parameters<ImageModelV4['doGenerate']>[0]): Promise<Awaited<ReturnType<ImageModelV4['doGenerate']>>>;
25
34
  }
26
- /**
27
- * Provider options schema for Replicate image generation.
28
- *
29
- * Note: Different Replicate models support different parameters.
30
- * This schema includes common parameters, but you can pass any
31
- * model-specific parameters through the passthrough.
32
- */
33
- declare const replicateImageModelOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
34
- [x: string]: unknown;
35
- maxWaitTimeInSeconds?: number | null | undefined;
36
- guidance_scale?: number | null | undefined;
37
- num_inference_steps?: number | null | undefined;
38
- negative_prompt?: string | null | undefined;
39
- output_format?: "png" | "jpg" | "webp" | null | undefined;
40
- output_quality?: number | null | undefined;
41
- strength?: number | null | undefined;
42
- }>;
43
- type ReplicateImageModelOptions = InferSchema<typeof replicateImageModelOptionsSchema>;
44
35
 
45
36
  type ReplicateVideoModelId = 'minimax/video-01' | 'minimax/video-01:6c1e4171-288a-4ca2-a738-894f0e87699d' | 'stability-ai/stable-video-diffusion:3f0457e4619daac51203dedb472816fd4af51f3149fa7a9e0b5ffcf1b8172438' | (string & {});
46
37
 
@@ -96,6 +87,25 @@ declare function createReplicate(options?: ReplicateProviderSettings): Replicate
96
87
  */
97
88
  declare const replicate: ReplicateProvider;
98
89
 
90
+ /**
91
+ * Provider options schema for Replicate image generation.
92
+ *
93
+ * Note: Different Replicate models support different parameters.
94
+ * This schema includes common parameters, but you can pass any
95
+ * model-specific parameters through the passthrough.
96
+ */
97
+ declare const replicateImageModelOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
98
+ [x: string]: unknown;
99
+ maxWaitTimeInSeconds?: number | null | undefined;
100
+ guidance_scale?: number | null | undefined;
101
+ num_inference_steps?: number | null | undefined;
102
+ negative_prompt?: string | null | undefined;
103
+ output_format?: "png" | "jpg" | "webp" | null | undefined;
104
+ output_quality?: number | null | undefined;
105
+ strength?: number | null | undefined;
106
+ }>;
107
+ type ReplicateImageModelOptions = InferSchema<typeof replicateImageModelOptionsSchema>;
108
+
99
109
  type ReplicateVideoModelOptions = {
100
110
  pollIntervalMs?: number | null;
101
111
  pollTimeoutMs?: number | null;