@runapi.ai/seedream 0.2.6 → 0.2.8

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
 
@@ -28,6 +28,8 @@ const status = await client.textToImage.get(task.id);
28
28
 
29
29
  Use `create` when you want to submit a task and return quickly, `get` when you need the latest task state, and `run` when a script should create and poll until completion. In web request handlers, prefer `create` plus webhook or later `get` polling so a worker is not held open.
30
30
 
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
+
31
33
  ## Language notes
32
34
 
33
35
  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
@@ -1,25 +1,44 @@
1
- import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, ClientOptions } from '@runapi.ai/core';
1
+ import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, BaseClient, ClientOptions } from '@runapi.ai/core';
2
2
  export { AuthenticationError, InsufficientCreditsError, NetworkError, NotFoundError, RateLimitError, RunApiError, ServiceUnavailableError, TaskFailedError, TaskTimeoutError, TimeoutError, ValidationError } from '@runapi.ai/core';
3
3
 
4
+ /** Union of all Seedream model identifiers across text-to-image and edit endpoints. */
4
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';
6
+ /** Models accepted by the text-to-image endpoint. */
5
7
  type TextToImageModel = 'seedream-4.5-text-to-image' | 'seedream-5-lite-text-to-image' | 'seedream-v4-text-to-image';
8
+ /** Models accepted by the edit-image endpoint. */
6
9
  type EditImageModel = 'seedream-4.5-edit' | 'seedream-5-lite-edit' | 'seedream-v4-edit';
7
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. */
8
12
  type OutputQuality = 'basic' | 'high';
13
+ /** Pixel resolution tier for V4 models. */
9
14
  type V4OutputResolution = '1k' | '2k' | '4k';
15
+ /**
16
+ * Shared parameters for 4.5 and 5-lite models.
17
+ * Both `aspect_ratio` and `output_quality` are required for these model families.
18
+ */
10
19
  interface ImageGenerationBaseParams {
11
20
  prompt: string;
12
21
  aspect_ratio: AspectRatio;
13
22
  output_quality: OutputQuality;
23
+ /** Toggle content safety filtering. */
14
24
  enable_safety_checker?: boolean;
15
25
  callback_url?: string;
16
26
  }
27
+ /**
28
+ * Shared parameters for V4 models.
29
+ * Uses `output_resolution` instead of `output_quality`, and supports
30
+ * reproducible generation via `seed` and batch output via `output_count`.
31
+ */
17
32
  interface V4GenerationBaseParams {
18
33
  prompt: string;
19
34
  aspect_ratio?: AspectRatio;
35
+ /** Output resolution tier (default: "1k"). */
20
36
  output_resolution?: V4OutputResolution;
37
+ /** Number of images to generate (default: 1). */
21
38
  output_count?: number;
39
+ /** Fixed seed for reproducible generation. */
22
40
  seed?: number;
41
+ /** Toggle content safety filtering. */
23
42
  enable_safety_checker?: boolean;
24
43
  callback_url?: string;
25
44
  }
@@ -28,6 +47,7 @@ interface Generation45TextParams extends ImageGenerationBaseParams {
28
47
  }
29
48
  interface Generation45EditImageParams extends ImageGenerationBaseParams {
30
49
  model: 'seedream-4.5-edit';
50
+ /** Source image URLs to edit (up to 14 for 4.5 models). */
31
51
  source_image_urls: string[];
32
52
  }
