@runapi.ai/seedream 0.2.7 → 0.2.9

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 CHANGED
@@ -1,8 +1,8 @@
1
- # Seedream API JavaScript SDK for RunAPI
1
+ # Seedream JavaScript SDK for RunAPI
2
2
 
3
- The seedream api JavaScript SDK is the language-specific package for Seedream on RunAPI. Use this seedream api package for text-to-image, image editing, and creative production flows when your application needs JSON request bodies, task status lookup, and consistent RunAPI errors in JavaScript.
3
+ The Seedream JavaScript SDK is the language-specific package for Seedream on RunAPI. Use this package for image generation, image editing, and creative production workflows when your application needs request bodies, task status lookup, and consistent RunAPI errors in JavaScript.
4
4
 
5
- This seedream api README is the JavaScript package guide inside the public `seedream-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/seedream; for API reference, use https://runapi.ai/docs#seedream; for SDK docs, use https://runapi.ai/docs#sdk-seedream.
5
+ This README is the JavaScript package guide inside the public `seedream-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/seedream; for API reference, use https://runapi.ai/docs#seedream; for SDK docs, use https://runapi.ai/docs#sdk-seedream.
6
6
 
7
7
  ## Install
8
8
 
@@ -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-lite models. */
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-lite models.
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-lite require `aspect_ratio`
103
- * and `output_quality`; V4 uses `output_resolution` and supports `seed`/`output_count`.
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 models accept up to 10 source images; 4.5 and 5-lite accept up to 14.
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-lite models. */
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-lite models.
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-lite require `aspect_ratio`
103
- * and `output_quality`; V4 uses `output_resolution` and supports `seed`/`output_count`.
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 models accept up to 10 source images; 4.5 and 5-lite accept up to 14.
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
@@ -41,6 +41,362 @@ var import_core3 = require("@runapi.ai/core");
41
41
  // src/resources/text-to-image.ts
42
42
  var import_core = require("@runapi.ai/core");
43
43
  var import_internal = require("@runapi.ai/core/internal");
