@ai-sdk/bytedance 1.0.25 → 1.0.27

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/bytedance
2
2
 
3
+ ## 1.0.27
4
+
5
+ ### Patch Changes
6
+
7
+ - a8e6bb5: feat (provider/bytedance): add Seedream image model support via `.image()` / `.imageModel()`, with typed `ByteDanceImageModelOptions` provider options
8
+
9
+ ## 1.0.26
10
+
11
+ ### Patch Changes
12
+
13
+ - e1af05f: feat (video): support video (not just image) reference inputs in `inputReferences` for reference-to-video generation
14
+ - Updated dependencies [e1af05f]
15
+ - @ai-sdk/provider@3.0.14
16
+ - @ai-sdk/provider-utils@4.0.38
17
+
3
18
  ## 1.0.25
4
19
 
5
20
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,5 +1,7 @@
1
- import { ProviderV3, Experimental_VideoModelV3 } from '@ai-sdk/provider';
2
- import { FetchFunction } from '@ai-sdk/provider-utils';
1
+ import { ProviderV3, Experimental_VideoModelV3, ImageModelV3, ImageModelV3CallOptions } from '@ai-sdk/provider';
2
+ import { FetchFunction, Resolvable } from '@ai-sdk/provider-utils';
3
+
4
+ type ByteDanceImageModelId = 'dola-seedream-5-0-pro-260628' | 'seedream-5-0-260128' | 'seedream-5-0-lite-260128' | 'seedream-4-5-251128' | 'seedream-4-0-250828' | (string & {});
3
5
 
4
6
  type ByteDanceVideoModelId = 'dreamina-seedance-2-0-fast-260128' | 'dreamina-seedance-2-0-260128' | 'seedance-1-5-pro-251215' | 'seedance-1-0-pro-250528' | 'seedance-1-0-pro-fast-251015' | 'seedance-1-0-lite-t2v-250428' | 'seedance-1-0-lite-i2v-250428' | (string & {});
5
7
 
@@ -33,6 +35,14 @@ interface ByteDanceProvider extends ProviderV3 {
33
35
  * Creates a model for video generation.
34
36
  */
35
37
  videoModel(modelId: ByteDanceVideoModelId): Experimental_VideoModelV3;
38
+ /**
39
+ * Creates a model for image generation.
40
+ */
41
+ image(modelId: ByteDanceImageModelId): ImageModelV3;
42
+ /**
43
+ * Creates a model for image generation.
44
+ */
45
+ imageModel(modelId: ByteDanceImageModelId): ImageModelV3;
36
46
  }
37
47
  /**
38
48
  * Create a ByteDance provider instance.
@@ -43,6 +53,65 @@ declare function createByteDance(options?: ByteDanceProviderSettings): ByteDance
43
53
  */
44
54
  declare const byteDance: ByteDanceProvider;
45
55
 
