@ai-sdk/replicate 3.0.0-beta.5 → 3.0.0-beta.52

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,397 @@
1
1
  # @ai-sdk/replicate
2
2
 
3
+ ## 3.0.0-beta.52
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [0416e3e]
8
+ - @ai-sdk/provider@4.0.0-beta.20
9
+ - @ai-sdk/provider-utils@5.0.0-beta.50
10
+
11
+ ## 3.0.0-beta.51
12
+
13
+ ### Patch Changes
14
+
15
+ - b8396f0: trigger initial beta release
16
+ - Updated dependencies [b8396f0]
17
+ - @ai-sdk/provider-utils@5.0.0-beta.49
18
+ - @ai-sdk/provider@4.0.0-beta.19
19
+
20
+ ## 3.0.0-canary.50
21
+
22
+ ### Patch Changes
23
+
24
+ - aeda373: fix: only send provider credentials to same-origin response-supplied URLs
25
+
26
+ 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.
27
+
28
+ 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.
29
+
30
+ - Updated dependencies [aeda373]
31
+ - Updated dependencies [375fdd7]
32
+ - Updated dependencies [b4507d5]
33
+ - @ai-sdk/provider-utils@5.0.0-canary.48
34
+
35
+ ## 3.0.0-canary.49
36
+
37
+ ### Patch Changes
38
+
39
+ - Updated dependencies [bae5e2b]
40
+ - @ai-sdk/provider-utils@5.0.0-canary.47
41
+
42
+ ## 3.0.0-canary.48
43
+
44
+ ### Patch Changes
45
+
46
+ - Updated dependencies [ce769dd]
47
+ - @ai-sdk/provider@4.0.0-canary.18
48
+ - @ai-sdk/provider-utils@5.0.0-canary.46
49
+
50
+ ## 3.0.0-canary.47
51
+
52
+ ### Patch Changes
53
+
54
+ - Updated dependencies [ee798eb]
55
+ - Updated dependencies [daf6637]
56
+ - @ai-sdk/provider-utils@5.0.0-canary.45
57
+
58
+ ## 3.0.0-canary.46
59
+
60
+ ### Patch Changes
61
+
62
+ - Updated dependencies [6c93e36]
63
+ - Updated dependencies [f617ac2]
64
+ - @ai-sdk/provider-utils@5.0.0-canary.44
65
+
66
+ ## 3.0.0-canary.45
67
+
68
+ ### Patch Changes
69
+
70
+ - 7fc6bd6: Raise minimum supported Node.js version to 22. Supported versions: 22, 24, and 26.
71
+ - Updated dependencies [7fc6bd6]
72
+ - @ai-sdk/provider-utils@5.0.0-canary.43
73
+ - @ai-sdk/provider@4.0.0-canary.17
74
+
75
+ ## 3.0.0-canary.44
76
+
77
+ ### Patch Changes
78
+
79
+ - Updated dependencies [a6617c5]
80
+ - @ai-sdk/provider-utils@5.0.0-canary.42
81
+
82
+ ## 3.0.0-canary.43
83
+
84
+ ### Patch Changes
85
+
86
+ - Updated dependencies [28dfa06]
87
+ - Updated dependencies [e93fa91]
88
+ - @ai-sdk/provider-utils@5.0.0-canary.41
89
+
90
+ ## 3.0.0-canary.42
91
+
92
+ ### Patch Changes
93
+
94
+ - Updated dependencies [a7de9c9]
95
+ - @ai-sdk/provider-utils@5.0.0-canary.40
96
+
97
+ ## 3.0.0-canary.41
98
+
99
+ ### Patch Changes
100
+
101
+ - Updated dependencies [105f95b]
102
+ - @ai-sdk/provider-utils@5.0.0-canary.39
103
+
104
+ ## 3.0.0-canary.40
105
+
106
+ ### Patch Changes
107
+
108
+ - Updated dependencies [ca446f8]
109
+ - @ai-sdk/provider-utils@5.0.0-canary.38
110
+
111
+ ## 3.0.0-canary.39
112
+
113
+ ### Patch Changes
114
+
115
+ - Updated dependencies [d848405]
116
+ - @ai-sdk/provider-utils@5.0.0-canary.37
117
+
118
+ ## 3.0.0-canary.38
119
+
120
+ ### Patch Changes
121
+
122
+ - Updated dependencies [ca39020]
123
+ - @ai-sdk/provider-utils@5.0.0-canary.36
124
+
125
+ ## 3.0.0-canary.37
126
+
127
+ ### Patch Changes
128
+
129
+ - Updated dependencies [f634bac]
130
+ - @ai-sdk/provider-utils@5.0.0-canary.35
131
+
132
+ ## 3.0.0-canary.36
133
+
134
+ ### Patch Changes
135
+
136
+ - Updated dependencies [69254e0]
137
+ - Updated dependencies [3015fc3]
138
+ - @ai-sdk/provider-utils@5.0.0-canary.34
139
+
140
+ ## 3.0.0-canary.35
141
+
142
+ ### Patch Changes
143
+
144
+ - Updated dependencies [2427d88]
145
+ - @ai-sdk/provider-utils@5.0.0-canary.33
146
+
147
+ ## 3.0.0-canary.34
148
+
149
+ ### Patch Changes
150
+
151
+ - Updated dependencies [5463d0d]
152
+ - @ai-sdk/provider-utils@5.0.0-canary.32
153
+ - @ai-sdk/provider@4.0.0-canary.16
154
+
155
+ ## 3.0.0-canary.33
156
+
157
+ ### Patch Changes
158
+
159
+ - 0c4c275: trigger initial canary release
160
+ - Updated dependencies [0c4c275]
161
+ - @ai-sdk/provider-utils@5.0.0-canary.31
162
+ - @ai-sdk/provider@4.0.0-canary.15
163
+
164
+ ## 3.0.0-beta.32
165
+
166
+ ### Major Changes
167
+
168
+ - 04e9009: chore: make provider implementations code patterns more consistent, including renaming certain exported symbols
169
+
170
+ For all externally exported symbols that were renamed, the old names continue to work via deprecated aliases.
171
+
172
+ ### Patch Changes
173
+
174
+ - Updated dependencies [08d2129]
175
+ - @ai-sdk/provider-utils@5.0.0-beta.30
176
+
177
+ ## 3.0.0-beta.31
178
+
179
+ ### Patch Changes
180
+
181
+ - 258c093: chore: ensure consistent import handling and avoid import duplicates or cycles
182
+ - Updated dependencies [9bd6512]
183
+ - Updated dependencies [258c093]
184
+ - Updated dependencies [b6783da]
185
+ - @ai-sdk/provider-utils@5.0.0-beta.29
186
+ - @ai-sdk/provider@4.0.0-beta.14
187
+
188
+ ## 3.0.0-beta.30
189
+
190
+ ### Patch Changes
191
+
192
+ - 9f0e36c: trigger release for all packages after provenance setup
193
+ - Updated dependencies [9f0e36c]
194
+ - @ai-sdk/provider@4.0.0-beta.13
195
+ - @ai-sdk/provider-utils@5.0.0-beta.28
196
+
197
+ ## 3.0.0-beta.29
198
+
199
+ ### Patch Changes
200
+
201
+ - Updated dependencies [785fe16]
202
+ - Updated dependencies [67df0a0]
203
+ - Updated dependencies [befb78c]
204
+ - Updated dependencies [0458559]
205
+ - Updated dependencies [5852c0a]
206
+ - Updated dependencies [fc92055]
207
+ - @ai-sdk/provider-utils@5.0.0-beta.27
208
+
209
+ ## 3.0.0-beta.28
210
+
211
+ ### Patch Changes
212
+
213
+ - Updated dependencies [2e98477]
214
+ - @ai-sdk/provider-utils@5.0.0-beta.26
215
+
216
+ ## 3.0.0-beta.27
217
+
218
+ ### Patch Changes
219
+
220
+ - Updated dependencies [eea8d98]
221
+ - @ai-sdk/provider-utils@5.0.0-beta.25
222
+
223
+ ## 3.0.0-beta.26
224
+
225
+ ### Patch Changes
226
+
227
+ - Updated dependencies [f807e45]
228
+ - @ai-sdk/provider-utils@5.0.0-beta.24
229
+
230
+ ## 3.0.0-beta.25
231
+
232
+ ### Patch Changes
233
+
234
+ - Updated dependencies [350ea38]
235
+ - @ai-sdk/provider-utils@5.0.0-beta.23
236
+
237
+ ## 3.0.0-beta.24
238
+
239
+ ### Patch Changes
240
+
241
+ - Updated dependencies [083947b]
242
+ - @ai-sdk/provider-utils@5.0.0-beta.22
243
+
244
+ ## 3.0.0-beta.23
245
+
246
+ ### Patch Changes
247
+
248
+ - Updated dependencies [add1126]
249
+ - @ai-sdk/provider-utils@5.0.0-beta.21
250
+
251
+ ## 3.0.0-beta.22
252
+
253
+ ### Patch Changes
254
+
255
+ - b3976a2: Add workflow serialization support to all provider models.
256
+
257
+ **`@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.
258
+
259
+ **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.
260
+
261
+ All provider model classes now include `WORKFLOW_SERIALIZE` and `WORKFLOW_DESERIALIZE` static methods, enabling them to cross workflow step boundaries without serialization errors.
262
+
263
+ - Updated dependencies [b3976a2]
264
+ - Updated dependencies [ff5eba1]
265
+ - @ai-sdk/provider-utils@5.0.0-beta.20
266
+ - @ai-sdk/provider@4.0.0-beta.12
267
+
268
+ ## 3.0.0-beta.21
269
+
270
+ ### Major Changes
271
+
272
+ - ef992f8: Remove CommonJS exports from all packages. All packages are now ESM-only (`"type": "module"`). Consumers using `require()` must switch to ESM `import` syntax.
273
+
274
+ ### Patch Changes
275
+
276
+ - Updated dependencies [ef992f8]
277
+ - @ai-sdk/provider@4.0.0-beta.11
278
+ - @ai-sdk/provider-utils@5.0.0-beta.19
279
+
280
+ ## 3.0.0-beta.20
281
+
282
+ ### Patch Changes
283
+
284
+ - Updated dependencies [90e2d8a]
285
+ - @ai-sdk/provider-utils@5.0.0-beta.18
286
+
287
+ ## 3.0.0-beta.19
288
+
289
+ ### Patch Changes
290
+
291
+ - Updated dependencies [3ae1786]
292
+ - @ai-sdk/provider-utils@5.0.0-beta.17
293
+
294
+ ## 3.0.0-beta.18
295
+
296
+ ### Patch Changes
297
+
298
+ - Updated dependencies [176466a]
299
+ - @ai-sdk/provider@4.0.0-beta.10
300
+ - @ai-sdk/provider-utils@5.0.0-beta.16
301
+
302
+ ## 3.0.0-beta.17
303
+
304
+ ### Patch Changes
305
+
306
+ - Updated dependencies [e311194]
307
+ - @ai-sdk/provider@4.0.0-beta.9
308
+ - @ai-sdk/provider-utils@5.0.0-beta.15
309
+
310
+ ## 3.0.0-beta.16
311
+
312
+ ### Patch Changes
313
+
314
+ - Updated dependencies [34bd95d]
315
+ - Updated dependencies [008271d]
316
+ - @ai-sdk/provider@4.0.0-beta.8
317
+ - @ai-sdk/provider-utils@5.0.0-beta.14
318
+
319
+ ## 3.0.0-beta.15
320
+
321
+ ### Patch Changes
322
+
323
+ - Updated dependencies [b0c2869]
324
+ - Updated dependencies [7e26e81]
325
+ - @ai-sdk/provider-utils@5.0.0-beta.13
326
+
327
+ ## 3.0.0-beta.14
328
+
329
+ ### Patch Changes
330
+
331
+ - Updated dependencies [46d1149]
332
+ - @ai-sdk/provider-utils@5.0.0-beta.12
333
+
334
+ ## 3.0.0-beta.13
335
+
336
+ ### Patch Changes
337
+
338
+ - Updated dependencies [6fd51c0]
339
+ - @ai-sdk/provider-utils@5.0.0-beta.11
340
+ - @ai-sdk/provider@4.0.0-beta.7
341
+
342
+ ## 3.0.0-beta.12
343
+
344
+ ### Patch Changes
345
+
346
+ - Updated dependencies [c29a26f]
347
+ - @ai-sdk/provider-utils@5.0.0-beta.10
348
+ - @ai-sdk/provider@4.0.0-beta.6
349
+
350
+ ## 3.0.0-beta.11
351
+
352
+ ### Patch Changes
353
+
354
+ - 38fc777: Add AI Gateway hint to provider READMEs
355
+
356
+ ## 3.0.0-beta.10
357
+
358
+ ### Patch Changes
359
+
360
+ - Updated dependencies [2e17091]
361
+ - @ai-sdk/provider-utils@5.0.0-beta.9
362
+
363
+ ## 3.0.0-beta.9
364
+
365
+ ### Patch Changes
366
+
367
+ - Updated dependencies [986c6fd]
368
+ - Updated dependencies [493295c]
369
+ - @ai-sdk/provider-utils@5.0.0-beta.8
370
+
371
+ ## 3.0.0-beta.8
372
+
373
+ ### Patch Changes
374
+
375
+ - Updated dependencies [1f509d4]
376
+ - @ai-sdk/provider-utils@5.0.0-beta.7
377
+ - @ai-sdk/provider@4.0.0-beta.5
378
+
379
+ ## 3.0.0-beta.7
380
+
381
+ ### Patch Changes
382
+
383
+ - Updated dependencies [3887c70]
384
+ - @ai-sdk/provider-utils@5.0.0-beta.6
385
+ - @ai-sdk/provider@4.0.0-beta.4
386
+
387
+ ## 3.0.0-beta.6
388
+
389
+ ### Patch Changes
390
+
391
+ - Updated dependencies [776b617]
392
+ - @ai-sdk/provider-utils@5.0.0-beta.5
393
+ - @ai-sdk/provider@4.0.0-beta.3
394
+
3
395
  ## 3.0.0-beta.5
4
396
 
5
397
  ### Patch Changes
@@ -241,13 +633,13 @@
241
633
  Before
242
634
 
243
635
  ```ts