44
+
45
+ // src/contract_gen.ts
46
+ var contract = {
47
+ "edit-image": {
48
+ "models": [
49
+ "seedream-4.5-edit",
50
+ "seedream-5-lite-edit",
51
+ "seedream-5-pro-edit",
52
+ "seedream-v4-edit"
53
+ ],
54
+ "fields_by_model": {
55
+ "seedream-4.5-edit": {
56
+ "aspect_ratio": {
57
+ "enum": [
58
+ "1:1",
59
+ "4:3",
60
+ "3:4",
61
+ "16:9",
62
+ "9:16",
63
+ "2:3",
64
+ "3:2",
65
+ "21:9"
66
+ ],
67
+ "required": true
68
+ },
69
+ "output_count": {
70
+ "type": "integer"
71
+ },
72
+ "output_quality": {
73
+ "enum": [
74
+ "basic",
75
+ "high"
76
+ ],
77
+ "required": true
78
+ },
79
+ "seed": {
80
+ "type": "integer"
81
+ },
82
+ "source_image_urls": {
83
+ "required": true
84
+ }
85
+ },
86
+ "seedream-5-lite-edit": {
87
+ "aspect_ratio": {
88
+ "enum": [
89
+ "1:1",
90
+ "4:3",
91
+ "3:4",
92
+ "16:9",
93
+ "9:16",
94
+ "2:3",
95
+ "3:2",
96
+ "21:9"
97
+ ],
98
+ "required": true
99
+ },
100
+ "output_count": {
101
+ "type": "integer"
102
+ },
103
+ "output_format": {
104
+ "enum": [
105
+ "png",
106
+ "jpeg"
107
+ ]
108
+ },
109
+ "output_quality": {
110
+ "enum": [
111
+ "basic",
112
+ "high"
113
+ ],
114
+ "required": true
115
+ },
116
+ "seed": {
117
+ "type": "integer"
118
+ },
119
+ "source_image_urls": {
120
+ "required": true
121
+ }
122
+ },
123
+ "seedream-5-pro-edit": {
124
+ "aspect_ratio": {
125
+ "enum": [
126
+ "1:1",
127
+ "4:3",
128
+ "3:4",
129
+ "16:9",
130
+ "9:16",
131
+ "2:3",
132
+ "3:2",
133
+ "21:9"
134
+ ],
135
+ "required": true
136
+ },
137
+ "output_format": {
138
+ "enum": [
139
+ "png",
140
+ "jpeg"
141
+ ]
142
+ },
143
+ "output_quality": {
144
+ "enum": [
145
+ "basic",
146
+ "high"
147
+ ],
148
+ "required": true
149
+ },
150
+ "prompt": {
151
+ "required": true,
152
+ "min": 3,
153
+ "max": 5e3,
154
+ "length": true
155
+ },
156
+ "source_image_urls": {
157
+ "required": true
158
+ }
159
+ },
160
+ "seedream-v4-edit": {
161
+ "aspect_ratio": {
162
+ "enum": [
163
+ "1:1",
164
+ "4:3",
165
+ "3:4",
166
+ "3:2",
167
+ "2:3",
168
+ "16:9",
169
+ "9:16",
170
+ "21:9"
171
+ ]
172
+ },
173
+ "output_count": {
174
+ "enum": [
175
+ 1,
176
+ 2,
177
+ 3,
178
+ 4,
179
+ 5,
180
+ 6
181
+ ],
182
+ "type": "integer"
183
+ },
184
+ "output_resolution": {
185
+ "enum": [
186
+ "1k",
187
+ "2k",
188
+ "4k"
189
+ ]
190
+ },
191
+ "seed": {
192
+ "type": "integer"
193
+ },
194
+ "source_image_urls": {
195
+ "required": true
196
+ }
197
+ }
198
+ },
199
+ "rules": [
200
+ {
201
+ "when": {
202
+ "model": "seedream-4.5-edit"
203
+ },
204
+ "forbidden": [
205
+ "output_format"
206
+ ]
207
+ },
208
+ {
209
+ "when": {
210
+ "model": "seedream-5-pro-edit"
211
+ },
212
+ "forbidden": [
213
+ "output_resolution",
214
+ "output_count",
215
+ "seed"
216
+ ]
217
+ },
218
+ {
219
+ "when": {
220
+ "model": "seedream-v4-edit"
221
+ },
222
+ "forbidden": [
223
+ "output_format"
224
+ ]
225
+ }
226
+ ]
227
+ },
228
+ "text-to-image": {
229
+ "models": [
230
+ "seedream-4.5-text-to-image",
231
+ "seedream-5-lite-text-to-image",
232
+ "seedream-5-pro-text-to-image",
233
+ "seedream-v4-text-to-image"
234
+ ],
235
+ "fields_by_model": {
236
+ "seedream-4.5-text-to-image": {
237
+ "aspect_ratio": {
238
+ "enum": [
239
+ "1:1",
240
+ "4:3",
241
+ "3:4",
242
+ "16:9",
243
+ "9:16",
244
+ "2:3",
245
+ "3:2",
246
+ "21:9"
247
+ ],
248
+ "required": true
249
+ },
250
+ "output_count": {
251
+ "type": "integer"
252
+ },
253
+ "output_quality": {
254
+ "enum": [
255
+ "basic",
256
+ "high"
257
+ ],
258
+ "required": true
259
+ },
260
+ "seed": {
261
+ "type": "integer"
262
+ }
263
+ },
264
+ "seedream-5-lite-text-to-image": {
265
+ "aspect_ratio": {
266
+ "enum": [
267
+ "1:1",
268
+ "4:3",
269
+ "3:4",
270
+ "16:9",
271
+ "9:16",
272
+ "2:3",
273
+ "3:2",
274
+ "21:9"
275
+ ],
276
+ "required": true
277
+ },
278
+ "output_count": {
279
+ "type": "integer"
280
+ },
281
+ "output_format": {
282
+ "enum": [
283
+ "png",
284
+ "jpeg"
285
+ ]
286
+ },
287
+ "output_quality": {
288
+ "enum": [
289
+ "basic",
290
+ "high"
291
+ ],
292
+ "required": true
293
+ },
294
+ "seed": {
295
+ "type": "integer"
296
+ }
297
+ },
298
+ "seedream-5-pro-text-to-image": {
299
+ "aspect_ratio": {
300
+ "enum": [
301
+ "1:1",
302
+ "4:3",
303
+ "3:4",
304
+ "16:9",
305
+ "9:16",
306
+ "2:3",
307
+ "3:2",
308
+ "21:9"
309
+ ],
310
+ "required": true
311
+ },
312
+ "output_format": {
313
+ "enum": [
314
+ "png",
315
+ "jpeg"
316
+ ]
317
+ },
318
+ "output_quality": {
319
+ "enum": [
320
+ "basic",
321
+ "high"
322
+ ],
323
+ "required": true
324
+ },
325
+ "prompt": {
326
+ "required": true,
327
+ "min": 3,
328
+ "max": 5e3,
329
+ "length": true
330
+ }
331
+ },
332
+ "seedream-v4-text-to-image": {
333
+ "aspect_ratio": {
334
+ "enum": [
335
+ "1:1",
336
+ "4:3",
337
+ "3:4",
338
+ "3:2",
339
+ "2:3",
340
+ "16:9",
341
+ "9:16",
342
+ "21:9"
343
+ ]
344
+ },
345
+ "output_count": {
346
+ "enum": [
347
+ 1,
348
+ 2,
349
+ 3,
350
+ 4,
351
+ 5,
352
+ 6
353
+ ],
354
+ "type": "integer"
355
+ },
356
+ "output_resolution": {
357
+ "enum": [
358
+ "1k",
359
+ "2k",
360
+ "4k"
361
+ ]
362
+ },
363
+ "seed": {
364
+ "type": "integer"
365
+ }
366
+ }
367
+ },
368
+ "rules": [
369
+ {
370
+ "when": {
371
+ "model": "seedream-4.5-text-to-image"
372
+ },
373
+ "forbidden": [
374
+ "output_format"
375
+ ]
376
+ },
377
+ {
378
+ "when": {
379
+ "model": "seedream-5-pro-text-to-image"
380
+ },
381
+ "forbidden": [
382
+ "output_resolution",
383
+ "output_count",
384
+ "seed"
385
+ ]
386
+ },
387
+ {
388
+ "when": {
389
+ "model": "seedream-v4-text-to-image"
390
+ },
391
+ "forbidden": [
392
+ "output_format"
393
+ ]
394
+ }
395
+ ]
396
+ }
397
+ };
398
+
399
+ // src/resources/text-to-image.ts
44
400
  var ENDPOINT = "/api/v1/seedream/text_to_image";
