@runapi.ai/seedream 0.2.7 → 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
 
package/dist/index.js CHANGED
@@ -41,6 +41,221 @@ 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) {
@@ -68,8 +283,10 @@ var TextToImage = class {
68
283
  * @returns The task creation result.
69
284
  */
70
285
  async create(params, options) {
286
+ const body = (0, import_core.compactParams)(params);
287
+ (0, import_core.validateParams)(contract["text-to-image"], body);
71
288
  return this.http.request("POST", ENDPOINT, {
72
- body: (0, import_core.compactParams)(params),
289
+ body,
73
290
  ...options
74
291
  });
75
292
  }
@@ -116,8 +333,10 @@ var EditImage = class {
116
333
  * @returns The task creation result.
117
334
  */
118
335
  async create(params, options) {
336
+ const body = (0, import_core2.compactParams)(params);
337
+ (0, import_core2.validateParams)(contract["edit-image"], body);
119
338
  return this.http.request("POST", ENDPOINT2, {
120
- body: (0, import_core2.compactParams)(params),
339
+ body,
121
340
  ...options
122
341
  });
123
342
  }
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,Q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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,GAAGA,SAAQ,IAAI,EAAE,IAAI;AAAA,MACtE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;AF1BO,IAAM,iBAAN,cAA6B,wBAAW;AAAA;AAAA,EAE7B;AAAA;AAAA,EAEA;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO;AACb,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAC5C,SAAK,YAAY,IAAI,UAAU,KAAK,IAAI;AAAA,EAC1C;AACF;;;ADxCA,IAAAC,eAYO;","names":["import_core","import_core","import_internal","ENDPOINT","import_core"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/client.ts","../src/resources/text-to-image.ts","../src/contract_gen.ts","../src/resources/edit-image.ts"],"sourcesContent":["export { SeedreamClient } from './client';\nexport * from './types';\n\nexport {\n RunApiError,\n AuthenticationError,\n InsufficientCreditsError,\n NotFoundError,\n ValidationError,\n RateLimitError,\n ServiceUnavailableError,\n NetworkError,\n TimeoutError,\n TaskTimeoutError,\n TaskFailedError,\n} from '@runapi.ai/core';\n","import { BaseClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToImage } from './resources/text-to-image';\nimport { EditImage } from './resources/edit-image';\n\n/**\n * Seedream image generation and editing API client.\n *\n * Three model families with different field requirements:\n * - **4.5**: requires `aspect_ratio` and `output_quality`\n * - **5-lite**: same required fields as 4.5, faster generation\n * - **V4**: uses `output_resolution` instead; supports `seed` and batch `output_count`\n *\n * @example\n * ```typescript\n * const client = new SeedreamClient({ apiKey: 'your-api-key' });\n *\n * // Seedream 4.5\n * const result = await client.textToImage.run({\n * model: 'seedream-4.5-text-to-image',\n * prompt: 'A beautiful product render',\n * aspect_ratio: '16:9',\n * output_quality: 'high',\n * });\n *\n * // Seedream V4 with batch output\n * const batch = await client.textToImage.run({\n * model: 'seedream-v4-text-to-image',\n * prompt: 'Minimalist logo design',\n * output_count: 4,\n * });\n * ```\n */\nexport class SeedreamClient extends BaseClient {\n /** Text-to-image generation across Seedream model versions. */\n public readonly textToImage: TextToImage;\n /** Edit source images according to a text prompt. */\n public readonly editImage: EditImage;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.textToImage = new TextToImage(this.http);\n this.editImage = new EditImage(this.http);\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\nimport type {\n CompletedTextToImageResponse,\n TextToImageParams,\n TextToImageResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/seedream/text_to_image';\n\n/**\n * Generates images from text prompts across Seedream model versions.\n * Field requirements vary by model family: 4.5/5-lite 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;AAA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gB;AAAA,EACrB,YAA6B,MAAkB;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,UAAM,oCAAqC,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,WAAO,4BAAc,MAAM;AACjC,qCAAe,SAAS,YAAY,GAAmB,IAA+B;AACtF,WAAO,KAAK,KAAK,QAA4B,QAAQA,WAAU;AAAA,MAC7D;AAAA,MACA,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,IAAI,IAAY,SAAsD;AAC1E,WAAO,KAAK,KAAK,QAA2B,OAAO,GAAGA,SAAQ,IAAI,EAAE,IAAI;AAAA,MACtE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;AH7BO,IAAM,iBAAN,cAA6B,wBAAW;AAAA;AAAA,EAE7B;AAAA;AAAA,EAEA;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO;AACb,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAC5C,SAAK,YAAY,IAAI,UAAU,KAAK,IAAI;AAAA,EAC1C;AACF;;;ADxCA,IAAAC,eAYO;","names":["import_core","import_core","import_internal","ENDPOINT","import_core"]}
package/dist/index.mjs CHANGED
@@ -2,8 +2,223 @@
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-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) {
@@ -31,8 +246,10 @@ var TextToImage = class {
31
246
  * @returns The task creation result.
32
247
  */
33
248
  async create(params, options) {
249
+ const body = compactParams(params);
250
+ validateParams(contract["text-to-image"], body);
34
251
  return this.http.request("POST", ENDPOINT, {
35
- body: compactParams(params),
252
+ body,
36
253
  ...options
37
254
  });
38
255
  }
@@ -50,7 +267,7 @@ var TextToImage = class {
50
267
  };
51
268
 
52
269
  // src/resources/edit-image.ts
53
- import { compactParams as compactParams2 } from "@runapi.ai/core";
270
+ import { compactParams as compactParams2, validateParams as validateParams2 } from "@runapi.ai/core";
54
271
  import { pollUntilComplete as pollUntilComplete2 } from "@runapi.ai/core/internal";
55
272
  var ENDPOINT2 = "/api/v1/seedream/edit_image";
56
273
  var EditImage = class {
@@ -79,8 +296,10 @@ var EditImage = class {
79
296
  * @returns The task creation result.
80
297
  */
81
298
  async create(params, options) {
299
+ const body = compactParams2(params);
300
+ validateParams2(contract["edit-image"], body);
82
301
  return this.http.request("POST", ENDPOINT2, {
83
- body: compactParams2(params),
302
+ body,
84
303
  ...options
85
304
  });
86
305
  }
@@ -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,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,MAAM,kBAAuC,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,MAC7D,MAAM,cAAc,MAAM;AAAA,MAC1B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,IAAI,IAAY,SAAwD;AAC5E,WAAO,KAAK,KAAK,QAA6B,OAAO,GAAG,QAAQ,IAAI,EAAE,IAAI;AAAA,MACxE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;AC1DA,SAAS,iBAAAA,sBAAqB;AAC9B,SAAS,qBAAAC,0BAAyB;AAQlC,IAAMC,YAAW;AAMV,IAAM,YAAN,MAAgB;AAAA,EACrB,YAA6B,MAAkB;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,MAAMD,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,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 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;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,kBAAkB;AAAA,UAChB,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,UACF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O,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.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.6"
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
  }
@@ -84,7 +84,7 @@ const url = result.images[0].url;
84
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.
85
85
  - Keep API keys in `RUNAPI_API_KEY` or RunAPI CLI config; never commit secrets.
86
86
  - 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.
87
+ - For pricing, rate-limit, and commercial-usage answers, link to the variant page rather than the repository README.
88
88
 
89
89
  ## License
90
90
 
@@ -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