244
- model.textEmbeddingModel('my-model-id');
636
+ model.textEmbeddingModel("my-model-id");
245
637
  ```
246
638
 
247
639
  After
248
640
 
249
641
  ```ts
250
- model.embeddingModel('my-model-id');
642
+ model.embeddingModel("my-model-id");
251
643
  ```
252
644
 
253
645
  - 95f65c2: chore: use import \* from zod/v4
@@ -471,13 +863,13 @@
471
863
  Before
472
864
 
473
865
  ```ts
474
- model.textEmbeddingModel('my-model-id');
866
+ model.textEmbeddingModel("my-model-id");
475
867
  ```
476
868
 
477
869
  After
478
870
 
479
871
  ```ts
480
- model.embeddingModel('my-model-id');
872
+ model.embeddingModel("my-model-id");
481
873
  ```
482
874
 
483
875
  - Updated dependencies [8d9e8ad]
@@ -847,7 +1239,7 @@
847
1239
 
848
1240
  ```js
849
1241
  await generateImage({
850
- model: luma.image('photon-flash-1', {
1242
+ model: luma.image("photon-flash-1", {
851
1243
  maxImagesPerCall: 5,
852
1244
  pollIntervalMillis: 500,
853
1245
  }),
@@ -860,7 +1252,7 @@
860
1252
 
861
1253
  ```js
862
1254
  await generateImage({
863
- model: luma.image('photon-flash-1'),
1255
+ model: luma.image("photon-flash-1"),
864
1256
  prompt,
865
1257
  n: 10,
866
1258
  maxImagesPerCall: 5,
@@ -1096,7 +1488,7 @@
1096
1488
 
1097
1489
  ```js
1098
1490
  await generateImage({
1099
- model: luma.image('photon-flash-1', {
1491
+ model: luma.image("photon-flash-1", {
1100
1492
  maxImagesPerCall: 5,
1101
1493
  pollIntervalMillis: 500,
1102
1494
  }),
@@ -1109,7 +1501,7 @@
1109
1501
 
1110
1502
  ```js
1111
1503
  await generateImage({
1112
- model: luma.image('photon-flash-1'),
1504
+ model: luma.image("photon-flash-1"),
1113
1505
  prompt,
1114
1506
  n: 10,
1115
1507
  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;