45
401
  var TextToImage = class {
46
402
  constructor(http) {
@@ -68,8 +424,10 @@ var TextToImage = class {
68
424
  * @returns The task creation result.
69
425
  */
70
426
  async create(params, options) {
427
+ const body = (0, import_core.compactParams)(params);
428
+ (0, import_core.validateParams)(contract["text-to-image"], body);
71
429
  return this.http.request("POST", ENDPOINT, {
72
- body: (0, import_core.compactParams)(params),
430
+ body,
73
431
  ...options
74
432
  });
75
433
  }
@@ -116,8 +474,10 @@ var EditImage = class {
116
474
  * @returns The task creation result.
117
475
  */
118
476
  async create(params, options) {
477
+ const body = (0, import_core2.compactParams)(params);
478
+ (0, import_core2.validateParams)(contract["edit-image"], body);
119
479
  return this.http.request("POST", ENDPOINT2, {
120
- body: (0, import_core2.compactParams)(params),
480
+ body,
121
481
  ...options
122
482
  });
123
483
  }
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/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 } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\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 return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\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","import type { HttpClient, RequestOptions, PollingOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\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 return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\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,kBAA8B;AAC9B,sBAAkC;AAQlC,IAAM,WAAW;AAOV,IAAM,cAAN,MAAkB;AAAA,EACvB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ7B,MAAM,IAAI,QAA2B,SAAkF;AACrH,UAAM,EAAE,GAAG,IAAI,MAAM,KAAK,OAAO,QAAQ,OAAO;AAChD,UAAM,WAAW,UAAM,mCAAuC,MAAM,KAAK,IAAI,IAAI,OAAO,GAAG;AAAA,MACzF,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AACD,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,OAAO,QAA2B,SAAuD;AAC7F,WAAO,KAAK,KAAK,QAA4B,QAAQ,UAAU;AAAA,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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 }\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 }\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 }\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 \"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;AAA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AI;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"]}
package/dist/index.mjs CHANGED
@@ -2,8 +2,364 @@
2
2
  import { BaseClient } from "@runapi.ai/core";
