@runapi.ai/seedream 0.2.8 → 0.2.10
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/README.md +4 -0
- package/dist/index.d.mts +30 -11
- package/dist/index.d.ts +30 -11
- package/dist/index.js +153 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +153 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/skills/seedream/README.md +3 -1
- package/skills/seedream/SKILL.md +2 -0
package/README.md
CHANGED
|
@@ -30,6 +30,10 @@ Use `create` when you want to submit a task and return quickly, `get` when you n
|
|
|
30
30
|
|
|
31
31
|
RunAPI-generated file URLs are temporary. Download and store generated images, videos, audio, or other files in your own durable storage within 7 days; do not treat returned URLs as long-term assets.
|
|
32
32
|
|
|
33
|
+
## Seedream 5 Pro
|
|
34
|
+
|
|
35
|
+
Use `seedream-5-pro-text-to-image` for generation and `seedream-5-pro-edit` for image editing. Both accept `output_quality`, optional `output_format`, and optional content safety checking; editing accepts up to 10 source image URLs.
|
|
36
|
+
|
|
33
37
|
## Language notes
|
|
34
38
|
|
|
35
39
|
Use the TypeScript types in `src/types.ts` and the resource classes under `src/resources` when building image applications. The package exposes `textToImage` for text models and `editImage` for editing models. Keep `RUNAPI_API_KEY` in the environment or your secret manager; never commit API keys or callback secrets.
|
package/dist/index.d.mts
CHANGED
|
@@ -2,18 +2,20 @@ import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, BaseClient
|
|
|
2
2
|
export { AuthenticationError, InsufficientCreditsError, NetworkError, NotFoundError, RateLimitError, RunApiError, ServiceUnavailableError, TaskFailedError, TaskTimeoutError, TimeoutError, ValidationError } from '@runapi.ai/core';
|
|
3
3
|
|
|
4
4
|
/** Union of all Seedream model identifiers across text-to-image and edit endpoints. */
|
|
5
|
-
type SeedreamModel = 'seedream-4.5-text-to-image' | 'seedream-4.5-edit' | 'seedream-5-lite-text-to-image' | 'seedream-5-lite-edit' | 'seedream-v4-text-to-image' | 'seedream-v4-edit';
|
|
5
|
+
type SeedreamModel = 'seedream-4.5-text-to-image' | 'seedream-4.5-edit' | 'seedream-5-lite-text-to-image' | 'seedream-5-lite-edit' | 'seedream-5-pro-text-to-image' | 'seedream-5-pro-edit' | 'seedream-v4-text-to-image' | 'seedream-v4-edit';
|
|
6
6
|
/** Models accepted by the text-to-image endpoint. */
|
|
7
|
-
type TextToImageModel = 'seedream-4.5-text-to-image' | 'seedream-5-lite-text-to-image' | 'seedream-v4-text-to-image';
|
|
7
|
+
type TextToImageModel = 'seedream-4.5-text-to-image' | 'seedream-5-lite-text-to-image' | 'seedream-5-pro-text-to-image' | 'seedream-v4-text-to-image';
|
|
8
8
|
/** Models accepted by the edit-image endpoint. */
|
|
9
|
-
type EditImageModel = 'seedream-4.5-edit' | 'seedream-5-lite-edit' | 'seedream-v4-edit';
|
|
9
|
+
type EditImageModel = 'seedream-4.5-edit' | 'seedream-5-lite-edit' | 'seedream-5-pro-edit' | 'seedream-v4-edit';
|
|
10
10
|
type AspectRatio = '1:1' | '4:3' | '3:4' | '16:9' | '9:16' | '2:3' | '3:2' | '21:9';
|
|
11
|
-
/** Quality preset for 4.5 and 5
|
|
11
|
+
/** Quality preset for 4.5, 5-Lite, and 5 Pro models. */
|
|
12
12
|
type OutputQuality = 'basic' | 'high';
|
|
13
|
+
/** Output image format for 5-Lite and 5 Pro models. */
|
|
14
|
+
type OutputFormat = 'png' | 'jpeg';
|
|
13
15
|
/** Pixel resolution tier for V4 models. */
|
|
14
16
|
type V4OutputResolution = '1k' | '2k' | '4k';
|
|
15
17
|
/**
|
|
16
|
-
* Shared parameters for 4.5 and 5
|
|
18
|
+
* Shared parameters for 4.5, 5-Lite, and 5 Pro models.
|
|
17
19
|
* Both `aspect_ratio` and `output_quality` are required for these model families.
|
|
18
20
|
*/
|
|
19
21
|
interface ImageGenerationBaseParams {
|
|
@@ -52,11 +54,27 @@ interface Generation45EditImageParams extends ImageGenerationBaseParams {
|
|
|
52
54
|
}
|
|
53
55
|
interface Generation5LiteTextParams extends ImageGenerationBaseParams {
|
|
54
56
|
model: 'seedream-5-lite-text-to-image';
|
|
57
|
+
/** Output image format (default: "png"). */
|
|
58
|
+
output_format?: OutputFormat;
|
|
55
59
|
}
|
|
56
60
|
interface Generation5LiteEditParams extends ImageGenerationBaseParams {
|
|
57
61
|
model: 'seedream-5-lite-edit';
|
|
58
62
|
/** Source image URLs to edit (up to 14 for 5-lite models). */
|
|
59
63
|
source_image_urls: string[];
|
|
64
|
+
/** Output image format (default: "png"). */
|
|
65
|
+
output_format?: OutputFormat;
|
|
66
|
+
}
|
|
67
|
+
interface Generation5ProTextParams extends ImageGenerationBaseParams {
|
|
68
|
+
model: 'seedream-5-pro-text-to-image';
|
|
69
|
+
/** Output image format (default: "png"). */
|
|
70
|
+
output_format?: OutputFormat;
|
|
71
|
+
}
|
|
72
|
+
interface Generation5ProEditParams extends ImageGenerationBaseParams {
|
|
73
|
+
model: 'seedream-5-pro-edit';
|
|
74
|
+
/** Source image URLs to edit (up to 10 for 5 Pro models). */
|
|
75
|
+
source_image_urls: string[];
|
|
76
|
+
/** Output image format (default: "png"). */
|
|
77
|
+
output_format?: OutputFormat;
|
|
60
78
|
}
|
|
61
79
|
interface GenerationV4TextParams extends V4GenerationBaseParams {
|
|
62
80
|
model: 'seedream-v4-text-to-image';
|
|
@@ -66,8 +84,8 @@ interface GenerationV4EditParams extends V4GenerationBaseParams {
|
|
|
66
84
|
/** Source image URLs to edit (up to 10 for V4 models). */
|
|
67
85
|
source_image_urls: string[];
|
|
68
86
|
}
|
|
69
|
-
type TextToImageParams = Generation45TextParams | Generation5LiteTextParams | GenerationV4TextParams;
|
|
70
|
-
type EditImageParams = Generation45EditImageParams | Generation5LiteEditParams | GenerationV4EditParams;
|
|
87
|
+
type TextToImageParams = Generation45TextParams | Generation5LiteTextParams | Generation5ProTextParams | GenerationV4TextParams;
|
|
88
|
+
type EditImageParams = Generation45EditImageParams | Generation5LiteEditParams | Generation5ProEditParams | GenerationV4EditParams;
|
|
71
89
|
interface TaskCreateResponse {
|
|
72
90
|
id: string;
|
|
73
91
|
}
|
|
@@ -99,8 +117,9 @@ type CompletedEditImageResponse = EditImageResponse & {
|
|
|
99
117
|
|
|
100
118
|
/**
|
|
101
119
|
* Generates images from text prompts across Seedream model versions.
|
|
102
|
-
* Field requirements vary by model family: 4.5/5-
|
|
103
|
-
* and `output_quality`; V4 uses `output_resolution` and supports
|
|
120
|
+
* Field requirements vary by model family: 4.5/5-Lite/5 Pro require
|
|
121
|
+
* `aspect_ratio` and `output_quality`; V4 uses `output_resolution` and supports
|
|
122
|
+
* `seed`/`output_count`.
|
|
104
123
|
*/
|
|
105
124
|
declare class TextToImage {
|
|
106
125
|
private readonly http;
|
|
@@ -130,7 +149,7 @@ declare class TextToImage {
|
|
|
130
149
|
|
|
131
150
|
/**
|
|
132
151
|
* Modifies source images according to a text prompt.
|
|
133
|
-
* V4
|
|
152
|
+
* 5 Pro and V4 accept up to 10 source images; 4.5 and 5-Lite accept up to 14.
|
|
134
153
|
*/
|
|
135
154
|
declare class EditImage {
|
|
136
155
|
private readonly http;
|
|
@@ -194,4 +213,4 @@ declare class SeedreamClient extends BaseClient {
|
|
|
194
213
|
constructor(options?: ClientOptions);
|
|
195
214
|
}
|
|
196
215
|
|
|
197
|
-
export { type AspectRatio, type CompletedEditImageResponse, type CompletedTextToImageResponse, type EditImageModel, type EditImageParams, type EditImageResponse, type Generation45EditImageParams, type Generation45TextParams, type Generation5LiteEditParams, type Generation5LiteTextParams, type GenerationV4EditParams, type GenerationV4TextParams, type Image, type OutputQuality, SeedreamClient, type SeedreamModel, type TaskCreateResponse, type TextToImageModel, type TextToImageParams, type TextToImageResponse, type V4OutputResolution };
|
|
216
|
+
export { type AspectRatio, type CompletedEditImageResponse, type CompletedTextToImageResponse, type EditImageModel, type EditImageParams, type EditImageResponse, type Generation45EditImageParams, type Generation45TextParams, type Generation5LiteEditParams, type Generation5LiteTextParams, type Generation5ProEditParams, type Generation5ProTextParams, type GenerationV4EditParams, type GenerationV4TextParams, type Image, type OutputFormat, type OutputQuality, SeedreamClient, type SeedreamModel, type TaskCreateResponse, type TextToImageModel, type TextToImageParams, type TextToImageResponse, type V4OutputResolution };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,18 +2,20 @@ import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, BaseClient
|
|
|
2
2
|
export { AuthenticationError, InsufficientCreditsError, NetworkError, NotFoundError, RateLimitError, RunApiError, ServiceUnavailableError, TaskFailedError, TaskTimeoutError, TimeoutError, ValidationError } from '@runapi.ai/core';
|
|
3
3
|
|
|
4
4
|
/** Union of all Seedream model identifiers across text-to-image and edit endpoints. */
|
|
5
|
-
type SeedreamModel = 'seedream-4.5-text-to-image' | 'seedream-4.5-edit' | 'seedream-5-lite-text-to-image' | 'seedream-5-lite-edit' | 'seedream-v4-text-to-image' | 'seedream-v4-edit';
|
|
5
|
+
type SeedreamModel = 'seedream-4.5-text-to-image' | 'seedream-4.5-edit' | 'seedream-5-lite-text-to-image' | 'seedream-5-lite-edit' | 'seedream-5-pro-text-to-image' | 'seedream-5-pro-edit' | 'seedream-v4-text-to-image' | 'seedream-v4-edit';
|
|
6
6
|
/** Models accepted by the text-to-image endpoint. */
|
|
7
|
-
type TextToImageModel = 'seedream-4.5-text-to-image' | 'seedream-5-lite-text-to-image' | 'seedream-v4-text-to-image';
|
|
7
|
+
type TextToImageModel = 'seedream-4.5-text-to-image' | 'seedream-5-lite-text-to-image' | 'seedream-5-pro-text-to-image' | 'seedream-v4-text-to-image';
|
|
8
8
|
/** Models accepted by the edit-image endpoint. */
|
|
9
|
-
type EditImageModel = 'seedream-4.5-edit' | 'seedream-5-lite-edit' | 'seedream-v4-edit';
|
|
9
|
+
type EditImageModel = 'seedream-4.5-edit' | 'seedream-5-lite-edit' | 'seedream-5-pro-edit' | 'seedream-v4-edit';
|
|
10
10
|
type AspectRatio = '1:1' | '4:3' | '3:4' | '16:9' | '9:16' | '2:3' | '3:2' | '21:9';
|
|
11
|
-
/** Quality preset for 4.5 and 5
|
|
11
|
+
/** Quality preset for 4.5, 5-Lite, and 5 Pro models. */
|
|
12
12
|
type OutputQuality = 'basic' | 'high';
|
|
13
|
+
/** Output image format for 5-Lite and 5 Pro models. */
|
|
14
|
+
type OutputFormat = 'png' | 'jpeg';
|
|
13
15
|
/** Pixel resolution tier for V4 models. */
|
|
14
16
|
type V4OutputResolution = '1k' | '2k' | '4k';
|
|
15
17
|
/**
|
|
16
|
-
* Shared parameters for 4.5 and 5
|
|
18
|
+
* Shared parameters for 4.5, 5-Lite, and 5 Pro models.
|
|
17
19
|
* Both `aspect_ratio` and `output_quality` are required for these model families.
|
|
18
20
|
*/
|
|
19
21
|
interface ImageGenerationBaseParams {
|
|
@@ -52,11 +54,27 @@ interface Generation45EditImageParams extends ImageGenerationBaseParams {
|
|
|
52
54
|
}
|
|
53
55
|
interface Generation5LiteTextParams extends ImageGenerationBaseParams {
|
|
54
56
|
model: 'seedream-5-lite-text-to-image';
|
|
57
|
+
/** Output image format (default: "png"). */
|
|
58
|
+
output_format?: OutputFormat;
|
|
55
59
|
}
|
|
56
60
|
interface Generation5LiteEditParams extends ImageGenerationBaseParams {
|
|
57
61
|
model: 'seedream-5-lite-edit';
|
|
58
62
|
/** Source image URLs to edit (up to 14 for 5-lite models). */
|
|
59
63
|
source_image_urls: string[];
|
|
64
|
+
/** Output image format (default: "png"). */
|
|
65
|
+
output_format?: OutputFormat;
|
|
66
|
+
}
|
|
67
|
+
interface Generation5ProTextParams extends ImageGenerationBaseParams {
|
|
68
|
+
model: 'seedream-5-pro-text-to-image';
|
|
69
|
+
/** Output image format (default: "png"). */
|
|
70
|
+
output_format?: OutputFormat;
|
|
71
|
+
}
|
|
72
|
+
interface Generation5ProEditParams extends ImageGenerationBaseParams {
|
|
73
|
+
model: 'seedream-5-pro-edit';
|
|
74
|
+
/** Source image URLs to edit (up to 10 for 5 Pro models). */
|
|
75
|
+
source_image_urls: string[];
|
|
76
|
+
/** Output image format (default: "png"). */
|
|
77
|
+
output_format?: OutputFormat;
|
|
60
78
|
}
|
|
61
79
|
interface GenerationV4TextParams extends V4GenerationBaseParams {
|
|
62
80
|
model: 'seedream-v4-text-to-image';
|
|
@@ -66,8 +84,8 @@ interface GenerationV4EditParams extends V4GenerationBaseParams {
|
|
|
66
84
|
/** Source image URLs to edit (up to 10 for V4 models). */
|
|
67
85
|
source_image_urls: string[];
|
|
68
86
|
}
|
|
69
|
-
type TextToImageParams = Generation45TextParams | Generation5LiteTextParams | GenerationV4TextParams;
|
|
70
|
-
type EditImageParams = Generation45EditImageParams | Generation5LiteEditParams | GenerationV4EditParams;
|
|
87
|
+
type TextToImageParams = Generation45TextParams | Generation5LiteTextParams | Generation5ProTextParams | GenerationV4TextParams;
|
|
88
|
+
type EditImageParams = Generation45EditImageParams | Generation5LiteEditParams | Generation5ProEditParams | GenerationV4EditParams;
|
|
71
89
|
interface TaskCreateResponse {
|
|
72
90
|
id: string;
|
|
73
91
|
}
|
|
@@ -99,8 +117,9 @@ type CompletedEditImageResponse = EditImageResponse & {
|
|
|
99
117
|
|
|
100
118
|
/**
|
|
101
119
|
* Generates images from text prompts across Seedream model versions.
|
|
102
|
-
* Field requirements vary by model family: 4.5/5-
|
|
103
|
-
* and `output_quality`; V4 uses `output_resolution` and supports
|
|
120
|
+
* Field requirements vary by model family: 4.5/5-Lite/5 Pro require
|
|
121
|
+
* `aspect_ratio` and `output_quality`; V4 uses `output_resolution` and supports
|
|
122
|
+
* `seed`/`output_count`.
|
|
104
123
|
*/
|
|
105
124
|
declare class TextToImage {
|
|
106
125
|
private readonly http;
|
|
@@ -130,7 +149,7 @@ declare class TextToImage {
|
|
|
130
149
|
|
|
131
150
|
/**
|
|
132
151
|
* Modifies source images according to a text prompt.
|
|
133
|
-
* V4
|
|
152
|
+
* 5 Pro and V4 accept up to 10 source images; 4.5 and 5-Lite accept up to 14.
|
|
134
153
|
*/
|
|
135
154
|
declare class EditImage {
|
|
136
155
|
private readonly http;
|
|
@@ -194,4 +213,4 @@ declare class SeedreamClient extends BaseClient {
|
|
|
194
213
|
constructor(options?: ClientOptions);
|
|
195
214
|
}
|
|
196
215
|
|
|
197
|
-
export { type AspectRatio, type CompletedEditImageResponse, type CompletedTextToImageResponse, type EditImageModel, type EditImageParams, type EditImageResponse, type Generation45EditImageParams, type Generation45TextParams, type Generation5LiteEditParams, type Generation5LiteTextParams, type GenerationV4EditParams, type GenerationV4TextParams, type Image, type OutputQuality, SeedreamClient, type SeedreamModel, type TaskCreateResponse, type TextToImageModel, type TextToImageParams, type TextToImageResponse, type V4OutputResolution };
|
|
216
|
+
export { type AspectRatio, type CompletedEditImageResponse, type CompletedTextToImageResponse, type EditImageModel, type EditImageParams, type EditImageResponse, type Generation45EditImageParams, type Generation45TextParams, type Generation5LiteEditParams, type Generation5LiteTextParams, type Generation5ProEditParams, type Generation5ProTextParams, type GenerationV4EditParams, type GenerationV4TextParams, type Image, type OutputFormat, type OutputQuality, SeedreamClient, type SeedreamModel, type TaskCreateResponse, type TextToImageModel, type TextToImageParams, type TextToImageResponse, type V4OutputResolution };
|
package/dist/index.js
CHANGED
|
@@ -48,6 +48,7 @@ var contract = {
|
|
|
48
48
|
"models": [
|
|
49
49
|
"seedream-4.5-edit",
|
|
50
50
|
"seedream-5-lite-edit",
|
|
51
|
+
"seedream-5-pro-edit",
|
|
51
52
|
"seedream-v4-edit"
|
|
52
53
|
],
|
|
53
54
|
"fields_by_model": {
|
|
@@ -79,7 +80,9 @@ var contract = {
|
|
|
79
80
|
"type": "integer"
|
|
80
81
|
},
|
|
81
82
|
"source_image_urls": {
|
|
82
|
-
"required": true
|
|
83
|
+
"required": true,
|
|
84
|
+
"min_items": 1,
|
|
85
|
+
"max_items": 14
|
|
83
86
|
}
|
|
84
87
|
},
|
|
85
88
|
"seedream-5-lite-edit": {
|
|
@@ -99,6 +102,12 @@ var contract = {
|
|
|
99
102
|
"output_count": {
|
|
100
103
|
"type": "integer"
|
|
101
104
|
},
|
|
105
|
+
"output_format": {
|
|
106
|
+
"enum": [
|
|
107
|
+
"png",
|
|
108
|
+
"jpeg"
|
|
109
|
+
]
|
|
110
|
+
},
|
|
102
111
|
"output_quality": {
|
|
103
112
|
"enum": [
|
|
104
113
|
"basic",
|
|
@@ -110,7 +119,48 @@ var contract = {
|
|
|
110
119
|
"type": "integer"
|
|
111
120
|
},
|
|
112
121
|
"source_image_urls": {
|
|
122
|
+
"required": true,
|
|
123
|
+
"min_items": 1,
|
|
124
|
+
"max_items": 14
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
"seedream-5-pro-edit": {
|
|
128
|
+
"aspect_ratio": {
|
|
129
|
+
"enum": [
|
|
130
|
+
"1:1",
|
|
131
|
+
"4:3",
|
|
132
|
+
"3:4",
|
|
133
|
+
"16:9",
|
|
134
|
+
"9:16",
|
|
135
|
+
"2:3",
|
|
136
|
+
"3:2",
|
|
137
|
+
"21:9"
|
|
138
|
+
],
|
|
139
|
+
"required": true
|
|
140
|
+
},
|
|
141
|
+
"output_format": {
|
|
142
|
+
"enum": [
|
|
143
|
+
"png",
|
|
144
|
+
"jpeg"
|
|
145
|
+
]
|
|
146
|
+
},
|
|
147
|
+
"output_quality": {
|
|
148
|
+
"enum": [
|
|
149
|
+
"basic",
|
|
150
|
+
"high"
|
|
151
|
+
],
|
|
113
152
|
"required": true
|
|
153
|
+
},
|
|
154
|
+
"prompt": {
|
|
155
|
+
"required": true,
|
|
156
|
+
"min": 3,
|
|
157
|
+
"max": 5e3,
|
|
158
|
+
"length": true
|
|
159
|
+
},
|
|
160
|
+
"source_image_urls": {
|
|
161
|
+
"required": true,
|
|
162
|
+
"min_items": 1,
|
|
163
|
+
"max_items": 10
|
|
114
164
|
}
|
|
115
165
|
},
|
|
116
166
|
"seedream-v4-edit": {
|
|
@@ -148,15 +198,46 @@ var contract = {
|
|
|
148
198
|
"type": "integer"
|
|
149
199
|
},
|
|
150
200
|
"source_image_urls": {
|
|
151
|
-
"required": true
|
|
201
|
+
"required": true,
|
|
202
|
+
"min_items": 1,
|
|
203
|
+
"max_items": 10
|
|
152
204
|
}
|
|
153
205
|
}
|
|
154
|
-
}
|
|
206
|
+
},
|
|
207
|
+
"rules": [
|
|
208
|
+
{
|
|
209
|
+
"when": {
|
|
210
|
+
"model": "seedream-4.5-edit"
|
|
211
|
+
},
|
|
212
|
+
"forbidden": [
|
|
213
|
+
"output_format"
|
|
214
|
+
]
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"when": {
|
|
218
|
+
"model": "seedream-5-pro-edit"
|
|
219
|
+
},
|
|
220
|
+
"forbidden": [
|
|
221
|
+
"output_resolution",
|
|
222
|
+
"output_count",
|
|
223
|
+
"seed"
|
|
224
|
+
]
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"when": {
|
|
228
|
+
"model": "seedream-v4-edit"
|
|
229
|
+
},
|
|
230
|
+
"forbidden": [
|
|
231
|
+
"output_format"
|
|
232
|
+
]
|
|
233
|
+
}
|
|
234
|
+
]
|
|
155
235
|
},
|
|
156
236
|
"text-to-image": {
|
|
157
237
|
"models": [
|
|
158
238
|
"seedream-4.5-text-to-image",
|
|
159
239
|
"seedream-5-lite-text-to-image",
|
|
240
|
+
"seedream-5-pro-text-to-image",
|
|
160
241
|
"seedream-v4-text-to-image"
|
|
161
242
|
],
|
|
162
243
|
"fields_by_model": {
|
|
@@ -205,6 +286,12 @@ var contract = {
|
|
|
205
286
|
"output_count": {
|
|
206
287
|
"type": "integer"
|
|
207
288
|
},
|
|
289
|
+
"output_format": {
|
|
290
|
+
"enum": [
|
|
291
|
+
"png",
|
|
292
|
+
"jpeg"
|
|
293
|
+
]
|
|
294
|
+
},
|
|
208
295
|
"output_quality": {
|
|
209
296
|
"enum": [
|
|
210
297
|
"basic",
|
|
@@ -216,6 +303,40 @@ var contract = {
|
|
|
216
303
|
"type": "integer"
|
|
217
304
|
}
|
|
218
305
|
},
|
|
306
|
+
"seedream-5-pro-text-to-image": {
|
|
307
|
+
"aspect_ratio": {
|
|
308
|
+
"enum": [
|
|
309
|
+
"1:1",
|
|
310
|
+
"4:3",
|
|
311
|
+
"3:4",
|
|
312
|
+
"16:9",
|
|
313
|
+
"9:16",
|
|
314
|
+
"2:3",
|
|
315
|
+
"3:2",
|
|
316
|
+
"21:9"
|
|
317
|
+
],
|
|
318
|
+
"required": true
|
|
319
|
+
},
|
|
320
|
+
"output_format": {
|
|
321
|
+
"enum": [
|
|
322
|
+
"png",
|
|
323
|
+
"jpeg"
|
|
324
|
+
]
|
|
325
|
+
},
|
|
326
|
+
"output_quality": {
|
|
327
|
+
"enum": [
|
|
328
|
+
"basic",
|
|
329
|
+
"high"
|
|
330
|
+
],
|
|
331
|
+
"required": true
|
|
332
|
+
},
|
|
333
|
+
"prompt": {
|
|
334
|
+
"required": true,
|
|
335
|
+
"min": 3,
|
|
336
|
+
"max": 5e3,
|
|
337
|
+
"length": true
|
|
338
|
+
}
|
|
339
|
+
},
|
|
219
340
|
"seedream-v4-text-to-image": {
|
|
220
341
|
"aspect_ratio": {
|
|
221
342
|
"enum": [
|
|
@@ -251,7 +372,35 @@ var contract = {
|
|
|
251
372
|
"type": "integer"
|
|
252
373
|
}
|
|
253
374
|
}
|
|
254
|
-
}
|
|
375
|
+
},
|
|
376
|
+
"rules": [
|
|
377
|
+
{
|
|
378
|
+
"when": {
|
|
379
|
+
"model": "seedream-4.5-text-to-image"
|
|
380
|
+
},
|
|
381
|
+
"forbidden": [
|
|
382
|
+
"output_format"
|
|
383
|
+
]
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
"when": {
|
|
387
|
+
"model": "seedream-5-pro-text-to-image"
|
|
388
|
+
},
|
|
389
|
+
"forbidden": [
|
|
390
|
+
"output_resolution",
|
|
391
|
+
"output_count",
|
|
392
|
+
"seed"
|
|
393
|
+
]
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
"when": {
|
|
397
|
+
"model": "seedream-v4-text-to-image"
|
|
398
|
+
},
|
|
399
|
+
"forbidden": [
|
|
400
|
+
"output_format"
|
|
401
|
+
]
|
|
402
|
+
}
|
|
403
|
+
]
|
|
255
404
|
}
|
|
256
405
|
};
|
|
257
406
|
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/client.ts","../src/resources/text-to-image.ts","../src/contract_gen.ts","../src/resources/edit-image.ts"],"sourcesContent":["export { SeedreamClient } from './client';\nexport * from './types';\n\nexport {\n RunApiError,\n AuthenticationError,\n InsufficientCreditsError,\n NotFoundError,\n ValidationError,\n RateLimitError,\n ServiceUnavailableError,\n NetworkError,\n TimeoutError,\n TaskTimeoutError,\n TaskFailedError,\n} from '@runapi.ai/core';\n","import { BaseClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToImage } from './resources/text-to-image';\nimport { EditImage } from './resources/edit-image';\n\n/**\n * Seedream image generation and editing API client.\n *\n * Three model families with different field requirements:\n * - **4.5**: requires `aspect_ratio` and `output_quality`\n * - **5-lite**: same required fields as 4.5, faster generation\n * - **V4**: uses `output_resolution` instead; supports `seed` and batch `output_count`\n *\n * @example\n * ```typescript\n * const client = new SeedreamClient({ apiKey: 'your-api-key' });\n *\n * // Seedream 4.5\n * const result = await client.textToImage.run({\n * model: 'seedream-4.5-text-to-image',\n * prompt: 'A beautiful product render',\n * aspect_ratio: '16:9',\n * output_quality: 'high',\n * });\n *\n * // Seedream V4 with batch output\n * const batch = await client.textToImage.run({\n * model: 'seedream-v4-text-to-image',\n * prompt: 'Minimalist logo design',\n * output_count: 4,\n * });\n * ```\n */\nexport class SeedreamClient extends BaseClient {\n /** Text-to-image generation across Seedream model versions. */\n public readonly textToImage: TextToImage;\n /** Edit source images according to a text prompt. */\n public readonly editImage: EditImage;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.textToImage = new TextToImage(this.http);\n this.editImage = new EditImage(this.http);\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\nimport type {\n CompletedTextToImageResponse,\n TextToImageParams,\n TextToImageResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/seedream/text_to_image';\n\n/**\n * Generates images from text prompts across Seedream model versions.\n * Field requirements vary by model family: 4.5/5-lite require `aspect_ratio`\n * and `output_quality`; V4 uses `output_resolution` and supports `seed`/`output_count`.\n */\nexport class TextToImage {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Create a text to image task and wait until complete.\n * @param params Text to image parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed text to image response.\n */\n async run(params: TextToImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToImageResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<TextToImageResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedTextToImageResponse;\n }\n\n /**\n * Create a text to image task; returns immediately with a task id.\n * @param params Text to image parameters.\n * @param options Per-request overrides.\n * @returns The task creation result.\n */\n async create(params: TextToImageParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\n validateParams(contract['text-to-image'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of a text to image task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current text to image task status.\n */\n async get(id: string, options?: RequestOptions): Promise<TextToImageResponse> {\n return this.http.request<TextToImageResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n","export const contract = {\n \"edit-image\": {\n \"models\": [\n \"seedream-4.5-edit\",\n \"seedream-5-lite-edit\",\n \"seedream-v4-edit\"\n ],\n \"fields_by_model\": {\n \"seedream-4.5-edit\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"2:3\",\n \"3:2\",\n \"21:9\"\n ],\n \"required\": true\n },\n \"output_count\": {\n \"type\": \"integer\"\n },\n \"output_quality\": {\n \"enum\": [\n \"basic\",\n \"high\"\n ],\n \"required\": true\n },\n \"seed\": {\n \"type\": \"integer\"\n },\n \"source_image_urls\": {\n \"required\": true\n }\n },\n \"seedream-5-lite-edit\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"2:3\",\n \"3:2\",\n \"21:9\"\n ],\n \"required\": true\n },\n \"output_count\": {\n \"type\": \"integer\"\n },\n \"output_quality\": {\n \"enum\": [\n \"basic\",\n \"high\"\n ],\n \"required\": true\n },\n \"seed\": {\n \"type\": \"integer\"\n },\n \"source_image_urls\": {\n \"required\": true\n }\n },\n \"seedream-v4-edit\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"3:2\",\n \"2:3\",\n \"16:9\",\n \"9:16\",\n \"21:9\"\n ]\n },\n \"output_count\": {\n \"enum\": [\n 1,\n 2,\n 3,\n 4,\n 5,\n 6\n ],\n \"type\": \"integer\"\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\",\n \"2k\",\n \"4k\"\n ]\n },\n \"seed\": {\n \"type\": \"integer\"\n },\n \"source_image_urls\": {\n \"required\": true\n }\n }\n }\n },\n \"text-to-image\": {\n \"models\": [\n \"seedream-4.5-text-to-image\",\n \"seedream-5-lite-text-to-image\",\n \"seedream-v4-text-to-image\"\n ],\n \"fields_by_model\": {\n \"seedream-4.5-text-to-image\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"2:3\",\n \"3:2\",\n \"21:9\"\n ],\n \"required\": true\n },\n \"output_count\": {\n \"type\": \"integer\"\n },\n \"output_quality\": {\n \"enum\": [\n \"basic\",\n \"high\"\n ],\n \"required\": true\n },\n \"seed\": {\n \"type\": \"integer\"\n }\n },\n \"seedream-5-lite-text-to-image\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"2:3\",\n \"3:2\",\n \"21:9\"\n ],\n \"required\": true\n },\n \"output_count\": {\n \"type\": \"integer\"\n },\n \"output_quality\": {\n \"enum\": [\n \"basic\",\n \"high\"\n ],\n \"required\": true\n },\n \"seed\": {\n \"type\": \"integer\"\n }\n },\n \"seedream-v4-text-to-image\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"3:2\",\n \"2:3\",\n \"16:9\",\n \"9:16\",\n \"21:9\"\n ]\n },\n \"output_count\": {\n \"enum\": [\n 1,\n 2,\n 3,\n 4,\n 5,\n 6\n ],\n \"type\": \"integer\"\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\",\n \"2k\",\n \"4k\"\n ]\n },\n \"seed\": {\n \"type\": \"integer\"\n }\n }\n }\n }\n} as const;\n","import type { HttpClient, RequestOptions, PollingOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\nimport type {\n CompletedEditImageResponse,\n EditImageParams,\n EditImageResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/seedream/edit_image';\n\n/**\n * Modifies source images according to a text prompt.\n * V4 models accept up to 10 source images; 4.5 and 5-lite accept up to 14.\n */\nexport class EditImage {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Create an edit image task and wait until complete.\n * @param params Edit image parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed edit image response.\n */\n async run(params: EditImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedEditImageResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<EditImageResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedEditImageResponse;\n }\n\n /**\n * Create an edit image task; returns immediately with a task id.\n * @param params Edit image parameters.\n * @param options Per-request overrides.\n * @returns The task creation result.\n */\n async create(params: EditImageParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\n validateParams(contract['edit-image'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of an edit image task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current edit image task status.\n */\n async get(id: string, options?: RequestOptions): Promise<EditImageResponse> {\n return this.http.request<EditImageResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,eAA+C;;;ACC/C,kBAA8C;AAC9C,sBAAkC;;;ACF3B,IAAM,WAAW;AAAA,EACtB,cAAc;AAAA,IACZ,UAAU;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB,qBAAqB;AAAA,QACnB,gBAAgB;AAAA,UACd,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,UACA,YAAY;AAAA,QACd;AAAA,QACA,gBAAgB;AAAA,UACd,QAAQ;AAAA,QACV;AAAA,QACA,kBAAkB;AAAA,UAChB,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,UACF;AAAA,UACA,YAAY;AAAA,QACd;AAAA,QACA,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C;AACD,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,OAAO,QAAyB,SAAuD;AAC3F,UAAM,WAAO,4BAAc,MAAM;AACjC,qCAAe,SAAS,YAAY,GAAmB,IAA+B;AACtF,WAAO,KAAK,KAAK,QAA4B,QAAQA,WAAU;AAAA,MAC7D;AAAA,MACA,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,IAAI,IAAY,SAAsD;AAC1E,WAAO,KAAK,KAAK,QAA2B,OAAO,GAAGA,SAAQ,IAAI,EAAE,IAAI;AAAA,MACtE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;AH7BO,IAAM,iBAAN,cAA6B,wBAAW;AAAA;AAAA,EAE7B;AAAA;AAAA,EAEA;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO;AACb,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAC5C,SAAK,YAAY,IAAI,UAAU,KAAK,IAAI;AAAA,EAC1C;AACF;;;ADxCA,IAAAC,eAYO;","names":["import_core","import_core","import_internal","ENDPOINT","import_core"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/client.ts","../src/resources/text-to-image.ts","../src/contract_gen.ts","../src/resources/edit-image.ts"],"sourcesContent":["export { SeedreamClient } from './client';\nexport * from './types';\n\nexport {\n RunApiError,\n AuthenticationError,\n InsufficientCreditsError,\n NotFoundError,\n ValidationError,\n RateLimitError,\n ServiceUnavailableError,\n NetworkError,\n TimeoutError,\n TaskTimeoutError,\n TaskFailedError,\n} from '@runapi.ai/core';\n","import { BaseClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToImage } from './resources/text-to-image';\nimport { EditImage } from './resources/edit-image';\n\n/**\n * Seedream image generation and editing API client.\n *\n * Three model families with different field requirements:\n * - **4.5**: requires `aspect_ratio` and `output_quality`\n * - **5-lite**: same required fields as 4.5, faster generation\n * - **V4**: uses `output_resolution` instead; supports `seed` and batch `output_count`\n *\n * @example\n * ```typescript\n * const client = new SeedreamClient({ apiKey: 'your-api-key' });\n *\n * // Seedream 4.5\n * const result = await client.textToImage.run({\n * model: 'seedream-4.5-text-to-image',\n * prompt: 'A beautiful product render',\n * aspect_ratio: '16:9',\n * output_quality: 'high',\n * });\n *\n * // Seedream V4 with batch output\n * const batch = await client.textToImage.run({\n * model: 'seedream-v4-text-to-image',\n * prompt: 'Minimalist logo design',\n * output_count: 4,\n * });\n * ```\n */\nexport class SeedreamClient extends BaseClient {\n /** Text-to-image generation across Seedream model versions. */\n public readonly textToImage: TextToImage;\n /** Edit source images according to a text prompt. */\n public readonly editImage: EditImage;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.textToImage = new TextToImage(this.http);\n this.editImage = new EditImage(this.http);\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\nimport type {\n CompletedTextToImageResponse,\n TextToImageParams,\n TextToImageResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/seedream/text_to_image';\n\n/**\n * Generates images from text prompts across Seedream model versions.\n * Field requirements vary by model family: 4.5/5-Lite/5 Pro require\n * `aspect_ratio` and `output_quality`; V4 uses `output_resolution` and supports\n * `seed`/`output_count`.\n */\nexport class TextToImage {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Create a text to image task and wait until complete.\n * @param params Text to image parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed text to image response.\n */\n async run(params: TextToImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToImageResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<TextToImageResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedTextToImageResponse;\n }\n\n /**\n * Create a text to image task; returns immediately with a task id.\n * @param params Text to image parameters.\n * @param options Per-request overrides.\n * @returns The task creation result.\n */\n async create(params: TextToImageParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\n validateParams(contract['text-to-image'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of a text to image task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current text to image task status.\n */\n async get(id: string, options?: RequestOptions): Promise<TextToImageResponse> {\n return this.http.request<TextToImageResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n","export const contract = {\n \"edit-image\": {\n \"models\": [\n \"seedream-4.5-edit\",\n \"seedream-5-lite-edit\",\n \"seedream-5-pro-edit\",\n \"seedream-v4-edit\"\n ],\n \"fields_by_model\": {\n \"seedream-4.5-edit\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"2:3\",\n \"3:2\",\n \"21:9\"\n ],\n \"required\": true\n },\n \"output_count\": {\n \"type\": \"integer\"\n },\n \"output_quality\": {\n \"enum\": [\n \"basic\",\n \"high\"\n ],\n \"required\": true\n },\n \"seed\": {\n \"type\": \"integer\"\n },\n \"source_image_urls\": {\n \"required\": true,\n \"min_items\": 1,\n \"max_items\": 14\n }\n },\n \"seedream-5-lite-edit\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"2:3\",\n \"3:2\",\n \"21:9\"\n ],\n \"required\": true\n },\n \"output_count\": {\n \"type\": \"integer\"\n },\n \"output_format\": {\n \"enum\": [\n \"png\",\n \"jpeg\"\n ]\n },\n \"output_quality\": {\n \"enum\": [\n \"basic\",\n \"high\"\n ],\n \"required\": true\n },\n \"seed\": {\n \"type\": \"integer\"\n },\n \"source_image_urls\": {\n \"required\": true,\n \"min_items\": 1,\n \"max_items\": 14\n }\n },\n \"seedream-5-pro-edit\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"2:3\",\n \"3:2\",\n \"21:9\"\n ],\n \"required\": true\n },\n \"output_format\": {\n \"enum\": [\n \"png\",\n \"jpeg\"\n ]\n },\n \"output_quality\": {\n \"enum\": [\n \"basic\",\n \"high\"\n ],\n \"required\": true\n },\n \"prompt\": {\n \"required\": true,\n \"min\": 3,\n \"max\": 5000,\n \"length\": true\n },\n \"source_image_urls\": {\n \"required\": true,\n \"min_items\": 1,\n \"max_items\": 10\n }\n },\n \"seedream-v4-edit\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"3:2\",\n \"2:3\",\n \"16:9\",\n \"9:16\",\n \"21:9\"\n ]\n },\n \"output_count\": {\n \"enum\": [\n 1,\n 2,\n 3,\n 4,\n 5,\n 6\n ],\n \"type\": \"integer\"\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\",\n \"2k\",\n \"4k\"\n ]\n },\n \"seed\": {\n \"type\": \"integer\"\n },\n \"source_image_urls\": {\n \"required\": true,\n \"min_items\": 1,\n \"max_items\": 10\n }\n }\n },\n \"rules\": [\n {\n \"when\": {\n \"model\": \"seedream-4.5-edit\"\n },\n \"forbidden\": [\n \"output_format\"\n ]\n },\n {\n \"when\": {\n \"model\": \"seedream-5-pro-edit\"\n },\n \"forbidden\": [\n \"output_resolution\",\n \"output_count\",\n \"seed\"\n ]\n },\n {\n \"when\": {\n \"model\": \"seedream-v4-edit\"\n },\n \"forbidden\": [\n \"output_format\"\n ]\n }\n ]\n },\n \"text-to-image\": {\n \"models\": [\n \"seedream-4.5-text-to-image\",\n \"seedream-5-lite-text-to-image\",\n \"seedream-5-pro-text-to-image\",\n \"seedream-v4-text-to-image\"\n ],\n \"fields_by_model\": {\n \"seedream-4.5-text-to-image\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"2:3\",\n \"3:2\",\n \"21:9\"\n ],\n \"required\": true\n },\n \"output_count\": {\n \"type\": \"integer\"\n },\n \"output_quality\": {\n \"enum\": [\n \"basic\",\n \"high\"\n ],\n \"required\": true\n },\n \"seed\": {\n \"type\": \"integer\"\n }\n },\n \"seedream-5-lite-text-to-image\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"2:3\",\n \"3:2\",\n \"21:9\"\n ],\n \"required\": true\n },\n \"output_count\": {\n \"type\": \"integer\"\n },\n \"output_format\": {\n \"enum\": [\n \"png\",\n \"jpeg\"\n ]\n },\n \"output_quality\": {\n \"enum\": [\n \"basic\",\n \"high\"\n ],\n \"required\": true\n },\n \"seed\": {\n \"type\": \"integer\"\n }\n },\n \"seedream-5-pro-text-to-image\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"2:3\",\n \"3:2\",\n \"21:9\"\n ],\n \"required\": true\n },\n \"output_format\": {\n \"enum\": [\n \"png\",\n \"jpeg\"\n ]\n },\n \"output_quality\": {\n \"enum\": [\n \"basic\",\n \"high\"\n ],\n \"required\": true\n },\n \"prompt\": {\n \"required\": true,\n \"min\": 3,\n \"max\": 5000,\n \"length\": true\n }\n },\n \"seedream-v4-text-to-image\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"3:2\",\n \"2:3\",\n \"16:9\",\n \"9:16\",\n \"21:9\"\n ]\n },\n \"output_count\": {\n \"enum\": [\n 1,\n 2,\n 3,\n 4,\n 5,\n 6\n ],\n \"type\": \"integer\"\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\",\n \"2k\",\n \"4k\"\n ]\n },\n \"seed\": {\n \"type\": \"integer\"\n }\n }\n },\n \"rules\": [\n {\n \"when\": {\n \"model\": \"seedream-4.5-text-to-image\"\n },\n \"forbidden\": [\n \"output_format\"\n ]\n },\n {\n \"when\": {\n \"model\": \"seedream-5-pro-text-to-image\"\n },\n \"forbidden\": [\n \"output_resolution\",\n \"output_count\",\n \"seed\"\n ]\n },\n {\n \"when\": {\n \"model\": \"seedream-v4-text-to-image\"\n },\n \"forbidden\": [\n \"output_format\"\n ]\n }\n ]\n }\n} as const;\n","import type { HttpClient, RequestOptions, PollingOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\nimport type {\n CompletedEditImageResponse,\n EditImageParams,\n EditImageResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/seedream/edit_image';\n\n/**\n * Modifies source images according to a text prompt.\n * 5 Pro and V4 accept up to 10 source images; 4.5 and 5-Lite accept up to 14.\n */\nexport class EditImage {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Create an edit image task and wait until complete.\n * @param params Edit image parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed edit image response.\n */\n async run(params: EditImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedEditImageResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<EditImageResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedEditImageResponse;\n }\n\n /**\n * Create an edit image task; returns immediately with a task id.\n * @param params Edit image parameters.\n * @param options Per-request overrides.\n * @returns The task creation result.\n */\n async create(params: EditImageParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\n validateParams(contract['edit-image'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of an edit image task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current edit image task status.\n */\n async get(id: string, options?: RequestOptions): Promise<EditImageResponse> {\n return this.http.request<EditImageResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,eAA+C;;;ACC/C,kBAA8C;AAC9C,sBAAkC;;;ACF3B,IAAM,WAAW;AAAA,EACtB,cAAc;AAAA,IACZ,UAAU;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB,qBAAqB;AAAA,QACnB,gBAAgB;AAAA,UACd,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,UACA,YAAY;AAAA,QACd;AAAA,QACA,gBAAgB;AAAA,UACd,QAAQ;AAAA,QACV;AAAA,QACA,kBAAkB;AAAA,UAChB,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,UACF;AAAA,UACA,YAAY;AAAA,QACd;AAAA,QACA,QAAQ;AAAA,UACN,QAAQ;AAAA,QACV;AAAA,QACA,qBAAqB;AAAA,UACnB,YAAY;AAAA,UACZ,aAAa;AAAA,UACb,aAAa;AAAA,QACf;AAAA,MACF;AAAA,MACA,wBAAwB;AAAA,QACtB,gBAAgB;AAAA,UACd,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,UACA,YAAY;AAAA,QACd;AAAA,QACA,gBAAgB;AAAA,UACd,QAAQ;AAAA,QACV;AAAA,Q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 +11,7 @@ var contract = {
|
|
|
11
11
|
"models": [
|
|
12
12
|
"seedream-4.5-edit",
|
|
13
13
|
"seedream-5-lite-edit",
|
|
14
|
+
"seedream-5-pro-edit",
|
|
14
15
|
"seedream-v4-edit"
|
|
15
16
|
],
|
|
16
17
|
"fields_by_model": {
|
|
@@ -42,7 +43,9 @@ var contract = {
|
|
|
42
43
|
"type": "integer"
|
|
43
44
|
},
|
|
44
45
|
"source_image_urls": {
|
|
45
|
-
"required": true
|
|
46
|
+
"required": true,
|
|
47
|
+
"min_items": 1,
|
|
48
|
+
"max_items": 14
|
|
46
49
|
}
|
|
47
50
|
},
|
|
48
51
|
"seedream-5-lite-edit": {
|
|
@@ -62,6 +65,12 @@ var contract = {
|
|
|
62
65
|
"output_count": {
|
|
63
66
|
"type": "integer"
|
|
64
67
|
},
|
|
68
|
+
"output_format": {
|
|
69
|
+
"enum": [
|
|
70
|
+
"png",
|
|
71
|
+
"jpeg"
|
|
72
|
+
]
|
|
73
|
+
},
|
|
65
74
|
"output_quality": {
|
|
66
75
|
"enum": [
|
|
67
76
|
"basic",
|
|
@@ -73,7 +82,48 @@ var contract = {
|
|
|
73
82
|
"type": "integer"
|
|
74
83
|
},
|
|
75
84
|
"source_image_urls": {
|
|
85
|
+
"required": true,
|
|
86
|
+
"min_items": 1,
|
|
87
|
+
"max_items": 14
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"seedream-5-pro-edit": {
|
|
91
|
+
"aspect_ratio": {
|
|
92
|
+
"enum": [
|
|
93
|
+
"1:1",
|
|
94
|
+
"4:3",
|
|
95
|
+
"3:4",
|
|
96
|
+
"16:9",
|
|
97
|
+
"9:16",
|
|
98
|
+
"2:3",
|
|
99
|
+
"3:2",
|
|
100
|
+
"21:9"
|
|
101
|
+
],
|
|
102
|
+
"required": true
|
|
103
|
+
},
|
|
104
|
+
"output_format": {
|
|
105
|
+
"enum": [
|
|
106
|
+
"png",
|
|
107
|
+
"jpeg"
|
|
108
|
+
]
|
|
109
|
+
},
|
|
110
|
+
"output_quality": {
|
|
111
|
+
"enum": [
|
|
112
|
+
"basic",
|
|
113
|
+
"high"
|
|
114
|
+
],
|
|
76
115
|
"required": true
|
|
116
|
+
},
|
|
117
|
+
"prompt": {
|
|
118
|
+
"required": true,
|
|
119
|
+
"min": 3,
|
|
120
|
+
"max": 5e3,
|
|
121
|
+
"length": true
|
|
122
|
+
},
|
|
123
|
+
"source_image_urls": {
|
|
124
|
+
"required": true,
|
|
125
|
+
"min_items": 1,
|
|
126
|
+
"max_items": 10
|
|
77
127
|
}
|
|
78
128
|
},
|
|
79
129
|
"seedream-v4-edit": {
|
|
@@ -111,15 +161,46 @@ var contract = {
|
|
|
111
161
|
"type": "integer"
|
|
112
162
|
},
|
|
113
163
|
"source_image_urls": {
|
|
114
|
-
"required": true
|
|
164
|
+
"required": true,
|
|
165
|
+
"min_items": 1,
|
|
166
|
+
"max_items": 10
|
|
115
167
|
}
|
|
116
168
|
}
|
|
117
|
-
}
|
|
169
|
+
},
|
|
170
|
+
"rules": [
|
|
171
|
+
{
|
|
172
|
+
"when": {
|
|
173
|
+
"model": "seedream-4.5-edit"
|
|
174
|
+
},
|
|
175
|
+
"forbidden": [
|
|
176
|
+
"output_format"
|
|
177
|
+
]
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"when": {
|
|
181
|
+
"model": "seedream-5-pro-edit"
|
|
182
|
+
},
|
|
183
|
+
"forbidden": [
|
|
184
|
+
"output_resolution",
|
|
185
|
+
"output_count",
|
|
186
|
+
"seed"
|
|
187
|
+
]
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"when": {
|
|
191
|
+
"model": "seedream-v4-edit"
|
|
192
|
+
},
|
|
193
|
+
"forbidden": [
|
|
194
|
+
"output_format"
|
|
195
|
+
]
|
|
196
|
+
}
|
|
197
|
+
]
|
|
118
198
|
},
|
|
119
199
|
"text-to-image": {
|
|
120
200
|
"models": [
|
|
121
201
|
"seedream-4.5-text-to-image",
|
|
122
202
|
"seedream-5-lite-text-to-image",
|
|
203
|
+
"seedream-5-pro-text-to-image",
|
|
123
204
|
"seedream-v4-text-to-image"
|
|
124
205
|
],
|
|
125
206
|
"fields_by_model": {
|
|
@@ -168,6 +249,12 @@ var contract = {
|
|
|
168
249
|
"output_count": {
|
|
169
250
|
"type": "integer"
|
|
170
251
|
},
|
|
252
|
+
"output_format": {
|
|
253
|
+
"enum": [
|
|
254
|
+
"png",
|
|
255
|
+
"jpeg"
|
|
256
|
+
]
|
|
257
|
+
},
|
|
171
258
|
"output_quality": {
|
|
172
259
|
"enum": [
|
|
173
260
|
"basic",
|
|
@@ -179,6 +266,40 @@ var contract = {
|
|
|
179
266
|
"type": "integer"
|
|
180
267
|
}
|
|
181
268
|
},
|
|
269
|
+
"seedream-5-pro-text-to-image": {
|
|
270
|
+
"aspect_ratio": {
|
|
271
|
+
"enum": [
|
|
272
|
+
"1:1",
|
|
273
|
+
"4:3",
|
|
274
|
+
"3:4",
|
|
275
|
+
"16:9",
|
|
276
|
+
"9:16",
|
|
277
|
+
"2:3",
|
|
278
|
+
"3:2",
|
|
279
|
+
"21:9"
|
|
280
|
+
],
|
|
281
|
+
"required": true
|
|
282
|
+
},
|
|
283
|
+
"output_format": {
|
|
284
|
+
"enum": [
|
|
285
|
+
"png",
|
|
286
|
+
"jpeg"
|
|
287
|
+
]
|
|
288
|
+
},
|
|
289
|
+
"output_quality": {
|
|
290
|
+
"enum": [
|
|
291
|
+
"basic",
|
|
292
|
+
"high"
|
|
293
|
+
],
|
|
294
|
+
"required": true
|
|
295
|
+
},
|
|
296
|
+
"prompt": {
|
|
297
|
+
"required": true,
|
|
298
|
+
"min": 3,
|
|
299
|
+
"max": 5e3,
|
|
300
|
+
"length": true
|
|
301
|
+
}
|
|
302
|
+
},
|
|
182
303
|
"seedream-v4-text-to-image": {
|
|
183
304
|
"aspect_ratio": {
|
|
184
305
|
"enum": [
|
|
@@ -214,7 +335,35 @@ var contract = {
|
|
|
214
335
|
"type": "integer"
|
|
215
336
|
}
|
|
216
337
|
}
|
|
217
|
-
}
|
|
338
|
+
},
|
|
339
|
+
"rules": [
|
|
340
|
+
{
|
|
341
|
+
"when": {
|
|
342
|
+
"model": "seedream-4.5-text-to-image"
|
|
343
|
+
},
|
|
344
|
+
"forbidden": [
|
|
345
|
+
"output_format"
|
|
346
|
+
]
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
"when": {
|
|
350
|
+
"model": "seedream-5-pro-text-to-image"
|
|
351
|
+
},
|
|
352
|
+
"forbidden": [
|
|
353
|
+
"output_resolution",
|
|
354
|
+
"output_count",
|
|
355
|
+
"seed"
|
|
356
|
+
]
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
"when": {
|
|
360
|
+
"model": "seedream-v4-text-to-image"
|
|
361
|
+
},
|
|
362
|
+
"forbidden": [
|
|
363
|
+
"output_format"
|
|
364
|
+
]
|
|
365
|
+
}
|
|
366
|
+
]
|
|
218
367
|
}
|
|
219
368
|
};
|
|
220
369
|
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/client.ts","../src/resources/text-to-image.ts","../src/contract_gen.ts","../src/resources/edit-image.ts","../src/index.ts"],"sourcesContent":["import { BaseClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToImage } from './resources/text-to-image';\nimport { EditImage } from './resources/edit-image';\n\n/**\n * Seedream image generation and editing API client.\n *\n * Three model families with different field requirements:\n * - **4.5**: requires `aspect_ratio` and `output_quality`\n * - **5-lite**: same required fields as 4.5, faster generation\n * - **V4**: uses `output_resolution` instead; supports `seed` and batch `output_count`\n *\n * @example\n * ```typescript\n * const client = new SeedreamClient({ apiKey: 'your-api-key' });\n *\n * // Seedream 4.5\n * const result = await client.textToImage.run({\n * model: 'seedream-4.5-text-to-image',\n * prompt: 'A beautiful product render',\n * aspect_ratio: '16:9',\n * output_quality: 'high',\n * });\n *\n * // Seedream V4 with batch output\n * const batch = await client.textToImage.run({\n * model: 'seedream-v4-text-to-image',\n * prompt: 'Minimalist logo design',\n * output_count: 4,\n * });\n * ```\n */\nexport class SeedreamClient extends BaseClient {\n /** Text-to-image generation across Seedream model versions. */\n public readonly textToImage: TextToImage;\n /** Edit source images according to a text prompt. */\n public readonly editImage: EditImage;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.textToImage = new TextToImage(this.http);\n this.editImage = new EditImage(this.http);\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\nimport type {\n CompletedTextToImageResponse,\n TextToImageParams,\n TextToImageResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/seedream/text_to_image';\n\n/**\n * Generates images from text prompts across Seedream model versions.\n * Field requirements vary by model family: 4.5/5-lite require `aspect_ratio`\n * and `output_quality`; V4 uses `output_resolution` and supports `seed`/`output_count`.\n */\nexport class TextToImage {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Create a text to image task and wait until complete.\n * @param params Text to image parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed text to image response.\n */\n async run(params: TextToImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToImageResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<TextToImageResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedTextToImageResponse;\n }\n\n /**\n * Create a text to image task; returns immediately with a task id.\n * @param params Text to image parameters.\n * @param options Per-request overrides.\n * @returns The task creation result.\n */\n async create(params: TextToImageParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\n validateParams(contract['text-to-image'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of a text to image task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current text to image task status.\n */\n async get(id: string, options?: RequestOptions): Promise<TextToImageResponse> {\n return this.http.request<TextToImageResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n","export const contract = {\n \"edit-image\": {\n \"models\": [\n \"seedream-4.5-edit\",\n \"seedream-5-lite-edit\",\n \"seedream-v4-edit\"\n ],\n \"fields_by_model\": {\n \"seedream-4.5-edit\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"2:3\",\n \"3:2\",\n \"21:9\"\n ],\n \"required\": true\n },\n \"output_count\": {\n \"type\": \"integer\"\n },\n \"output_quality\": {\n \"enum\": [\n \"basic\",\n \"high\"\n ],\n \"required\": true\n },\n \"seed\": {\n \"type\": \"integer\"\n },\n \"source_image_urls\": {\n \"required\": true\n }\n },\n \"seedream-5-lite-edit\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"2:3\",\n \"3:2\",\n \"21:9\"\n ],\n \"required\": true\n },\n \"output_count\": {\n \"type\": \"integer\"\n },\n \"output_quality\": {\n \"enum\": [\n \"basic\",\n \"high\"\n ],\n \"required\": true\n },\n \"seed\": {\n \"type\": \"integer\"\n },\n \"source_image_urls\": {\n \"required\": true\n }\n },\n \"seedream-v4-edit\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"3:2\",\n \"2:3\",\n \"16:9\",\n \"9:16\",\n \"21:9\"\n ]\n },\n \"output_count\": {\n \"enum\": [\n 1,\n 2,\n 3,\n 4,\n 5,\n 6\n ],\n \"type\": \"integer\"\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\",\n \"2k\",\n \"4k\"\n ]\n },\n \"seed\": {\n \"type\": \"integer\"\n },\n \"source_image_urls\": {\n \"required\": true\n }\n }\n }\n },\n \"text-to-image\": {\n \"models\": [\n \"seedream-4.5-text-to-image\",\n \"seedream-5-lite-text-to-image\",\n \"seedream-v4-text-to-image\"\n ],\n \"fields_by_model\": {\n \"seedream-4.5-text-to-image\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"2:3\",\n \"3:2\",\n \"21:9\"\n ],\n \"required\": true\n },\n \"output_count\": {\n \"type\": \"integer\"\n },\n \"output_quality\": {\n \"enum\": [\n \"basic\",\n \"high\"\n ],\n \"required\": true\n },\n \"seed\": {\n \"type\": \"integer\"\n }\n },\n \"seedream-5-lite-text-to-image\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"2:3\",\n \"3:2\",\n \"21:9\"\n ],\n \"required\": true\n },\n \"output_count\": {\n \"type\": \"integer\"\n },\n \"output_quality\": {\n \"enum\": [\n \"basic\",\n \"high\"\n ],\n \"required\": true\n },\n \"seed\": {\n \"type\": \"integer\"\n }\n },\n \"seedream-v4-text-to-image\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"3:2\",\n \"2:3\",\n \"16:9\",\n \"9:16\",\n \"21:9\"\n ]\n },\n \"output_count\": {\n \"enum\": [\n 1,\n 2,\n 3,\n 4,\n 5,\n 6\n ],\n \"type\": \"integer\"\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\",\n \"2k\",\n \"4k\"\n ]\n },\n \"seed\": {\n \"type\": \"integer\"\n }\n }\n }\n }\n} as const;\n","import type { HttpClient, RequestOptions, PollingOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\nimport type {\n CompletedEditImageResponse,\n EditImageParams,\n EditImageResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/seedream/edit_image';\n\n/**\n * Modifies source images according to a text prompt.\n * V4 models accept up to 10 source images; 4.5 and 5-lite accept up to 14.\n */\nexport class EditImage {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Create an edit image task and wait until complete.\n * @param params Edit image parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed edit image response.\n */\n async run(params: EditImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedEditImageResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<EditImageResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedEditImageResponse;\n }\n\n /**\n * Create an edit image task; returns immediately with a task id.\n * @param params Edit image parameters.\n * @param options Per-request overrides.\n * @returns The task creation result.\n */\n async create(params: EditImageParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\n validateParams(contract['edit-image'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of an edit image task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current edit image task status.\n */\n async get(id: string, options?: RequestOptions): Promise<EditImageResponse> {\n return this.http.request<EditImageResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n","export { SeedreamClient } from './client';\nexport * from './types';\n\nexport {\n RunApiError,\n AuthenticationError,\n InsufficientCreditsError,\n NotFoundError,\n ValidationError,\n RateLimitError,\n ServiceUnavailableError,\n NetworkError,\n TimeoutError,\n TaskTimeoutError,\n TaskFailedError,\n} from '@runapi.ai/core';\n"],"mappings":";AAAA,SAAS,kBAAsC;;;ACC/C,SAAS,eAAe,sBAAsB;AAC9C,SAAS,yBAAyB;;;ACF3B,IAAM,WAAW;AAAA,EACtB,cAAc;AAAA,IACZ,UAAU;AAAA,MACR;AAAA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A;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":["compactParams","validateParams","pollUntilComplete","ENDPOINT","pollUntilComplete","compactParams","validateParams"]}
|
|
1
|
+
{"version":3,"sources":["../src/client.ts","../src/resources/text-to-image.ts","../src/contract_gen.ts","../src/resources/edit-image.ts","../src/index.ts"],"sourcesContent":["import { BaseClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToImage } from './resources/text-to-image';\nimport { EditImage } from './resources/edit-image';\n\n/**\n * Seedream image generation and editing API client.\n *\n * Three model families with different field requirements:\n * - **4.5**: requires `aspect_ratio` and `output_quality`\n * - **5-lite**: same required fields as 4.5, faster generation\n * - **V4**: uses `output_resolution` instead; supports `seed` and batch `output_count`\n *\n * @example\n * ```typescript\n * const client = new SeedreamClient({ apiKey: 'your-api-key' });\n *\n * // Seedream 4.5\n * const result = await client.textToImage.run({\n * model: 'seedream-4.5-text-to-image',\n * prompt: 'A beautiful product render',\n * aspect_ratio: '16:9',\n * output_quality: 'high',\n * });\n *\n * // Seedream V4 with batch output\n * const batch = await client.textToImage.run({\n * model: 'seedream-v4-text-to-image',\n * prompt: 'Minimalist logo design',\n * output_count: 4,\n * });\n * ```\n */\nexport class SeedreamClient extends BaseClient {\n /** Text-to-image generation across Seedream model versions. */\n public readonly textToImage: TextToImage;\n /** Edit source images according to a text prompt. */\n public readonly editImage: EditImage;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.textToImage = new TextToImage(this.http);\n this.editImage = new EditImage(this.http);\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\nimport type {\n CompletedTextToImageResponse,\n TextToImageParams,\n TextToImageResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/seedream/text_to_image';\n\n/**\n * Generates images from text prompts across Seedream model versions.\n * Field requirements vary by model family: 4.5/5-Lite/5 Pro require\n * `aspect_ratio` and `output_quality`; V4 uses `output_resolution` and supports\n * `seed`/`output_count`.\n */\nexport class TextToImage {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Create a text to image task and wait until complete.\n * @param params Text to image parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed text to image response.\n */\n async run(params: TextToImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToImageResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<TextToImageResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedTextToImageResponse;\n }\n\n /**\n * Create a text to image task; returns immediately with a task id.\n * @param params Text to image parameters.\n * @param options Per-request overrides.\n * @returns The task creation result.\n */\n async create(params: TextToImageParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\n validateParams(contract['text-to-image'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of a text to image task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current text to image task status.\n */\n async get(id: string, options?: RequestOptions): Promise<TextToImageResponse> {\n return this.http.request<TextToImageResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n","export const contract = {\n \"edit-image\": {\n \"models\": [\n \"seedream-4.5-edit\",\n \"seedream-5-lite-edit\",\n \"seedream-5-pro-edit\",\n \"seedream-v4-edit\"\n ],\n \"fields_by_model\": {\n \"seedream-4.5-edit\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"2:3\",\n \"3:2\",\n \"21:9\"\n ],\n \"required\": true\n },\n \"output_count\": {\n \"type\": \"integer\"\n },\n \"output_quality\": {\n \"enum\": [\n \"basic\",\n \"high\"\n ],\n \"required\": true\n },\n \"seed\": {\n \"type\": \"integer\"\n },\n \"source_image_urls\": {\n \"required\": true,\n \"min_items\": 1,\n \"max_items\": 14\n }\n },\n \"seedream-5-lite-edit\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"2:3\",\n \"3:2\",\n \"21:9\"\n ],\n \"required\": true\n },\n \"output_count\": {\n \"type\": \"integer\"\n },\n \"output_format\": {\n \"enum\": [\n \"png\",\n \"jpeg\"\n ]\n },\n \"output_quality\": {\n \"enum\": [\n \"basic\",\n \"high\"\n ],\n \"required\": true\n },\n \"seed\": {\n \"type\": \"integer\"\n },\n \"source_image_urls\": {\n \"required\": true,\n \"min_items\": 1,\n \"max_items\": 14\n }\n },\n \"seedream-5-pro-edit\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"2:3\",\n \"3:2\",\n \"21:9\"\n ],\n \"required\": true\n },\n \"output_format\": {\n \"enum\": [\n \"png\",\n \"jpeg\"\n ]\n },\n \"output_quality\": {\n \"enum\": [\n \"basic\",\n \"high\"\n ],\n \"required\": true\n },\n \"prompt\": {\n \"required\": true,\n \"min\": 3,\n \"max\": 5000,\n \"length\": true\n },\n \"source_image_urls\": {\n \"required\": true,\n \"min_items\": 1,\n \"max_items\": 10\n }\n },\n \"seedream-v4-edit\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"3:2\",\n \"2:3\",\n \"16:9\",\n \"9:16\",\n \"21:9\"\n ]\n },\n \"output_count\": {\n \"enum\": [\n 1,\n 2,\n 3,\n 4,\n 5,\n 6\n ],\n \"type\": \"integer\"\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\",\n \"2k\",\n \"4k\"\n ]\n },\n \"seed\": {\n \"type\": \"integer\"\n },\n \"source_image_urls\": {\n \"required\": true,\n \"min_items\": 1,\n \"max_items\": 10\n }\n }\n },\n \"rules\": [\n {\n \"when\": {\n \"model\": \"seedream-4.5-edit\"\n },\n \"forbidden\": [\n \"output_format\"\n ]\n },\n {\n \"when\": {\n \"model\": \"seedream-5-pro-edit\"\n },\n \"forbidden\": [\n \"output_resolution\",\n \"output_count\",\n \"seed\"\n ]\n },\n {\n \"when\": {\n \"model\": \"seedream-v4-edit\"\n },\n \"forbidden\": [\n \"output_format\"\n ]\n }\n ]\n },\n \"text-to-image\": {\n \"models\": [\n \"seedream-4.5-text-to-image\",\n \"seedream-5-lite-text-to-image\",\n \"seedream-5-pro-text-to-image\",\n \"seedream-v4-text-to-image\"\n ],\n \"fields_by_model\": {\n \"seedream-4.5-text-to-image\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"2:3\",\n \"3:2\",\n \"21:9\"\n ],\n \"required\": true\n },\n \"output_count\": {\n \"type\": \"integer\"\n },\n \"output_quality\": {\n \"enum\": [\n \"basic\",\n \"high\"\n ],\n \"required\": true\n },\n \"seed\": {\n \"type\": \"integer\"\n }\n },\n \"seedream-5-lite-text-to-image\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"2:3\",\n \"3:2\",\n \"21:9\"\n ],\n \"required\": true\n },\n \"output_count\": {\n \"type\": \"integer\"\n },\n \"output_format\": {\n \"enum\": [\n \"png\",\n \"jpeg\"\n ]\n },\n \"output_quality\": {\n \"enum\": [\n \"basic\",\n \"high\"\n ],\n \"required\": true\n },\n \"seed\": {\n \"type\": \"integer\"\n }\n },\n \"seedream-5-pro-text-to-image\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"2:3\",\n \"3:2\",\n \"21:9\"\n ],\n \"required\": true\n },\n \"output_format\": {\n \"enum\": [\n \"png\",\n \"jpeg\"\n ]\n },\n \"output_quality\": {\n \"enum\": [\n \"basic\",\n \"high\"\n ],\n \"required\": true\n },\n \"prompt\": {\n \"required\": true,\n \"min\": 3,\n \"max\": 5000,\n \"length\": true\n }\n },\n \"seedream-v4-text-to-image\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"3:2\",\n \"2:3\",\n \"16:9\",\n \"9:16\",\n \"21:9\"\n ]\n },\n \"output_count\": {\n \"enum\": [\n 1,\n 2,\n 3,\n 4,\n 5,\n 6\n ],\n \"type\": \"integer\"\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\",\n \"2k\",\n \"4k\"\n ]\n },\n \"seed\": {\n \"type\": \"integer\"\n }\n }\n },\n \"rules\": [\n {\n \"when\": {\n \"model\": \"seedream-4.5-text-to-image\"\n },\n \"forbidden\": [\n \"output_format\"\n ]\n },\n {\n \"when\": {\n \"model\": \"seedream-5-pro-text-to-image\"\n },\n \"forbidden\": [\n \"output_resolution\",\n \"output_count\",\n \"seed\"\n ]\n },\n {\n \"when\": {\n \"model\": \"seedream-v4-text-to-image\"\n },\n \"forbidden\": [\n \"output_format\"\n ]\n }\n ]\n }\n} as const;\n","import type { HttpClient, RequestOptions, PollingOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\nimport type {\n CompletedEditImageResponse,\n EditImageParams,\n EditImageResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/seedream/edit_image';\n\n/**\n * Modifies source images according to a text prompt.\n * 5 Pro and V4 accept up to 10 source images; 4.5 and 5-Lite accept up to 14.\n */\nexport class EditImage {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Create an edit image task and wait until complete.\n * @param params Edit image parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed edit image response.\n */\n async run(params: EditImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedEditImageResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<EditImageResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedEditImageResponse;\n }\n\n /**\n * Create an edit image task; returns immediately with a task id.\n * @param params Edit image parameters.\n * @param options Per-request overrides.\n * @returns The task creation result.\n */\n async create(params: EditImageParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\n validateParams(contract['edit-image'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of an edit image task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current edit image task status.\n */\n async get(id: string, options?: RequestOptions): Promise<EditImageResponse> {\n return this.http.request<EditImageResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n","export { SeedreamClient } from './client';\nexport * from './types';\n\nexport {\n RunApiError,\n AuthenticationError,\n InsufficientCreditsError,\n NotFoundError,\n ValidationError,\n RateLimitError,\n ServiceUnavailableError,\n NetworkError,\n TimeoutError,\n TaskTimeoutError,\n TaskFailedError,\n} from '@runapi.ai/core';\n"],"mappings":";AAAA,SAAS,kBAAsC;;;ACC/C,SAAS,eAAe,sBAAsB;AAC9C,SAAS,yBAAyB;;;ACF3B,IAAM,WAAW;AAAA,EACtB,cAAc;AAAA,IACZ,UAAU;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB,qBAAqB;AAAA,QACnB,gBAAgB;AAAA,UACd,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,UACA,YAAY;AAAA,QACd;AAAA,QACA,gBAAgB;AAAA,UACd,QAAQ;AAAA,QACV;AAAA,QACA,kB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AA;AAAA;AAAA;AAAA,EAQA,MAAM,IAAI,IAAY,SAAsD;AAC1E,WAAO,KAAK,KAAK,QAA2B,OAAO,GAAGA,SAAQ,IAAI,EAAE,IAAI;AAAA,MACtE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;AH7BO,IAAM,iBAAN,cAA6B,WAAW;AAAA;AAAA,EAE7B;AAAA;AAAA,EAEA;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO;AACb,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAC5C,SAAK,YAAY,IAAI,UAAU,KAAK,IAAI;AAAA,EAC1C;AACF;;;AIxCA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":["compactParams","validateParams","pollUntilComplete","ENDPOINT","pollUntilComplete","compactParams","validateParams"]}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"runapi": {
|
|
4
4
|
"slug": "seedream"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.2.
|
|
6
|
+
"version": "0.2.10",
|
|
7
7
|
"description": "RunAPI Seedream SDK for text-to-image and edit-image workflows in JavaScript, Python, Ruby, Go, Java, and PHP",
|
|
8
8
|
"main": "./dist/index.js",
|
|
9
9
|
"module": "./dist/index.mjs",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"clean": "rm -rf dist"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@runapi.ai/core": "^0.2.
|
|
34
|
+
"@runapi.ai/core": "^0.2.14"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "^20.0.0",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
</div>
|
|
22
22
|
<br/>
|
|
23
23
|
|
|
24
|
-
Generate and edit images with Seedream v4, 4.5, and 5
|
|
24
|
+
Generate and edit images with Seedream v4, 4.5, 5 Lite, and 5 Pro text-to-image and image editing. This skill helps Claude Code, Codex, Gemini CLI, Cursor, and 50+ agents integrate Seedream through RunAPI.
|
|
25
25
|
|
|
26
26
|
The canonical agent file is `skills/seedream/SKILL.md`.
|
|
27
27
|
|
|
@@ -75,6 +75,8 @@ const url = result.images[0].url;
|
|
|
75
75
|
- [4.5 edit](https://runapi.ai/models/seedream/4.5-edit)
|
|
76
76
|
- [5 lite text to image](https://runapi.ai/models/seedream/5-lite-text-to-image)
|
|
77
77
|
- [5 lite edit](https://runapi.ai/models/seedream/5-lite-edit)
|
|
78
|
+
- [5 pro text to image](https://runapi.ai/models/seedream/5-pro-text-to-image)
|
|
79
|
+
- [5 pro edit](https://runapi.ai/models/seedream/5-pro-edit)
|
|
78
80
|
- [v4 text to image](https://runapi.ai/models/seedream/v4-text-to-image)
|
|
79
81
|
- [v4 edit](https://runapi.ai/models/seedream/v4-edit)
|
|
80
82
|
|
package/skills/seedream/SKILL.md
CHANGED
|
@@ -106,5 +106,7 @@ RunAPI-generated file URLs are temporary. Download and store generated images, v
|
|
|
106
106
|
- [4.5 edit](https://runapi.ai/models/seedream/4.5-edit.md)
|
|
107
107
|
- [5 lite text to image](https://runapi.ai/models/seedream/5-lite-text-to-image.md)
|
|
108
108
|
- [5 lite edit](https://runapi.ai/models/seedream/5-lite-edit.md)
|
|
109
|
+
- [5 pro text to image](https://runapi.ai/models/seedream/5-pro-text-to-image.md)
|
|
110
|
+
- [5 pro edit](https://runapi.ai/models/seedream/5-pro-edit.md)
|
|
109
111
|
- [v4 text to image](https://runapi.ai/models/seedream/v4-text-to-image.md)
|
|
110
112
|
- [v4 edit](https://runapi.ai/models/seedream/v4-edit.md)
|