56
+ interface ByteDanceConfig {
57
+ provider: string;
58
+ baseURL: string;
59
+ headers: Resolvable<Record<string, string | undefined>>;
60
+ fetch?: FetchFunction;
61
+ }
62
+
63
+ interface ByteDanceImageModelConfig extends ByteDanceConfig {
64
+ _internal?: {
65
+ currentDate?: () => Date;
66
+ };
67
+ }
68
+ declare class ByteDanceImageModel implements ImageModelV3 {
69
+ readonly modelId: ByteDanceImageModelId;
70
+ private readonly config;
71
+ readonly specificationVersion = "v3";
72
+ readonly maxImagesPerCall = 1;
73
+ get provider(): string;
74
+ constructor(modelId: ByteDanceImageModelId, config: ByteDanceImageModelConfig);
75
+ doGenerate({ prompt, size, aspectRatio, seed, providerOptions, headers, abortSignal, files, mask, }: ImageModelV3CallOptions): Promise<Awaited<ReturnType<ImageModelV3['doGenerate']>>>;
76
+ }
77
+
78
+ type ByteDanceImageModelOptions = {
79
+ /**
80
+ * Whether to add an "AI generated" watermark to the bottom-right corner of
81
+ * the output image.
82
+ */
83
+ watermark?: boolean | null;
84
+ /**
85
+ * Format of the generated image file. Supported by `seedream-5-0` and
86
+ * `dola-seedream-5-0-pro`; `seedream-4-5` / `seedream-4-0` always return
87
+ * `jpeg`.
88
+ */
89
+ outputFormat?: 'png' | 'jpeg' | null;
90
+ /**
91
+ * A resolution level (e.g. `1K`, `2K`, `3K`, `4K`) as an alternative to
92
+ * passing pixel dimensions via the top-level `size` parameter. When set, this
93
+ * overrides the top-level `size`. Available levels vary by model.
94
+ */
95
+ size?: string | null;
96
+ /**
97
+ * Set to `'auto'` to generate a batch of related images (e.g. storyboards or
98
+ * brand visuals). Defaults to `'disabled'` (single image).
99
+ */
100
+ sequentialImageGeneration?: 'auto' | 'disabled' | null;
101
+ /**
102
+ * Maximum number of images to generate when `sequentialImageGeneration` is
103
+ * `'auto'`. The number of input reference images plus generated images must
104
+ * not exceed the model's limit.
105
+ */
106
+ maxImages?: number | null;
107
+ /**
108
+ * Prompt optimization mode. `seedream-4-0` supports both `'standard'` and
109
+ * `'fast'`; other models support `'standard'` only.
110
+ */
111
+ optimizePromptMode?: 'standard' | 'fast' | null;
112
+ [key: string]: unknown;
113
+ };
114
+
46
115
  type ByteDanceVideoProviderOptions = {
47
116
  watermark?: boolean | null;
48
117
  generateAudio?: boolean | null;
@@ -61,4 +130,4 @@ type ByteDanceVideoProviderOptions = {
61
130
 
62
131
  declare const VERSION: string;
63
132
 
64
- export { type ByteDanceProvider, type ByteDanceProviderSettings, type ByteDanceVideoModelId, type ByteDanceVideoProviderOptions, VERSION, byteDance, createByteDance };
133
+ export { ByteDanceImageModel, type ByteDanceImageModelId, type ByteDanceImageModelOptions, type ByteDanceProvider, type ByteDanceProviderSettings, type ByteDanceVideoModelId, type ByteDanceVideoProviderOptions, VERSION, byteDance, createByteDance };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
- import { ProviderV3, Experimental_VideoModelV3 } from '@ai-sdk/provider';
2
- import { FetchFunction } from '@ai-sdk/provider-utils';
1
+ import { ProviderV3, Experimental_VideoModelV3, ImageModelV3, ImageModelV3CallOptions } from '@ai-sdk/provider';
2
+ import { FetchFunction, Resolvable } from '@ai-sdk/provider-utils';
3
+
4
+ type ByteDanceImageModelId = 'dola-seedream-5-0-pro-260628' | 'seedream-5-0-260128' | 'seedream-5-0-lite-260128' | 'seedream-4-5-251128' | 'seedream-4-0-250828' | (string & {});
3
5
 
4
6
  type ByteDanceVideoModelId = 'dreamina-seedance-2-0-fast-260128' | 'dreamina-seedance-2-0-260128' | 'seedance-1-5-pro-251215' | 'seedance-1-0-pro-250528' | 'seedance-1-0-pro-fast-251015' | 'seedance-1-0-lite-t2v-250428' | 'seedance-1-0-lite-i2v-250428' | (string & {});
5
7
 
@@ -33,6 +35,14 @@ interface ByteDanceProvider extends ProviderV3 {
33
35
  * Creates a model for video generation.
34
36
  */
35
37
  videoModel(modelId: ByteDanceVideoModelId): Experimental_VideoModelV3;
38
+ /**
39
+ * Creates a model for image generation.
40
+ */
41
+ image(modelId: ByteDanceImageModelId): ImageModelV3;
42
+ /**
43
+ * Creates a model for image generation.
44
+ */
45
+ imageModel(modelId: ByteDanceImageModelId): ImageModelV3;
36
46
  }
37
47
  /**
38
48
  * Create a ByteDance provider instance.
@@ -43,6 +53,65 @@ declare function createByteDance(options?: ByteDanceProviderSettings): ByteDance
43
53
  */
44
54
  declare const byteDance: ByteDanceProvider;
45
55
 
56
+ interface ByteDanceConfig {
57
+ provider: string;
58
+ baseURL: string;
59
+ headers: Resolvable<Record<string, string | undefined>>;
60
+ fetch?: FetchFunction;
61
+ }
62
+
63
+ interface ByteDanceImageModelConfig extends ByteDanceConfig {
64
+ _internal?: {
65
+ currentDate?: () => Date;
66
+ };
67
+ }
68
+ declare class ByteDanceImageModel implements ImageModelV3 {
69
+ readonly modelId: ByteDanceImageModelId;
70
+ private readonly config;
71
+ readonly specificationVersion = "v3";
72
+ readonly maxImagesPerCall = 1;
73
+ get provider(): string;
74
+ constructor(modelId: ByteDanceImageModelId, config: ByteDanceImageModelConfig);
75
+ doGenerate({ prompt, size, aspectRatio, seed, providerOptions, headers, abortSignal, files, mask, }: ImageModelV3CallOptions): Promise<Awaited<ReturnType<ImageModelV3['doGenerate']>>>;
76
+ }
77
+
78
+ type ByteDanceImageModelOptions = {
79
+ /**
80
+ * Whether to add an "AI generated" watermark to the bottom-right corner of
81
+ * the output image.
82
+ */
83
+ watermark?: boolean | null;
84
+ /**
85
+ * Format of the generated image file. Supported by `seedream-5-0` and
86
+ * `dola-seedream-5-0-pro`; `seedream-4-5` / `seedream-4-0` always return
87
+ * `jpeg`.
88
+ */
89
+ outputFormat?: 'png' | 'jpeg' | null;
90
+ /**
91
+ * A resolution level (e.g. `1K`, `2K`, `3K`, `4K`) as an alternative to
92
+ * passing pixel dimensions via the top-level `size` parameter. When set, this
93
+ * overrides the top-level `size`. Available levels vary by model.
94
+ */
95
+ size?: string | null;
96
+ /**
97
+ * Set to `'auto'` to generate a batch of related images (e.g. storyboards or
98
+ * brand visuals). Defaults to `'disabled'` (single image).
99
+ */
100
+ sequentialImageGeneration?: 'auto' | 'disabled' | null;
101
+ /**
102
+ * Maximum number of images to generate when `sequentialImageGeneration` is
103
+ * `'auto'`. The number of input reference images plus generated images must
104
+ * not exceed the model's limit.
105
+ */
106
+ maxImages?: number | null;
107
+ /**
108
+ * Prompt optimization mode. `seedream-4-0` supports both `'standard'` and
109
+ * `'fast'`; other models support `'standard'` only.
110
+ */
111
+ optimizePromptMode?: 'standard' | 'fast' | null;
112
+ [key: string]: unknown;
113
+ };
114
+
46
115
  type ByteDanceVideoProviderOptions = {
47
116
  watermark?: boolean | null;
48
117
  generateAudio?: boolean | null;
@@ -61,4 +130,4 @@ type ByteDanceVideoProviderOptions = {
61
130
 
62
131
  declare const VERSION: string;
63
132
 
64
- export { type ByteDanceProvider, type ByteDanceProviderSettings, type ByteDanceVideoModelId, type ByteDanceVideoProviderOptions, VERSION, byteDance, createByteDance };
133
+ export { ByteDanceImageModel, type ByteDanceImageModelId, type ByteDanceImageModelOptions, type ByteDanceProvider, type ByteDanceProviderSettings, type ByteDanceVideoModelId, type ByteDanceVideoProviderOptions, VERSION, byteDance, createByteDance };