3
3
 
4
4
  // src/resources/text-to-image.ts
5
- import { compactParams } from "@runapi.ai/core";
5
+ import { compactParams, validateParams } from "@runapi.ai/core";
6
6
  import { pollUntilComplete } from "@runapi.ai/core/internal";
7
+
8
+ // src/contract_gen.ts
9
+ var contract = {
10
+ "edit-image": {
11
+ "models": [
12
+ "seedream-4.5-edit",
13
+ "seedream-5-lite-edit",
14
+ "seedream-5-pro-edit",
15
+ "seedream-v4-edit"
16
+ ],
17
+ "fields_by_model": {
18
+ "seedream-4.5-edit": {
19
+ "aspect_ratio": {
20
+ "enum": [
21
+ "1:1",
22
+ "4:3",
23
+ "3:4",
24
+ "16:9",
25
+ "9:16",
26
+ "2:3",
27
+ "3:2",
28
+ "21:9"
29
+ ],
30
+ "required": true
31
+ },
32
+ "output_count": {
33
+ "type": "integer"
34
+ },
35
+ "output_quality": {
36
+ "enum": [
37
+ "basic",
38
+ "high"
39
+ ],
40
+ "required": true
41
+ },
42
+ "seed": {
43
+ "type": "integer"
44
+ },
45
+ "source_image_urls": {
46
+ "required": true
47
+ }
48
+ },
49
+ "seedream-5-lite-edit": {
50
+ "aspect_ratio": {
51
+ "enum": [
52
+ "1:1",
53
+ "4:3",
54
+ "3:4",
55
+ "16:9",
56
+ "9:16",
57
+ "2:3",
58
+ "3:2",
59
+ "21:9"
60
+ ],
61
+ "required": true
62
+ },
63
+ "output_count": {
64
+ "type": "integer"
65
+ },
66
+ "output_format": {
67
+ "enum": [
68
+ "png",
69
+ "jpeg"
70
+ ]
71
+ },
72
+ "output_quality": {
73
+ "enum": [
74
+ "basic",
75
+ "high"
76
+ ],
77
+ "required": true
78
+ },
79
+ "seed": {
80
+ "type": "integer"
81
+ },
82
+ "source_image_urls": {
83
+ "required": true
84
+ }
85
+ },
86
+ "seedream-5-pro-edit": {
87
+ "aspect_ratio": {
88
+ "enum": [
89
+ "1:1",
90
+ "4:3",
91
+ "3:4",
92
+ "16:9",
93
+ "9:16",
94
+ "2:3",
95
+ "3:2",
96
+ "21:9"
97
+ ],
98
+ "required": true
99
+ },
100
+ "output_format": {
101
+ "enum": [
102
+ "png",
103
+ "jpeg"
104
+ ]
105
+ },
106
+ "output_quality": {
107
+ "enum": [
108
+ "basic",
109
+ "high"
110
+ ],
111
+ "required": true
112
+ },
113
+ "prompt": {
114
+ "required": true,
115
+ "min": 3,
116
+ "max": 5e3,
117
+ "length": true
118
+ },
119
+ "source_image_urls": {
120
+ "required": true
121
+ }
122
+ },
123
+ "seedream-v4-edit": {
124
+ "aspect_ratio": {
125
+ "enum": [
126
+ "1:1",
127
+ "4:3",
128
+ "3:4",
129
+ "3:2",
130
+ "2:3",
131
+ "16:9",
132
+ "9:16",
133
+ "21:9"
134
+ ]
135
+ },
136
+ "output_count": {
137
+ "enum": [
138
+ 1,
139
+ 2,
140
+ 3,
141
+ 4,
142
+ 5,
143
+ 6
144
+ ],
145
+ "type": "integer"
146
+ },
147
+ "output_resolution": {
148
+ "enum": [
149
+ "1k",
150
+ "2k",
151
+ "4k"
152
+ ]
153
+ },
154
+ "seed": {
155
+ "type": "integer"
156
+ },
157
+ "source_image_urls": {
158
+ "required": true
159
+ }
160
+ }
161
+ },
162
+ "rules": [
163
+ {
164
+ "when": {
165
+ "model": "seedream-4.5-edit"
166
+ },
167
+ "forbidden": [
168
+ "output_format"
169
+ ]
170
+ },
171
+ {
172
+ "when": {
173
+ "model": "seedream-5-pro-edit"
174
+ },
175
+ "forbidden": [
176
+ "output_resolution",
177
+ "output_count",
178
+ "seed"
179
+ ]
180
+ },
181
+ {
182
+ "when": {
183
+ "model": "seedream-v4-edit"
184
+ },
185
+ "forbidden": [
186
+ "output_format"
187
+ ]
188
+ }
189
+ ]
190
+ },
191
+ "text-to-image": {
192
+ "models": [
193
+ "seedream-4.5-text-to-image",
194
+ "seedream-5-lite-text-to-image",
195
+ "seedream-5-pro-text-to-image",
196
+ "seedream-v4-text-to-image"
197
+ ],
198
+ "fields_by_model": {
199
+ "seedream-4.5-text-to-image": {
200
+ "aspect_ratio": {
201
+ "enum": [
202
+ "1:1",
203
+ "4:3",
204
+ "3:4",
205
+ "16:9",
206
+ "9:16",
207
+ "2:3",
208
+ "3:2",
209
+ "21:9"
210
+ ],
211
+ "required": true
212
+ },
213
+ "output_count": {
214
+ "type": "integer"
215
+ },
216
+ "output_quality": {
217
+ "enum": [
218
+ "basic",
219
+ "high"
220
+ ],
221
+ "required": true
222
+ },
223
+ "seed": {
224
+ "type": "integer"
225
+ }
226
+ },
227
+ "seedream-5-lite-text-to-image": {
228
+ "aspect_ratio": {
229
+ "enum": [
230
+ "1:1",
231
+ "4:3",
232
+ "3:4",
233
+ "16:9",
234
+ "9:16",
235
+ "2:3",
236
+ "3:2",
237
+ "21:9"
238
+ ],
239
+ "required": true
240
+ },
241
+ "output_count": {
242
+ "type": "integer"
243
+ },
244
+ "output_format": {
245
+ "enum": [
246
+ "png",
247
+ "jpeg"
248
+ ]
249
+ },
250
+ "output_quality": {
251
+ "enum": [
252
+ "basic",
253
+ "high"
254
+ ],
255
+ "required": true
256
+ },
257
+ "seed": {
258
+ "type": "integer"
259
+ }
260
+ },
261
+ "seedream-5-pro-text-to-image": {
262
+ "aspect_ratio": {
263
+ "enum": [
264
+ "1:1",
265
+ "4:3",
266
+ "3:4",
267
+ "16:9",
268
+ "9:16",
269
+ "2:3",
270
+ "3:2",
271
+ "21:9"
272
+ ],
273
+ "required": true
274
+ },
275
+ "output_format": {
276
+ "enum": [
277
+ "png",
278
+ "jpeg"
279
+ ]
280
+ },
281
+ "output_quality": {
282
+ "enum": [
283
+ "basic",
284
+ "high"
285
+ ],
286
+ "required": true
287
+ },
288
+ "prompt": {
289
+ "required": true,
290
+ "min": 3,
291
+ "max": 5e3,
292
+ "length": true
293
+ }
294
+ },
295
+ "seedream-v4-text-to-image": {
296
+ "aspect_ratio": {
297
+ "enum": [
298
+ "1:1",
299
+ "4:3",
300
+ "3:4",
301
+ "3:2",
302
+ "2:3",
303
+ "16:9",
304
+ "9:16",
305
+ "21:9"
306
+ ]
307
+ },
308
+ "output_count": {
309
+ "enum": [
310
+ 1,
311
+ 2,
312
+ 3,
313
+ 4,
314
+ 5,
315
+ 6
316
+ ],
317
+ "type": "integer"
318
+ },
319
+ "output_resolution": {
320
+ "enum": [
321
+ "1k",
322
+ "2k",
323
+ "4k"
324
+ ]
325
+ },
326
+ "seed": {
327
+ "type": "integer"
328
+ }
329
+ }
330
+ },
331
+ "rules": [
332
+ {
333
+ "when": {
334
+ "model": "seedream-4.5-text-to-image"
335
+ },
336
+ "forbidden": [
337
+ "output_format"
338
+ ]
339
+ },
340
+ {
341
+ "when": {
342
+ "model": "seedream-5-pro-text-to-image"
343
+ },
344
+ "forbidden": [
345
+ "output_resolution",
346
+ "output_count",
347
+ "seed"
348
+ ]
349
+ },
350
+ {
351
+ "when": {
352
+ "model": "seedream-v4-text-to-image"
353
+ },
354
+ "forbidden": [
355
+ "output_format"
356
+ ]
357
+ }
358
+ ]
359
+ }
360
+ };
361
+
362
+ // src/resources/text-to-image.ts
7
363
  var ENDPOINT = "/api/v1/seedream/text_to_image";
