@ai-sdk/black-forest-labs 2.0.19 → 2.0.21

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,20 @@
1
1
  # @ai-sdk/black-forest-labs
2
2
 
3
+ ## 2.0.21
4
+
5
+ ### Patch Changes
6
+
7
+ - 53f1bc4: Add video model support to the Black Forest Labs provider (`blackForestLabs.video`) for the FLUX 3 video model, including text-to-video, image-to-video keyframes, video continuation, draft/draft-enhance generation, and AI SDK Core polling.
8
+ - Updated dependencies [1bec07d]
9
+ - @ai-sdk/provider-utils@5.0.21
10
+
11
+ ## 2.0.20
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [160ccdb]
16
+ - @ai-sdk/provider-utils@5.0.20
17
+
3
18
  ## 2.0.19
4
19
 
5
20
  ### Patch Changes
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # AI SDK - Black Forest Labs Provider
2
2
 
3
- The **[Black Forest Labs provider](https://ai-sdk.dev/providers/ai-sdk-providers/black-forest-labs)** for the [AI SDK](https://ai-sdk.dev/docs) adds image model support for the [Black Forest Labs API](https://docs.bfl.ai/).
3
+ The **[Black Forest Labs provider](https://ai-sdk.dev/providers/ai-sdk-providers/black-forest-labs)** for the [AI SDK](https://ai-sdk.dev/docs) adds image and video model support for the [Black Forest Labs API](https://docs.bfl.ai/).
4
4
 
5
5
  > **Deploying to Vercel?** With Vercel's AI Gateway you can access Black Forest Labs (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
6
 
@@ -45,6 +45,20 @@ fs.writeFileSync(filename, image.uint8Array);
45
45
  console.log(`Image saved to ${filename}`);
46
46
  ```
47
47
 
48
+ ## Video Generation Example
49
+
50
+ ```ts
51
+ import { blackForestLabs } from '@ai-sdk/black-forest-labs';
52
+ import { experimental_generateVideo as generateVideo } from 'ai';
53
+
54
+ const { video } = await generateVideo({
55
+ model: blackForestLabs.video('flux-3-video'),
56
+ prompt: 'A white kitten chases a butterfly across a sunlit garden.',
57
+ aspectRatio: '16:9',
58
+ duration: 8,
59
+ });
60
+ ```
61
+
48
62
  ## Additional Options
49
63
 
50
64
  If you want to pass additional inputs to the model besides the prompt, use the `providerOptions.blackForestLabs` property:
@@ -83,7 +97,7 @@ const blackForestLabs = createBlackForestLabs({
83
97
 
84
98
  ## Configuring Polling
85
99
 
86
- You can customize how often the client polls for image completion and how long it waits before timing out:
100
+ You can customize how often the client polls for completion and how long it waits before timing out. The defaults differ by model type: 500ms / 60s for images, and 2s / 10 minutes for video.
87
101
 
88
102
  ```ts
89
103
  import { createBlackForestLabs } from '@ai-sdk/black-forest-labs';
package/dist/index.d.ts CHANGED
@@ -1,10 +1,12 @@
1
- import { ProviderV4, ImageModelV4 } from '@ai-sdk/provider';
1
+ import { ProviderV4, ImageModelV4, Experimental_VideoModelV4 } from '@ai-sdk/provider';
2
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
3
  import { FetchFunction, InferSchema } from '@ai-sdk/provider-utils';
4
4
 
5
5
  type BlackForestLabsImageModelId = 'flux-kontext-pro' | 'flux-kontext-max' | 'flux-pro-1.1-ultra' | 'flux-pro-1.1' | 'flux-pro-1.0-fill' | (string & {});
6
6
  type BlackForestLabsAspectRatio = `${number}:${number}`;
7
7
 
8
+ type BlackForestLabsVideoModelId = 'flux-3-video' | (string & {});
9
+
8
10
  interface BlackForestLabsProviderSettings {
9
11
  /**
10
12
  * Black Forest Labs API key. Default value is taken from the `BFL_API_KEY` environment variable.
@@ -24,11 +26,13 @@ interface BlackForestLabsProviderSettings {
24
26
  */
25
27
  fetch?: FetchFunction;
26
28
  /**
27
- * Poll interval in milliseconds between status checks. Defaults to 500ms.
29
+ * Poll interval in milliseconds between status checks. Defaults to 500ms for
30
+ * images and 2s for video.
28
31
  */
29
32
  pollIntervalMillis?: number;
30
33
  /**
31
- * Overall timeout in milliseconds for polling before giving up. Defaults to 60s.
34
+ * Overall timeout in milliseconds for polling before giving up. Defaults to
35
+ * 60s for images and 10 minutes for video.
32
36
  */
33
37
  pollTimeoutMillis?: number;
34
38
  }
@@ -41,6 +45,14 @@ interface BlackForestLabsProvider extends ProviderV4 {
41
45
  * Creates a model for image generation.
42
46
  */
43
47
  imageModel(modelId: BlackForestLabsImageModelId): ImageModelV4;
48
+ /**
49
+ * Creates a model for video generation.
50
+ */
51
+ video(modelId: BlackForestLabsVideoModelId): Experimental_VideoModelV4;
52
+ /**
53
+ * Creates a model for video generation.
54
+ */
55
+ videoModel(modelId: BlackForestLabsVideoModelId): Experimental_VideoModelV4;
44
56
  /**
45
57
  * @deprecated Use `embeddingModel` instead.
46
58
  */
@@ -77,6 +89,17 @@ declare const blackForestLabsImageModelOptionsSchema: _ai_sdk_provider_utils.Laz
77
89
  }>;
78
90
  type BlackForestLabsImageModelOptions = InferSchema<typeof blackForestLabsImageModelOptionsSchema>;
79
91
 
92
+ declare const blackForestLabsVideoModelOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
93
+ resolution?: "hd" | "fhd" | undefined;
94
+ aspectRatio?: "21:9" | "2:1" | "16:9" | "4:3" | "1:1" | "3:4" | "9:16" | "auto" | undefined;
95
+ keyframes?: string[] | [number, string][] | undefined;
96
+ safetyTolerance?: number | undefined;
97
+ draft?: boolean | undefined;
98
+ draftCache?: string | undefined;
99
+ version?: "latest" | undefined;
100
+ }>;
101
+ type BlackForestLabsVideoModelOptions = InferSchema<typeof blackForestLabsVideoModelOptionsSchema>;
102
+
80
103
  declare const VERSION: string;
81
104
 
82
- export { type BlackForestLabsAspectRatio, type BlackForestLabsImageModelId, type BlackForestLabsImageModelOptions, type BlackForestLabsImageModelOptions as BlackForestLabsImageProviderOptions, type BlackForestLabsProvider, type BlackForestLabsProviderSettings, VERSION, blackForestLabs, createBlackForestLabs };
105
+ export { type BlackForestLabsAspectRatio, type BlackForestLabsImageModelId, type BlackForestLabsImageModelOptions, type BlackForestLabsImageModelOptions as BlackForestLabsImageProviderOptions, type BlackForestLabsProvider, type BlackForestLabsProviderSettings, type BlackForestLabsVideoModelId, type BlackForestLabsVideoModelOptions, VERSION, blackForestLabs, createBlackForestLabs };