33
53
  interface Generation5LiteTextParams extends ImageGenerationBaseParams {
@@ -35,6 +55,7 @@ interface Generation5LiteTextParams extends ImageGenerationBaseParams {
35
55
  }
36
56
  interface Generation5LiteEditParams extends ImageGenerationBaseParams {
37
57
  model: 'seedream-5-lite-edit';
58
+ /** Source image URLs to edit (up to 14 for 5-lite models). */
38
59
  source_image_urls: string[];
39
60
  }
40
61
  interface GenerationV4TextParams extends V4GenerationBaseParams {
@@ -42,6 +63,7 @@ interface GenerationV4TextParams extends V4GenerationBaseParams {
42
63
  }
43
64
  interface GenerationV4EditParams extends V4GenerationBaseParams {
44
65
  model: 'seedream-v4-edit';
66
+ /** Source image URLs to edit (up to 10 for V4 models). */
45
67
  source_image_urls: string[];
46
68
  }
47
69
  type TextToImageParams = Generation45TextParams | Generation5LiteTextParams | GenerationV4TextParams;
@@ -49,6 +71,7 @@ type EditImageParams = Generation45EditImageParams | Generation5LiteEditParams |
49
71
  interface TaskCreateResponse {
50
72
  id: string;
51
73
  }
74
+ /** A generated image with its CDN URL. */
52
75
  interface Image {
53
76
  url: string;
54
77
  }
@@ -74,24 +97,99 @@ type CompletedEditImageResponse = EditImageResponse & {
74
97
  images: Image[];
75
98
  };
76
99
 
100
+ /**
101
+ * 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`.
104
+ */
77
105
  declare class TextToImage {
78
106
  private readonly http;
79
107
  constructor(http: HttpClient);
108
+ /**
109
+ * Create a text to image task and wait until complete.
110
+ * @param params Text to image parameters.
111
+ * @param options Per-request and polling overrides.
112
+ * @returns The completed text to image response.
113
+ */
80
114
  run(params: TextToImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToImageResponse>;
115
+ /**
116
+ * Create a text to image task; returns immediately with a task id.
117
+ * @param params Text to image parameters.
118
+ * @param options Per-request overrides.
119
+ * @returns The task creation result.
120
+ */
81
121
  create(params: TextToImageParams, options?: RequestOptions): Promise<TaskCreateResponse>;
122
+ /**
123
+ * Fetch the current status of a text to image task.
124
+ * @param id The task id.
125
+ * @param options Per-request overrides.
126
+ * @returns The current text to image task status.
127
+ */
82
128
  get(id: string, options?: RequestOptions): Promise<TextToImageResponse>;
83
129
  }
84
130
 
131
+ /**
132
+ * 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.
134
+ */
85
135
  declare class EditImage {
86
136
  private readonly http;
87
137
  constructor(http: HttpClient);
138
+ /**
139
+ * Create an edit image task and wait until complete.
140
+ * @param params Edit image parameters.
141
+ * @param options Per-request and polling overrides.
142
+ * @returns The completed edit image response.
143
+ */
88
144
  run(params: EditImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedEditImageResponse>;
145
+ /**
146
+ * Create an edit image task; returns immediately with a task id.
147
+ * @param params Edit image parameters.
148
+ * @param options Per-request overrides.
149
+ * @returns The task creation result.
150
+ */
89
151
  create(params: EditImageParams, options?: RequestOptions): Promise<TaskCreateResponse>;
152
+ /**
153
+ * Fetch the current status of an edit image task.
154
+ * @param id The task id.
155
+ * @param options Per-request overrides.
156
+ * @returns The current edit image task status.
157
+ */
90
158
  get(id: string, options?: RequestOptions): Promise<EditImageResponse>;
91
159
  }
92
160
 
93
- declare class SeedreamClient {
161
+ /**
162
+ * Seedream image generation and editing API client.
163
+ *
164
+ * Three model families with different field requirements:
165
+ * - **4.5**: requires `aspect_ratio` and `output_quality`
166
+ * - **5-lite**: same required fields as 4.5, faster generation
167
+ * - **V4**: uses `output_resolution` instead; supports `seed` and batch `output_count`
168
+ *
169
+ * @example
170
+ * ```typescript
171
+ * const client = new SeedreamClient({ apiKey: 'your-api-key' });
172
+ *
173
+ * // Seedream 4.5
174
+ * const result = await client.textToImage.run({
175
+ * model: 'seedream-4.5-text-to-image',
176
+ * prompt: 'A beautiful product render',
177
+ * aspect_ratio: '16:9',
178
+ * output_quality: 'high',
179
+ * });
180
+ *
181
+ * // Seedream V4 with batch output
182
+ * const batch = await client.textToImage.run({
183
+ * model: 'seedream-v4-text-to-image',
184
+ * prompt: 'Minimalist logo design',
185
+ * output_count: 4,
186
+ * });
187
+ * ```
188
+ */
189
+ declare class SeedreamClient extends BaseClient {
190
+ /** Text-to-image generation across Seedream model versions. */
94
191
  readonly textToImage: TextToImage;
192
+ /** Edit source images according to a text prompt. */
95
193
  readonly editImage: EditImage;
96
194
  constructor(options?: ClientOptions);
97
195
  }
package/dist/index.d.ts CHANGED
@@ -1,25 +1,44 @@
1
- import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, ClientOptions } from '@runapi.ai/core';
1
+ import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, BaseClient, ClientOptions } from '@runapi.ai/core';
2
2
  export { AuthenticationError, InsufficientCreditsError, NetworkError, NotFoundError, RateLimitError, RunApiError, ServiceUnavailableError, TaskFailedError, TaskTimeoutError, TimeoutError, ValidationError } from '@runapi.ai/core';
3
3
 
4
+ /** Union of all Seedream model identifiers across text-to-image and edit endpoints. */
4
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';
6
+ /** Models accepted by the text-to-image endpoint. */
5
7
  type TextToImageModel = 'seedream-4.5-text-to-image' | 'seedream-5-lite-text-to-image' | 'seedream-v4-text-to-image';
8
+ /** Models accepted by the edit-image endpoint. */
6
9
  type EditImageModel = 'seedream-4.5-edit' | 'seedream-5-lite-edit' | 'seedream-v4-edit';
7
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. */
8
12
  type OutputQuality = 'basic' | 'high';
13
+ /** Pixel resolution tier for V4 models. */
9
14
  type V4OutputResolution = '1k' | '2k' | '4k';
15
+ /**
16
+ * Shared parameters for 4.5 and 5-lite models.
17
+ * Both `aspect_ratio` and `output_quality` are required for these model families.
18
+ */
10
19
  interface ImageGenerationBaseParams {
11
20
  prompt: string;
12
21
  aspect_ratio: AspectRatio;
13
22
  output_quality: OutputQuality;
23
+ /** Toggle content safety filtering. */
14
24
  enable_safety_checker?: boolean;
15
25
  callback_url?: string;
16
26
  }
27
+ /**
28
+ * Shared parameters for V4 models.
29
+ * Uses `output_resolution` instead of `output_quality`, and supports
30
+ * reproducible generation via `seed` and batch output via `output_count`.
31
+ */
17
32
  interface V4GenerationBaseParams {
18
33
  prompt: string;
19
34
  aspect_ratio?: AspectRatio;
35
+ /** Output resolution tier (default: "1k"). */
20
36
  output_resolution?: V4OutputResolution;
37
+ /** Number of images to generate (default: 1). */
21
38
  output_count?: number;
39
+ /** Fixed seed for reproducible generation. */
22
40
  seed?: number;
41
+ /** Toggle content safety filtering. */
23
42
  enable_safety_checker?: boolean;
24
43
  callback_url?: string;
25
44
  }
@@ -28,6 +47,7 @@ interface Generation45TextParams extends ImageGenerationBaseParams {
28
47
  }
29
48
  interface Generation45EditImageParams extends ImageGenerationBaseParams {
30
49
  model: 'seedream-4.5-edit';
50
+ /** Source image URLs to edit (up to 14 for 4.5 models). */
31
51
  source_image_urls: string[];
32
52
  }
33
53
  interface Generation5LiteTextParams extends ImageGenerationBaseParams {
@@ -35,6 +55,7 @@ interface Generation5LiteTextParams extends ImageGenerationBaseParams {
35
55
  }
36
56
  interface Generation5LiteEditParams extends ImageGenerationBaseParams {
37
57
  model: 'seedream-5-lite-edit';
58
+ /** Source image URLs to edit (up to 14 for 5-lite models). */
38
59
  source_image_urls: string[];
39
60
  }
40
61
  interface GenerationV4TextParams extends V4GenerationBaseParams {
@@ -42,6 +63,7 @@ interface GenerationV4TextParams extends V4GenerationBaseParams {
42
63
  }
43
64
  interface GenerationV4EditParams extends V4GenerationBaseParams {
44
65
  model: 'seedream-v4-edit';
66
+ /** Source image URLs to edit (up to 10 for V4 models). */
45
67
  source_image_urls: string[];
46
68
  }
47
69
  type TextToImageParams = Generation45TextParams | Generation5LiteTextParams | GenerationV4TextParams;
@@ -49,6 +71,7 @@ type EditImageParams = Generation45EditImageParams | Generation5LiteEditParams |
49
71
  interface TaskCreateResponse {
50
72
  id: string;
51
73
  }
74
+ /** A generated image with its CDN URL. */
52
75
  interface Image {
53
76
  url: string;
54
77
  }
@@ -74,24 +97,99 @@ type CompletedEditImageResponse = EditImageResponse & {
74
97
  images: Image[];
75
98
  };
76
99
 
100
+ /**
101
+ * 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`.
104
+ */
77
105
  declare class TextToImage {
78
106
  private readonly http;
79
107
  constructor(http: HttpClient);
108
+ /**
109
+ * Create a text to image task and wait until complete.
110
+ * @param params Text to image parameters.
111
+ * @param options Per-request and polling overrides.
112
+ * @returns The completed text to image response.
113
+ */
80
114
  run(params: TextToImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToImageResponse>;
115
+ /**
116
+ * Create a text to image task; returns immediately with a task id.
117
+ * @param params Text to image parameters.
118
+ * @param options Per-request overrides.
119
+ * @returns The task creation result.
120
+ */
81
121
  create(params: TextToImageParams, options?: RequestOptions): Promise<TaskCreateResponse>;
122
+ /**
123
+ * Fetch the current status of a text to image task.
124
+ * @param id The task id.
125
+ * @param options Per-request overrides.
126
+ * @returns The current text to image task status.
127
+ */
82
128
  get(id: string, options?: RequestOptions): Promise<TextToImageResponse>;
83
129
  }
84
130
 
131
+ /**
132
+ * 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.
134
+ */
85
135
  declare class EditImage {
86
136
  private readonly http;
87
137
  constructor(http: HttpClient);
138
+ /**
139
+ * Create an edit image task and wait until complete.
140
+ * @param params Edit image parameters.
141
+ * @param options Per-request and polling overrides.
142
+ * @returns The completed edit image response.
143
+ */
88
144
  run(params: EditImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedEditImageResponse>;
145
+ /**
146
+ * Create an edit image task; returns immediately with a task id.
147
+ * @param params Edit image parameters.
148
+ * @param options Per-request overrides.
149
+ * @returns The task creation result.
150
+ */
89
151
  create(params: EditImageParams, options?: RequestOptions): Promise<TaskCreateResponse>;
152
+ /**
153
+ * Fetch the current status of an edit image task.
154
+ * @param id The task id.
155
+ * @param options Per-request overrides.
156
+ * @returns The current edit image task status.
157
+ */
90
158
  get(id: string, options?: RequestOptions): Promise<EditImageResponse>;
91
159
  }
92
160
 
93
- declare class SeedreamClient {
161
+ /**
162
+ * Seedream image generation and editing API client.
163
+ *
164
+ * Three model families with different field requirements:
165
+ * - **4.5**: requires `aspect_ratio` and `output_quality`
166
+ * - **5-lite**: same required fields as 4.5, faster generation
167
+ * - **V4**: uses `output_resolution` instead; supports `seed` and batch `output_count`
168
+ *
169
+ * @example
170
+ * ```typescript
171
+ * const client = new SeedreamClient({ apiKey: 'your-api-key' });
172
+ *
173
+ * // Seedream 4.5
174
+ * const result = await client.textToImage.run({
175
+ * model: 'seedream-4.5-text-to-image',
176
+ * prompt: 'A beautiful product render',
177
+ * aspect_ratio: '16:9',
178
+ * output_quality: 'high',
179
+ * });
180
+ *
181
+ * // Seedream V4 with batch output
182
+ * const batch = await client.textToImage.run({
183
+ * model: 'seedream-v4-text-to-image',
184
+ * prompt: 'Minimalist logo design',
185
+ * output_count: 4,
186
+ * });
187
+ * ```
188
+ */
189
+ declare class SeedreamClient extends BaseClient {
190
+ /** Text-to-image generation across Seedream model versions. */
94
191
  readonly textToImage: TextToImage;
192
+ /** Edit source images according to a text prompt. */
95
193
  readonly editImage: EditImage;
96
194
  constructor(options?: ClientOptions);
97
195
  }
package/dist/index.js CHANGED
@@ -41,12 +41,233 @@ 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-v4-edit"
52
+ ],
53
+ "fields_by_model": {
54
+ "seedream-4.5-edit": {
55
+ "aspect_ratio": {
56
+ "enum": [
57
+ "1:1",
58
+ "4:3",
59
+ "3:4",
60
+ "16:9",
61
+ "9:16",
62
+ "2:3",
63
+ "3:2",
64
+ "21:9"
65
+ ],
66
+ "required": true
67
+ },
68
+ "output_count": {
69
+ "type": "integer"
70
+ },
71
+ "output_quality": {
72
+ "enum": [
73
+ "basic",
74
+ "high"
75
+ ],
76
+ "required": true
77
+ },
78
+ "seed": {
79
+ "type": "integer"
80
+ },
81
+ "source_image_urls": {
82
+ "required": true
83
+ }
84
+ },
85
+ "seedream-5-lite-edit": {
86
+ "aspect_ratio": {
87
+ "enum": [
88
+ "1:1",
89
+ "4:3",
90
+ "3:4",
91
+ "16:9",
92
+ "9:16",
93
+ "2:3",
94
+ "3:2",
95
+ "21:9"
96
+ ],
97
+ "required": true
98
+ },
99
+ "output_count": {
100
+ "type": "integer"
101
+ },
102
+ "output_quality": {
103
+ "enum": [
104
+ "basic",
105
+ "high"
106
+ ],
107
+ "required": true
108
+ },
109
+ "seed": {
110
+ "type": "integer"
111
+ },
112
+ "source_image_urls": {
113
+ "required": true
114
+ }
115
+ },
116
+ "seedream-v4-edit": {
117
+ "aspect_ratio": {
118
+ "enum": [
119
+ "1:1",
120
+ "4:3",
121
+ "3:4",
122
+ "3:2",
123
+ "2:3",
124
+ "16:9",
125
+ "9:16",
126
+ "21:9"
127
+ ]
128
+ },
129
+ "output_count": {
130
+ "enum": [
131
+ 1,
132
+ 2,
133
+ 3,
134
+ 4,
135
+ 5,
136
+ 6
137
+ ],
138
+ "type": "integer"
139
+ },
140
+ "output_resolution": {
141
+ "enum": [
142
+ "1k",
143
+ "2k",
144
+ "4k"
145
+ ]
146
+ },
147
+ "seed": {
148
+ "type": "integer"
149
+ },
150
+ "source_image_urls": {
151
+ "required": true
152
+ }
153
+ }
154
+ }
155
+ },
156
+ "text-to-image": {
157
+ "models": [
158
+ "seedream-4.5-text-to-image",
159
+ "seedream-5-lite-text-to-image",
160
+ "seedream-v4-text-to-image"
161
+ ],
162
+ "fields_by_model": {
163
+ "seedream-4.5-text-to-image": {
164
+ "aspect_ratio": {
165
+ "enum": [
166
+ "1:1",
167
+ "4:3",
168
+ "3:4",
169
+ "16:9",
170
+ "9:16",
171
+ "2:3",
172
+ "3:2",
173
+ "21:9"
174
+ ],
175
+ "required": true
176
+ },
177
+ "output_count": {
178
+ "type": "integer"
179
+ },
180
+ "output_quality": {
181
+ "enum": [
182
+ "basic",
183
+ "high"
184
+ ],
185
+ "required": true
186
+ },
187
+ "seed": {
188
+ "type": "integer"
189
+ }
190
+ },
191
+ "seedream-5-lite-text-to-image": {
192
+ "aspect_ratio": {
193
+ "enum": [
194
+ "1:1",
195
+ "4:3",
196
+ "3:4",
197
+ "16:9",
198
+ "9:16",
199
+ "2:3",
200
+ "3:2",
201
+ "21:9"
202
+ ],
203
+ "required": true
204
+ },
205
+ "output_count": {
206
+ "type": "integer"
207
+ },
208
+ "output_quality": {
209
+ "enum": [
210
+ "basic",
211
+ "high"
212
+ ],
213
+ "required": true
214
+ },
215
+ "seed": {
216
+ "type": "integer"
217
+ }
218
+ },
219
+ "seedream-v4-text-to-image": {
220
+ "aspect_ratio": {
221
+ "enum": [
222
+ "1:1",
223
+ "4:3",
224
+ "3:4",
225
+ "3:2",
226
+ "2:3",
227
+ "16:9",
228
+ "9:16",
229
+ "21:9"
230
+ ]
231
+ },
232
+ "output_count": {
233
+ "enum": [
234
+ 1,
235
+ 2,
236
+ 3,
237
+ 4,
238
+ 5,
239
+ 6
240
+ ],
241
+ "type": "integer"
242
+ },
243
+ "output_resolution": {
244
+ "enum": [
245
+ "1k",
246
+ "2k",
247
+ "4k"
248
+ ]
249
+ },
250
+ "seed": {
251
+ "type": "integer"
252
+ }
253
+ }
254
+ }
255
+ }
256
+ };
257
+
258
+ // src/resources/text-to-image.ts
44
259
  var ENDPOINT = "/api/v1/seedream/text_to_image";
45
260
  var TextToImage = class {
46
261
  constructor(http) {
47
262
  this.http = http;
48
263
  }
49
264
  http;
265
+ /**
266
+ * Create a text to image task and wait until complete.
267
+ * @param params Text to image parameters.
268
+ * @param options Per-request and polling overrides.
269
+ * @returns The completed text to image response.
270
+ */
50
271
  async run(params, options) {
51
272
  const { id } = await this.create(params, options);
52
273
  const response = await (0, import_internal.pollUntilComplete)(() => this.get(id, options), {
@@ -55,12 +276,26 @@ var TextToImage = class {
55
276
  });
56
277
  return response;
57
278
  }
279
+ /**
280
+ * Create a text to image task; returns immediately with a task id.
281
+ * @param params Text to image parameters.
282
+ * @param options Per-request overrides.
283
+ * @returns The task creation result.
284
+ */
58
285
  async create(params, options) {
286
+ const body = (0, import_core.compactParams)(params);
287
+ (0, import_core.validateParams)(contract["text-to-image"], body);
59
288
  return this.http.request("POST", ENDPOINT, {
60
- body: (0, import_core.compactParams)(params),
289
+ body,
61
290
  ...options
62
291
  });
63
292
  }
293
+ /**
294
+ * Fetch the current status of a text to image task.
295
+ * @param id The task id.
296
+ * @param options Per-request overrides.
297
+ * @returns The current text to image task status.
298
+ */
64
299
  async get(id, options) {
65
300
  return this.http.request("GET", `${ENDPOINT}/${id}`, {
66
301
  ...options
@@ -77,6 +312,12 @@ var EditImage = class {
77
312
  this.http = http;
78
313
  }
79
314
  http;
315
+ /**
316
+ * Create an edit image task and wait until complete.
317
+ * @param params Edit image parameters.
318
+ * @param options Per-request and polling overrides.
319
+ * @returns The completed edit image response.
320
+ */
80
321
  async run(params, options) {
81
322
  const { id } = await this.create(params, options);
82
323
  const response = await (0, import_internal2.pollUntilComplete)(() => this.get(id, options), {
@@ -85,12 +326,26 @@ var EditImage = class {
85
326
  });
86
327
  return response;
87
328
  }
329
+ /**
330
+ * Create an edit image task; returns immediately with a task id.
331
+ * @param params Edit image parameters.
332
+ * @param options Per-request overrides.
333
+ * @returns The task creation result.
334
+ */
88
335
  async create(params, options) {
336
+ const body = (0, import_core2.compactParams)(params);
337
+ (0, import_core2.validateParams)(contract["edit-image"], body);
89
338
  return this.http.request("POST", ENDPOINT2, {
90
- body: (0, import_core2.compactParams)(params),
339
+ body,
91
340
  ...options
92
341
  });
93
342
  }
343
+ /**
344
+ * Fetch the current status of an edit image task.
345
+ * @param id The task id.
346
+ * @param options Per-request overrides.
347
+ * @returns The current edit image task status.
348
+ */
94
349
  async get(id, options) {
95
350
  return this.http.request("GET", `${ENDPOINT2}/${id}`, {
96
351
  ...options
@@ -99,13 +354,15 @@ var EditImage = class {
99
354
  };
100
355
 
101
356
  // src/client.ts
102
- var SeedreamClient = class {
357
+ var SeedreamClient = class extends import_core3.BaseClient {
358
+ /** Text-to-image generation across Seedream model versions. */
103
359
  textToImage;
360
+ /** Edit source images according to a text prompt. */
104
361
  editImage;
105
362
  constructor(options = {}) {
106
- const http = (0, import_core3.createHttpClient)(options);
107
- this.textToImage = new TextToImage(http);
108
- this.editImage = new EditImage(http);
363
+ super(options);
364
+ this.textToImage = new TextToImage(this.http);
365
+ this.editImage = new EditImage(this.http);
109
366
  }
110
367
  };
111
368
 
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 { createHttpClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToImage } from './resources/text-to-image';\nimport { EditImage } from './resources/edit-image';\n\nexport class SeedreamClient {\n public readonly textToImage: TextToImage;\n public readonly editImage: EditImage;\n\n constructor(options: ClientOptions = {}) {\n const http = createHttpClient(options);\n this.textToImage = new TextToImage(http);\n this.editImage = new EditImage(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\nexport class TextToImage {\n constructor(private readonly http: HttpClient) {}\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 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 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\nexport class EditImage {\n constructor(private readonly http: HttpClient) {}\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 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 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,eAAqD;;;ACCrD,kBAA8B;AAC9B,sBAAkC;AAQlC,IAAM,WAAW;AAEV,IAAM,cAAN,MAAkB;AAAA,EACvB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA,EAE7B,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,EAEA,MAAM,OAAO,QAA2B,SAAuD;AAC7F,WAAO,KAAK,KAAK,QAA4B,QAAQ,UAAU;AAAA,MAC7D,UAAM,2BAAc,MA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":["../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,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,Y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;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"]}
package/dist/index.mjs CHANGED
@@ -1,15 +1,236 @@
1
1
  // src/client.ts
2
- import { createHttpClient } from "@runapi.ai/core";
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-v4-edit"
15
+ ],
16
+ "fields_by_model": {
17
+ "seedream-4.5-edit": {
18
+ "aspect_ratio": {
19
+ "enum": [
20
+ "1:1",
21
+ "4:3",
22
+ "3:4",
23
+ "16:9",
24
+ "9:16",
25
+ "2:3",
26
+ "3:2",
27
+ "21:9"
28
+ ],
29
+ "required": true
30
+ },
31
+ "output_count": {
32
+ "type": "integer"
33
+ },
34
+ "output_quality": {
35
+ "enum": [
36
+ "basic",
37
+ "high"
38
+ ],
39
+ "required": true
40
+ },
41
+ "seed": {
42
+ "type": "integer"
43
+ },
44
+ "source_image_urls": {
45
+ "required": true
46
+ }
47
+ },
48
+ "seedream-5-lite-edit": {
49
+ "aspect_ratio": {
50
+ "enum": [
51
+ "1:1",
52
+ "4:3",
53
+ "3:4",
54
+ "16:9",
55
+ "9:16",
56
+ "2:3",
57
+ "3:2",
58
+ "21:9"
59
+ ],
60
+ "required": true
61
+ },
62
+ "output_count": {
63
+ "type": "integer"
64
+ },
65
+ "output_quality": {
66
+ "enum": [
67
+ "basic",
68
+ "high"
69
+ ],
70
+ "required": true
71
+ },
72
+ "seed": {
73
+ "type": "integer"
74
+ },
75
+ "source_image_urls": {
76
+ "required": true
77
+ }
78
+ },
79
+ "seedream-v4-edit": {
80
+ "aspect_ratio": {
81
+ "enum": [
82
+ "1:1",
83
+ "4:3",
84
+ "3:4",
85
+ "3:2",
86
+ "2:3",
87
+ "16:9",
88
+ "9:16",
89
+ "21:9"
90
+ ]
91
+ },
92
+ "output_count": {
93
+ "enum": [
94
+ 1,
95
+ 2,
96
+ 3,
97
+ 4,
98
+ 5,
99
+ 6
100
+ ],
101
+ "type": "integer"
102
+ },
103
+ "output_resolution": {
104
+ "enum": [
105
+ "1k",
106
+ "2k",
107
+ "4k"
108
+ ]
109
+ },
110
+ "seed": {
111
+ "type": "integer"
112
+ },
113
+ "source_image_urls": {
114
+ "required": true
115
+ }
116
+ }
117
+ }
118
+ },
119
+ "text-to-image": {
120
+ "models": [
121
+ "seedream-4.5-text-to-image",
122
+ "seedream-5-lite-text-to-image",
123
+ "seedream-v4-text-to-image"
124
+ ],
125
+ "fields_by_model": {
126
+ "seedream-4.5-text-to-image": {
127
+ "aspect_ratio": {
128
+ "enum": [
129
+ "1:1",
130
+ "4:3",
131
+ "3:4",
132
+ "16:9",
133
+ "9:16",
134
+ "2:3",
135
+ "3:2",
136
+ "21:9"
137
+ ],
138
+ "required": true
139
+ },
140
+ "output_count": {
141
+ "type": "integer"
142
+ },
143
+ "output_quality": {
144
+ "enum": [
145
+ "basic",
146
+ "high"
147
+ ],
148
+ "required": true
149
+ },
150
+ "seed": {
151
+ "type": "integer"
152
+ }
153
+ },
154
+ "seedream-5-lite-text-to-image": {
155
+ "aspect_ratio": {
156
+ "enum": [
157
+ "1:1",
158
+ "4:3",
159
+ "3:4",
160
+ "16:9",
161
+ "9:16",
162
+ "2:3",
163
+ "3:2",
164
+ "21:9"
165
+ ],
166
+ "required": true
167
+ },
168
+ "output_count": {
169
+ "type": "integer"
170
+ },
171
+ "output_quality": {
172
+ "enum": [
173
+ "basic",
174
+ "high"
175
+ ],
176
+ "required": true
177
+ },
178
+ "seed": {
179
+ "type": "integer"
180
+ }
181
+ },
182
+ "seedream-v4-text-to-image": {
183
+ "aspect_ratio": {
184
+ "enum": [
185
+ "1:1",
186
+ "4:3",
187
+ "3:4",
188
+ "3:2",
189
+ "2:3",
190
+ "16:9",
191
+ "9:16",
192
+ "21:9"
193
+ ]
194
+ },
195
+ "output_count": {
196
+ "enum": [
197
+ 1,
198
+ 2,
199
+ 3,
200
+ 4,
201
+ 5,
202
+ 6
203
+ ],
204
+ "type": "integer"
205
+ },
206
+ "output_resolution": {
207
+ "enum": [
208
+ "1k",
209
+ "2k",
210
+ "4k"
211
+ ]
212
+ },
213
+ "seed": {
214
+ "type": "integer"
215
+ }
216
+ }
217
+ }
218
+ }
219
+ };
220
+
221
+ // src/resources/text-to-image.ts
7
222
  var ENDPOINT = "/api/v1/seedream/text_to_image";
8
223
  var TextToImage = class {
9
224
  constructor(http) {
10
225
  this.http = http;
11
226
  }
12
227
  http;
228
+ /**
229
+ * Create a text to image task and wait until complete.
230
+ * @param params Text to image parameters.
231
+ * @param options Per-request and polling overrides.
232
+ * @returns The completed text to image response.
233
+ */
13
234
  async run(params, options) {
14
235
  const { id } = await this.create(params, options);
15
236
  const response = await pollUntilComplete(() => this.get(id, options), {
@@ -18,12 +239,26 @@ var TextToImage = class {
18
239
  });
19
240
  return response;
20
241
  }
242
+ /**
243
+ * Create a text to image task; returns immediately with a task id.
244
+ * @param params Text to image parameters.
245
+ * @param options Per-request overrides.
246
+ * @returns The task creation result.
247
+ */
21
248
  async create(params, options) {
249
+ const body = compactParams(params);
250
+ validateParams(contract["text-to-image"], body);
22
251
  return this.http.request("POST", ENDPOINT, {
23
- body: compactParams(params),
252
+ body,
24
253
  ...options
25
254
  });
26
255
  }
256
+ /**
257
+ * Fetch the current status of a text to image task.
258
+ * @param id The task id.
259
+ * @param options Per-request overrides.
260
+ * @returns The current text to image task status.
261
+ */
27
262
  async get(id, options) {
28
263
  return this.http.request("GET", `${ENDPOINT}/${id}`, {
29
264
  ...options
@@ -32,7 +267,7 @@ var TextToImage = class {
32
267
  };
33
268
 
34
269
  // src/resources/edit-image.ts
35
- import { compactParams as compactParams2 } from "@runapi.ai/core";
270
+ import { compactParams as compactParams2, validateParams as validateParams2 } from "@runapi.ai/core";
36
271
  import { pollUntilComplete as pollUntilComplete2 } from "@runapi.ai/core/internal";
37
272
  var ENDPOINT2 = "/api/v1/seedream/edit_image";
38
273
  var EditImage = class {
@@ -40,6 +275,12 @@ var EditImage = class {
40
275
  this.http = http;
41
276
  }
42
277
  http;
278
+ /**
279
+ * Create an edit image task and wait until complete.
280
+ * @param params Edit image parameters.
281
+ * @param options Per-request and polling overrides.
282
+ * @returns The completed edit image response.
283
+ */
43
284
  async run(params, options) {
44
285
  const { id } = await this.create(params, options);
45
286
  const response = await pollUntilComplete2(() => this.get(id, options), {
@@ -48,12 +289,26 @@ var EditImage = class {
48
289
  });
49
290
  return response;
50
291
  }
292
+ /**
293
+ * Create an edit image task; returns immediately with a task id.
294
+ * @param params Edit image parameters.
295
+ * @param options Per-request overrides.
296
+ * @returns The task creation result.
297
+ */
51
298
  async create(params, options) {
299
+ const body = compactParams2(params);
300
+ validateParams2(contract["edit-image"], body);
52
301
  return this.http.request("POST", ENDPOINT2, {
53
- body: compactParams2(params),
302
+ body,
54
303
  ...options
55
304
  });
56
305
  }
306
+ /**
307
+ * Fetch the current status of an edit image task.
308
+ * @param id The task id.
309
+ * @param options Per-request overrides.
310
+ * @returns The current edit image task status.
311
+ */
57
312
  async get(id, options) {
58
313
  return this.http.request("GET", `${ENDPOINT2}/${id}`, {
59
314
  ...options
@@ -62,13 +317,15 @@ var EditImage = class {
62
317
  };
63
318
 
64
319
  // src/client.ts
65
- var SeedreamClient = class {
320
+ var SeedreamClient = class extends BaseClient {
321
+ /** Text-to-image generation across Seedream model versions. */
66
322
  textToImage;
323
+ /** Edit source images according to a text prompt. */
67
324
  editImage;
68
325
  constructor(options = {}) {
69
- const http = createHttpClient(options);
70
- this.textToImage = new TextToImage(http);
71
- this.editImage = new EditImage(http);
326
+ super(options);
327
+ this.textToImage = new TextToImage(this.http);
328
+ this.editImage = new EditImage(this.http);
72
329
  }
73
330
  };
74
331
 
@@ -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 { createHttpClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToImage } from './resources/text-to-image';\nimport { EditImage } from './resources/edit-image';\n\nexport class SeedreamClient {\n public readonly textToImage: TextToImage;\n public readonly editImage: EditImage;\n\n constructor(options: ClientOptions = {}) {\n const http = createHttpClient(options);\n this.textToImage = new TextToImage(http);\n this.editImage = new EditImage(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\nexport class TextToImage {\n constructor(private readonly http: HttpClient) {}\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 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 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\nexport class EditImage {\n constructor(private readonly http: HttpClient) {}\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 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 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,wBAA4C;;;ACCrD,SAAS,qBAAqB;AAC9B,SAAS,yBAAyB;AAQlC,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MAC1B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,IAAI,IAAY,SAAsD;AAC1E,WAAO,KAAK,KAAK,QAA2B,OAAO,GAAGE,SAAQ,IAAI,EAAE,IAAI;AAAA,MACtE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;AFhCO,IAAM,iBAAN,MAAqB;AAAA,EACV;AAAA,EACA;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO,iBAAiB,OAAO;AACrC,SAAK,cAAc,IAAI,YAAY,IAAI;AACvC,SAAK,YAAY,IAAI,UAAU,IAAI;AAAA,EACrC;AACF;;;AGVA;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 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,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB,qBAAqB;AAAA,QACnB,gBAAgB;AAAA,UACd,QAAQ;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AkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ7B,MAAM,IAAI,QAAyB,SAAgF;AACjH,UAAM,EAAE,GAAG,IAAI,MAAM,KAAK,OAAO,QAAQ,OAAO;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.6",
4
- "description": "RunAPI Seedream SDK for JavaScript, Ruby, and Go",
3
+ "runapi": {
4
+ "slug": "seedream"
5
+ },
6
+ "version": "0.2.8",
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.5"
34
+ "@runapi.ai/core": "^0.2.11"
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
  }
@@ -80,9 +80,11 @@ const url = result.images[0].url;
80
80
 
81
81
  ## Agent rules
82
82
 
83
+ - Integration work uses the target language SDK; one-off generation, manual smoke tests, debugging, or user-requested CLI runs use the RunAPI CLI skill: https://github.com/runapi-ai/cli-skill
84
+ - 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.
83
85
  - Keep API keys in `RUNAPI_API_KEY` or RunAPI CLI config; never commit secrets.
84
86
  - Prefer `create`, `get`, and `run` JSON passthrough patterns instead of inventing flags for every model parameter.
85
- - For seedream api pricing, rate-limit, and commercial-usage answers, link to the variant page rather than the repository README.
87
+ - For pricing, rate-limit, and commercial-usage answers, link to the variant page rather than the repository README.
86
88
 
87
89
  ## License
88
90
 
@@ -25,14 +25,24 @@ metadata:
25
25
 
26
26
  Generate and edit images with Seedream through RunAPI. The default path for one-off agent tasks is the `runapi` CLI; SDKs are for application integration.
27
27
 
28
- ## Routing decision
28
+ ## Critical: Integration Runtime
29
29
 
30
- - One-off generation, editing, or transformation for the user use the **CLI path** with the `runapi` binary.
31
- - Building an app, backend, worker, library, or production codebase use the **SDK integration path**.
30
+ - Integration work (app, backend, worker, library, Rails service, Node service, Go service, webhook pipeline, or production codebase) uses the **SDK integration path** for the target language.
31
+ - One-off generation, editing, transformation, manual smoke tests, debugging, or user-requested CLI runs use the **CLI path** with the `runapi` binary. For full CLI-specific agent guidance, see https://github.com/runapi-ai/cli-skill.
32
+ - Never shell out to the `runapi` CLI as the production runtime integration layer.
33
+
34
+ ## SDK integration path
35
+
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
+
38
+ - JavaScript / TypeScript: `@runapi.ai/seedream`
39
+ - PHP: `runapi-ai/seedream`
40
+ - Ruby: `runapi-seedream`
41
+ - Go: `github.com/runapi-ai/seedream-sdk/go`
32
42
 
33
43
  ## CLI path
34
44
 
35
- The `runapi` binary is the runtime dependency. Run `runapi auth status` first. For agents and headless runs, prefer `RUNAPI_API_KEY` or import it into saved config with `printf '%s' "$RUNAPI_API_KEY" | runapi auth import-token --token -`. Use `runapi login` only when the user explicitly wants interactive browser auth.
45
+ The `runapi` binary is the one-off and manual testing runtime dependency. For full CLI-specific agent guidance, see https://github.com/runapi-ai/cli-skill. Run `runapi auth status` first. For agents and headless runs, prefer `RUNAPI_API_KEY` or import it into saved config with `printf '%s' "$RUNAPI_API_KEY" | runapi auth import-token --token -`. Use `runapi login` only when the user explicitly wants interactive browser auth.
36
46
 
37
47
  Inspect the available commands and request fields with CLI help:
38
48
 
@@ -81,13 +91,9 @@ Common request shapes:
81
91
  }
82
92
  ```
83
93
 
84
- ## SDK integration path
85
-
86
- When integrating Seedream into an app, backend, worker, or library — not for one-off tasks — use a RunAPI SDK package:
94
+ ## Generated file storage
87
95
 
88
- - JavaScript / TypeScript: `@runapi.ai/seedream`
89
- - Ruby: `runapi-seedream`
90
- - Go: `github.com/runapi-ai/seedream-sdk/go`
96
+ 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.
91
97
 
92
98
  ## References
93
99