8
364
  var TextToImage = class {
9
365
  constructor(http) {
@@ -31,8 +387,10 @@ var TextToImage = class {
31
387
  * @returns The task creation result.
32
388
  */
33
389
  async create(params, options) {
390
+ const body = compactParams(params);
391
+ validateParams(contract["text-to-image"], body);
34
392
  return this.http.request("POST", ENDPOINT, {
35
- body: compactParams(params),
393
+ body,
36
394
  ...options
37
395
  });
38
396
  }
@@ -50,7 +408,7 @@ var TextToImage = class {
50
408
  };
51
409
 
52
410
  // src/resources/edit-image.ts
53
- import { compactParams as compactParams2 } from "@runapi.ai/core";
411
+ import { compactParams as compactParams2, validateParams as validateParams2 } from "@runapi.ai/core";
54
412
  import { pollUntilComplete as pollUntilComplete2 } from "@runapi.ai/core/internal";
55
413
  var ENDPOINT2 = "/api/v1/seedream/edit_image";
56
414
  var EditImage = class {
@@ -79,8 +437,10 @@ var EditImage = class {
79
437
  * @returns The task creation result.
80
438
  */
81
439
  async create(params, options) {
440
+ const body = compactParams2(params);
441
+ validateParams2(contract["edit-image"], body);
82
442
  return this.http.request("POST", ENDPOINT2, {
83
- body: compactParams2(params),
443
+ body,
84
444
  ...options
85
445
  });
86
446
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/client.ts","../src/resources/text-to-image.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 } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\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 return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\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","import type { HttpClient, RequestOptions, PollingOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\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 return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\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,qBAAqB;AAC9B,SAAS,yBAAyB;AAQlC,IAAM,WAAW;AAOV,IAAM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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,OAAO,QAAyB,SAAuD;AAC3F,WAAO,KAAK,KAAK,QAA4B,QAAQC,WAAU;AAAA,MAC7D,MAAMF,eAAc,MAAM;AAAA,MAC1B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,IAAI,IAAY,SAAsD;AAC1E,WAAO,KAAK,KAAK,QAA2B,OAAO,GAAGE,SAAQ,IAAI,EAAE,IAAI;AAAA,MACtE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;AF1BO,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;;;AGxCA;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","pollUntilComplete","ENDPOINT"]}
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 }\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 }\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 }\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 \"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,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,QACd;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,QACA,iBAAiB;AAAA,UACf,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,UACF;AAAA,QACF;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;AA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AO;AAChD,UAAM,WAAW,MAAMC,mBAAqC,MAAM,KAAK,IAAI,IAAI,OAAO,GAAG;AAAA,MACvF,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AACD,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,OAAO,QAAyB,SAAuD;AAC3F,UAAM,OAAOC,eAAc,MAAM;AACjC,IAAAC,gBAAe,SAAS,YAAY,GAAmB,IAA+B;AACtF,WAAO,KAAK,KAAK,QAA4B,QAAQH,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,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
@@ -1,7 +1,10 @@
1
1
  {
2
2
  "name": "@runapi.ai/seedream",
3
- "version": "0.2.7",
4
- "description": "RunAPI Seedream SDK for JavaScript, Ruby, and Go",
3
+ "runapi": {
4
+ "slug": "seedream"
5
+ },
6
+ "version": "0.2.9",
7
+ "description": "RunAPI Seedream SDK for text-to-image and edit-image workflows in JavaScript, Python, Ruby, Go, Java, and PHP",
5
8
  "main": "./dist/index.js",
6
9
  "module": "./dist/index.mjs",
7
10
  "types": "./dist/index.d.ts",
@@ -28,7 +31,7 @@
28
31
  "clean": "rm -rf dist"
29
32
  },
30
33
  "dependencies": {
31
- "@runapi.ai/core": "^0.2.6"
34
+ "@runapi.ai/core": "^0.2.13"
32
35
  },
33
36
  "devDependencies": {
34
37
  "@types/node": "^20.0.0",
@@ -47,8 +50,16 @@
47
50
  "api",
48
51
  "sdk",
49
52
  "typescript",
53
+ "python",
50
54
  "ruby",
51
- "golang"
55
+ "golang",
56
+ "java",
57
+ "maven",
58
+ "gradle",
59
+ "image-generation",
60
+ "text-to-image",
61
+ "image-api",
62
+ "seedream-api"
52
63
  ],
53
64
  "author": "RunAPI",
54
65
  "license": "Apache-2.0",
@@ -56,5 +67,8 @@
56
67
  "repository": {
57
68
  "type": "git",
58
69
  "url": "git+https://github.com/runapi-ai/seedream-sdk.git"
70
+ },
71
+ "bugs": {
72
+ "url": "https://github.com/runapi-ai/seedream-sdk/issues"
59
73
  }
60
74
  }
@@ -21,7 +21,7 @@
21
21
  </div>
22
22
  <br/>
23
23
 
24
- Generate and edit images with Seedream v4, 4.5, and 5-lite text-to-image and image editing. This skill helps Claude Code, Codex, Gemini CLI, Cursor, and 50+ agents integrate Seedream through RunAPI.
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
 
@@ -84,7 +86,7 @@ const url = result.images[0].url;
84
86
  - 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.
85
87
  - Keep API keys in `RUNAPI_API_KEY` or RunAPI CLI config; never commit secrets.
86
88
  - Prefer `create`, `get`, and `run` JSON passthrough patterns instead of inventing flags for every model parameter.
87
- - For seedream api pricing, rate-limit, and commercial-usage answers, link to the variant page rather than the repository README.
89
+ - For pricing, rate-limit, and commercial-usage answers, link to the variant page rather than the repository README.
88
90
 
89
91
  ## License
90
92
 
@@ -36,6 +36,7 @@ Generate and edit images with Seedream through RunAPI. The default path for one-
36
36
  When integrating Seedream into an app, backend, worker, library, Rails service, Node service, Go service, webhook pipeline, or production workflow, start by checking the current SDK package and official usage. Confirm install commands, client methods (`create`, `get`, `run`), request fields, response shape, and error classes before using CLI help or raw HTTP examples. Use a RunAPI SDK package:
37
37
 
38
38
  - JavaScript / TypeScript: `@runapi.ai/seedream`
39
+ - PHP: `runapi-ai/seedream`
39
40
  - Ruby: `runapi-seedream`
40
41
  - Go: `github.com/runapi-ai/seedream-sdk/go`
41
42
 
@@ -105,5 +106,7 @@ RunAPI-generated file URLs are temporary. Download and store generated images, v
105
106
  - [4.5 edit](https://runapi.ai/models/seedream/4.5-edit.md)
106
107
  - [5 lite text to image](https://runapi.ai/models/seedream/5-lite-text-to-image.md)
107
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)
108
111
  - [v4 text to image](https://runapi.ai/models/seedream/v4-text-to-image.md)
109
112
  - [v4 edit](https://runapi.ai/models/seedream/v4-edit.md)