@runapi.ai/seedance 0.3.1 → 0.4.0

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/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { TaskResponse, AsyncTaskStatus, TaskBillingResponse, HttpClient, RequestOptions, PollingOptions, BaseClient, ClientOptions } from '@runapi.ai/core';
1
+ import { TaskResponse, 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
4
  type SeedanceModel = 'seedance-1.5-pro' | 'seedance-2.0' | 'seedance-2.0-fast' | 'seedance-2.5' | 'seedance-2-mini' | 'seedance-v1-pro' | 'seedance-v1-pro-fast';
@@ -178,7 +178,7 @@ interface GenerationV1ProFastParams extends GenerationCommonParams, SafetyChecke
178
178
  }
179
179
  /** Discriminated union of all generation parameter variants */
180
180
  type TextToVideoParams = Generation15ProParams | Generation2TextParams | Generation2FrameParams | Generation2ReferenceParams | Generation25TextParams | Generation25FrameParams | Generation25ReferenceParams | GenerationV1ProParams | GenerationV1ProFastParams;
181
- interface TaskCreateResponse extends TaskBillingResponse {
181
+ interface TaskCreateResponse {
182
182
  id: string;
183
183
  }
184
184
  interface VideoMetadata {
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { TaskResponse, AsyncTaskStatus, TaskBillingResponse, HttpClient, RequestOptions, PollingOptions, BaseClient, ClientOptions } from '@runapi.ai/core';
1
+ import { TaskResponse, 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
4
  type SeedanceModel = 'seedance-1.5-pro' | 'seedance-2.0' | 'seedance-2.0-fast' | 'seedance-2.5' | 'seedance-2-mini' | 'seedance-v1-pro' | 'seedance-v1-pro-fast';
@@ -178,7 +178,7 @@ interface GenerationV1ProFastParams extends GenerationCommonParams, SafetyChecke
178
178
  }
179
179
  /** Discriminated union of all generation parameter variants */
180
180
  type TextToVideoParams = Generation15ProParams | Generation2TextParams | Generation2FrameParams | Generation2ReferenceParams | Generation25TextParams | Generation25FrameParams | Generation25ReferenceParams | GenerationV1ProParams | GenerationV1ProFastParams;
181
- interface TaskCreateResponse extends TaskBillingResponse {
181
+ interface TaskCreateResponse {
182
182
  id: string;
183
183
  }
184
184
  interface VideoMetadata {
package/dist/index.js CHANGED
@@ -41,422 +41,6 @@ var import_core2 = require("@runapi.ai/core");
41
41
  // src/resources/text-to-video.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
- "text-to-video": {
48
- "models": [
49
- "seedance-1.5-pro",
50
- "seedance-2-mini",
51
- "seedance-2.0",
52
- "seedance-2.0-fast",
53
- "seedance-2.5",
54
- "seedance-v1-pro",
55
- "seedance-v1-pro-fast"
56
- ],
57
- "fields_by_model": {
58
- "seedance-1.5-pro": {
59
- "aspect_ratio": {
60
- "enum": [
61
- "1:1",
62
- "4:3",
63
- "3:4",
64
- "16:9",
65
- "9:16",
66
- "21:9"
67
- ]
68
- },
69
- "duration_seconds": {
70
- "required": true,
71
- "min": 4,
72
- "max": 12,
73
- "type": "integer"
74
- },
75
- "output_resolution": {
76
- "enum": [
77
- "480p",
78
- "720p",
79
- "1080p"
80
- ]
81
- },
82
- "seed": {
83
- "min": -1,
84
- "max": 2147483647,
85
- "type": "integer"
86
- },
87
- "source_image_urls": {
88
- "max_items": 2
89
- }
90
- },
91
- "seedance-2-mini": {
92
- "aspect_ratio": {
93
- "enum": [
94
- "1:1",
95
- "4:3",
96
- "3:4",
97
- "16:9",
98
- "9:16",
99
- "21:9",
100
- "auto"
101
- ]
102
- },
103
- "duration_seconds": {
104
- "min": 4,
105
- "max": 15,
106
- "type": "integer"
107
- },
108
- "output_resolution": {
109
- "enum": [
110
- "480p",
111
- "720p"
112
- ]
113
- },
114
- "reference_audio_urls": {
115
- "max_items": 3
116
- },
117
- "reference_image_urls": {
118
- "max_items": 9
119
- },
120
- "reference_video_urls": {
121
- "max_items": 3
122
- }
123
- },
124
- "seedance-2.0": {
125
- "aspect_ratio": {
126
- "enum": [
127
- "1:1",
128
- "4:3",
129
- "3:4",
130
- "16:9",
131
- "9:16",
132
- "21:9",
133
- "auto"
134
- ]
135
- },
136
- "duration_seconds": {
137
- "min": 4,
138
- "max": 15,
139
- "type": "integer"
140
- },
141
- "output_resolution": {
142
- "enum": [
143
- "480p",
144
- "720p",
145
- "1080p",
146
- "4k"
147
- ]
148
- },
149
- "reference_audio_urls": {
150
- "max_items": 3
151
- },
152
- "reference_image_urls": {
153
- "max_items": 9
154
- },
155
- "reference_video_urls": {
156
- "max_items": 3
157
- }
158
- },
159
- "seedance-2.0-fast": {
160
- "aspect_ratio": {
161
- "enum": [
162
- "1:1",
163
- "4:3",
164
- "3:4",
165
- "16:9",
166
- "9:16",
167
- "21:9",
168
- "auto"
169
- ]
170
- },
171
- "duration_seconds": {
172
- "min": 4,
173
- "max": 15,
174
- "type": "integer"
175
- },
176
- "output_resolution": {
177
- "enum": [
178
- "480p",
179
- "720p"
180
- ]
181
- },
182
- "reference_audio_urls": {
183
- "max_items": 3
184
- },
185
- "reference_image_urls": {
186
- "max_items": 9
187
- },
188
- "reference_video_urls": {
189
- "max_items": 3
190
- }
191
- },
192
- "seedance-2.5": {
193
- "aspect_ratio": {
194
- "enum": [
195
- "1:1",
196
- "4:3",
197
- "3:4",
198
- "16:9",
199
- "9:16",
200
- "21:9",
201
- "auto"
202
- ]
203
- },
204
- "duration_seconds": {
205
- "enum": [
206
- -1,
207
- 4,
208
- 5,
209
- 6,
210
- 7,
211
- 8,
212
- 9,
213
- 10,
214
- 11,
215
- 12,
216
- 13,
217
- 14,
218
- 15,
219
- 16,
220
- 17,
221
- 18,
222
- 19,
223
- 20,
224
- 21,
225
- 22,
226
- 23,
227
- 24,
228
- 25,
229
- 26,
230
- 27,
231
- 28,
232
- 29,
233
- 30
234
- ],
235
- "type": "integer"
236
- },
237
- "model": {
238
- "required": true
239
- },
240
- "output_format": {
241
- "enum": [
242
- "mp4",
243
- "mov"
244
- ]
245
- },
246
- "output_resolution": {
247
- "enum": [
248
- "480p",
249
- "720p",
250
- "1080p"
251
- ]
252
- },
253
- "prompt": {
254
- "required": true,
255
- "min": 3,
256
- "max": 3e4,
257
- "length": true
258
- },
259
- "reference_audio_urls": {
260
- "max_items": 10
261
- },
262
- "reference_image_urls": {
263
- "max_items": 30
264
- },
265
- "reference_video_urls": {
266
- "max_items": 10
267
- }
268
- },
269
- "seedance-v1-pro": {
270
- "aspect_ratio": {
271
- "enum": [
272
- "1:1",
273
- "4:3",
274
- "3:4",
275
- "16:9",
276
- "9:16",
277
- "21:9"
278
- ]
279
- },
280
- "duration_seconds": {
281
- "enum": [
282
- 5,
283
- 10
284
- ],
285
- "required": true,
286
- "type": "integer"
287
- },
288
- "output_resolution": {
289
- "enum": [
290
- "480p",
291
- "720p",
292
- "1080p"
293
- ]
294
- },
295
- "seed": {
296
- "type": "integer"
297
- }
298
- },
299
- "seedance-v1-pro-fast": {
300
- "duration_seconds": {
301
- "enum": [
302
- 5,
303
- 10
304
- ],
305
- "required": true,
306
- "type": "integer"
307
- },
308
- "first_frame_image_url": {
309
- "required": true
310
- },
311
- "output_resolution": {
312
- "enum": [
313
- "720p",
314
- "1080p"
315
- ]
316
- },
317
- "seed": {
318
- "min": -1,
319
- "max": 2147483647,
320
- "type": "integer"
321
- }
322
- }
323
- },
324
- "rules": [
325
- {
326
- "enum": {
327
- "aspect_ratio": [
328
- "auto"
329
- ]
330
- },
331
- "when": {
332
- "model": "seedance-2.5",
333
- "first_frame_image_url": {
334
- "present": true
335
- }
336
- },
337
- "forbidden": [
338
- "reference_image_urls",
339
- "reference_video_urls",
340
- "reference_audio_urls"
341
- ]
342
- },
343
- {
344
- "when": {
345
- "model": "seedance-2.5",
346
- "last_frame_image_url": {
347
- "present": true
348
- }
349
- },
350
- "required": [
351
- "first_frame_image_url"
352
- ],
353
- "forbidden": [
354
- "reference_image_urls",
355
- "reference_video_urls",
356
- "reference_audio_urls"
357
- ]
358
- },
359
- {
360
- "when": {
361
- "model": "seedance-1.5-pro"
362
- },
363
- "forbidden": [
364
- "first_frame_image_url",
365
- "last_frame_image_url",
366
- "reference_image_urls",
367
- "reference_video_urls",
368
- "reference_audio_urls",
369
- "web_search",
370
- "return_last_frame",
371
- "output_format"
372
- ]
373
- },
374
- {
375
- "when": {
376
- "model": "seedance-2-mini"
377
- },
378
- "forbidden": [
379
- "source_image_urls",
380
- "lock_camera",
381
- "seed",
382
- "enable_safety_checker",
383
- "return_last_frame",
384
- "output_format"
385
- ]
386
- },
387
- {
388
- "when": {
389
- "model": "seedance-2.0"
390
- },
391
- "forbidden": [
392
- "source_image_urls",
393
- "lock_camera",
394
- "seed",
395
- "return_last_frame",
396
- "output_format"
397
- ]
398
- },
399
- {
400
- "when": {
401
- "model": "seedance-2.0-fast"
402
- },
403
- "forbidden": [
404
- "source_image_urls",
405
- "lock_camera",
406
- "seed",
407
- "return_last_frame",
408
- "output_format"
409
- ]
410
- },
411
- {
412
- "when": {
413
- "model": "seedance-2.5"
414
- },
415
- "forbidden": [
416
- "source_image_urls",
417
- "lock_camera",
418
- "seed"
419
- ]
420
- },
421
- {
422
- "when": {
423
- "model": "seedance-v1-pro"
424
- },
425
- "forbidden": [
426
- "source_image_urls",
427
- "last_frame_image_url",
428
- "reference_image_urls",
429
- "reference_video_urls",
430
- "reference_audio_urls",
431
- "web_search",
432
- "generate_audio",
433
- "return_last_frame",
434
- "output_format"
435
- ]
436
- },
437
- {
438
- "when": {
439
- "model": "seedance-v1-pro-fast"
440
- },
441
- "forbidden": [
442
- "aspect_ratio",
443
- "source_image_urls",
444
- "lock_camera",
445
- "last_frame_image_url",
446
- "reference_image_urls",
447
- "reference_video_urls",
448
- "reference_audio_urls",
449
- "web_search",
450
- "generate_audio",
451
- "return_last_frame",
452
- "output_format"
453
- ]
454
- }
455
- ]
456
- }
457
- };
458
-
459
- // src/resources/text-to-video.ts
460
44
  var ENDPOINT = "/api/v1/seedance/text_to_video";
461
45
  var TextToVideo = class {
462
46
  constructor(http) {
@@ -485,8 +69,6 @@ var TextToVideo = class {
485
69
  */
486
70
  async create(params, options) {
487
71
  const body = (0, import_core.compactParams)(params);
488
- (0, import_core.validateParams)(contract["text-to-video"], body);
489
- validateSeedance2FourKMode(body);
490
72
  return this.http.request("POST", ENDPOINT, {
491
73
  body,
492
74
  ...options
@@ -504,35 +86,6 @@ var TextToVideo = class {
504
86
  });
505
87
  }
506
88
  };
507
- var SEEDANCE_2_FOUR_K_UNSUPPORTED_FIELDS = [
508
- "first_frame_image_url",
509
- "last_frame_image_url",
510
- "reference_image_urls",
511
- "reference_video_urls",
512
- "reference_audio_urls"
513
- ];
514
- function validateSeedance2FourKMode(body) {
515
- if (body.model !== "seedance-2.0" || body.output_resolution !== "4k") {
516
- return;
517
- }
518
- const field = SEEDANCE_2_FOUR_K_UNSUPPORTED_FIELDS.find((candidate) => isPresent(body[candidate]));
519
- if (!field) {
520
- return;
521
- }
522
- throw new import_core.ValidationError(`${field} is not allowed when model is seedance-2.0 and output_resolution is 4k`);
523
- }
524
- function isPresent(value) {
525
- if (value === void 0 || value === null) {
526
- return false;
527
- }
528
- if (typeof value === "string") {
529
- return value.length > 0;
530
- }
531
- if (Array.isArray(value)) {
532
- return value.length > 0;
533
- }
534
- return true;
535
- }
536
89
 
537
90
  // src/client.ts
538
91
  var SeedanceClient = class extends import_core2.BaseClient {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/client.ts","../src/resources/text-to-video.ts","../src/contract_gen.ts"],"sourcesContent":["export { SeedanceClient } 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 { TextToVideo } from './resources/text-to-video';\n\n/**\n * Seedance video API client.\n *\n * @example\n * ```typescript\n * const client = new SeedanceClient({\n * apiKey: 'your-api-key',\n * baseUrl: 'https://runapi.ai',\n * });\n *\n * const result = await client.textToVideo.run({\n * model: 'seedance-2.0',\n * prompt: 'A cat walking through a garden',\n * });\n * ```\n */\nexport class SeedanceClient extends BaseClient {\n /** Video generation operations. */\n public readonly textToVideo: TextToVideo;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.textToVideo = new TextToVideo(this.http);\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams, ValidationError } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\nimport type {\n CompletedTextToVideoResponse,\n TextToVideoParams,\n TextToVideoResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/seedance/text_to_video';\n\n/** Generate video from text prompts, optionally conditioned on reference images, frame images, reference videos, or audio. */\nexport class TextToVideo {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Create a text to video task and wait until complete.\n * @param params Text to video parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed text to video response.\n */\n async run(params: TextToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<TextToVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedTextToVideoResponse;\n }\n\n /**\n * Create a text to video task; returns immediately with a task id.\n * @param params Text to video parameters.\n * @param options Per-request overrides.\n * @returns The task creation result.\n */\n async create(params: TextToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\n validateParams(contract['text-to-video'] as ActionSchema, body as Record<string, unknown>);\n validateSeedance2FourKMode(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 video task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current text to video task status.\n */\n async get(id: string, options?: RequestOptions): Promise<TextToVideoResponse> {\n return this.http.request<TextToVideoResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n\nconst SEEDANCE_2_FOUR_K_UNSUPPORTED_FIELDS = [\n 'first_frame_image_url',\n 'last_frame_image_url',\n 'reference_image_urls',\n 'reference_video_urls',\n 'reference_audio_urls',\n];\n\nfunction validateSeedance2FourKMode(body: Record<string, unknown>): void {\n if (body.model !== 'seedance-2.0' || body.output_resolution !== '4k') {\n return;\n }\n\n const field = SEEDANCE_2_FOUR_K_UNSUPPORTED_FIELDS.find((candidate) => isPresent(body[candidate]));\n if (!field) {\n return;\n }\n\n throw new ValidationError(`${field} is not allowed when model is seedance-2.0 and output_resolution is 4k`);\n}\n\nfunction isPresent(value: unknown): boolean {\n if (value === undefined || value === null) {\n return false;\n }\n if (typeof value === 'string') {\n return value.length > 0;\n }\n if (Array.isArray(value)) {\n return value.length > 0;\n }\n return true;\n}\n","export const contract = {\n \"text-to-video\": {\n \"models\": [\n \"seedance-1.5-pro\",\n \"seedance-2-mini\",\n \"seedance-2.0\",\n \"seedance-2.0-fast\",\n \"seedance-2.5\",\n \"seedance-v1-pro\",\n \"seedance-v1-pro-fast\"\n ],\n \"fields_by_model\": {\n \"seedance-1.5-pro\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"21:9\"\n ]\n },\n \"duration_seconds\": {\n \"required\": true,\n \"min\": 4,\n \"max\": 12,\n \"type\": \"integer\"\n },\n \"output_resolution\": {\n \"enum\": [\n \"480p\",\n \"720p\",\n \"1080p\"\n ]\n },\n \"seed\": {\n \"min\": -1,\n \"max\": 2147483647,\n \"type\": \"integer\"\n },\n \"source_image_urls\": {\n \"max_items\": 2\n }\n },\n \"seedance-2-mini\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"21:9\",\n \"auto\"\n ]\n },\n \"duration_seconds\": {\n \"min\": 4,\n \"max\": 15,\n \"type\": \"integer\"\n },\n \"output_resolution\": {\n \"enum\": [\n \"480p\",\n \"720p\"\n ]\n },\n \"reference_audio_urls\": {\n \"max_items\": 3\n },\n \"reference_image_urls\": {\n \"max_items\": 9\n },\n \"reference_video_urls\": {\n \"max_items\": 3\n }\n },\n \"seedance-2.0\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"21:9\",\n \"auto\"\n ]\n },\n \"duration_seconds\": {\n \"min\": 4,\n \"max\": 15,\n \"type\": \"integer\"\n },\n \"output_resolution\": {\n \"enum\": [\n \"480p\",\n \"720p\",\n \"1080p\",\n \"4k\"\n ]\n },\n \"reference_audio_urls\": {\n \"max_items\": 3\n },\n \"reference_image_urls\": {\n \"max_items\": 9\n },\n \"reference_video_urls\": {\n \"max_items\": 3\n }\n },\n \"seedance-2.0-fast\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"21:9\",\n \"auto\"\n ]\n },\n \"duration_seconds\": {\n \"min\": 4,\n \"max\": 15,\n \"type\": \"integer\"\n },\n \"output_resolution\": {\n \"enum\": [\n \"480p\",\n \"720p\"\n ]\n },\n \"reference_audio_urls\": {\n \"max_items\": 3\n },\n \"reference_image_urls\": {\n \"max_items\": 9\n },\n \"reference_video_urls\": {\n \"max_items\": 3\n }\n },\n \"seedance-2.5\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"21:9\",\n \"auto\"\n ]\n },\n \"duration_seconds\": {\n \"enum\": [\n -1,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30\n ],\n \"type\": \"integer\"\n },\n \"model\": {\n \"required\": true\n },\n \"output_format\": {\n \"enum\": [\n \"mp4\",\n \"mov\"\n ]\n },\n \"output_resolution\": {\n \"enum\": [\n \"480p\",\n \"720p\",\n \"1080p\"\n ]\n },\n \"prompt\": {\n \"required\": true,\n \"min\": 3,\n \"max\": 30000,\n \"length\": true\n },\n \"reference_audio_urls\": {\n \"max_items\": 10\n },\n \"reference_image_urls\": {\n \"max_items\": 30\n },\n \"reference_video_urls\": {\n \"max_items\": 10\n }\n },\n \"seedance-v1-pro\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"21:9\"\n ]\n },\n \"duration_seconds\": {\n \"enum\": [\n 5,\n 10\n ],\n \"required\": true,\n \"type\": \"integer\"\n },\n \"output_resolution\": {\n \"enum\": [\n \"480p\",\n \"720p\",\n \"1080p\"\n ]\n },\n \"seed\": {\n \"type\": \"integer\"\n }\n },\n \"seedance-v1-pro-fast\": {\n \"duration_seconds\": {\n \"enum\": [\n 5,\n 10\n ],\n \"required\": true,\n \"type\": \"integer\"\n },\n \"first_frame_image_url\": {\n \"required\": true\n },\n \"output_resolution\": {\n \"enum\": [\n \"720p\",\n \"1080p\"\n ]\n },\n \"seed\": {\n \"min\": -1,\n \"max\": 2147483647,\n \"type\": \"integer\"\n }\n }\n },\n \"rules\": [\n {\n \"enum\": {\n \"aspect_ratio\": [\n \"auto\"\n ]\n },\n \"when\": {\n \"model\": \"seedance-2.5\",\n \"first_frame_image_url\": {\n \"present\": true\n }\n },\n \"forbidden\": [\n \"reference_image_urls\",\n \"reference_video_urls\",\n \"reference_audio_urls\"\n ]\n },\n {\n \"when\": {\n \"model\": \"seedance-2.5\",\n \"last_frame_image_url\": {\n \"present\": true\n }\n },\n \"required\": [\n \"first_frame_image_url\"\n ],\n \"forbidden\": [\n \"reference_image_urls\",\n \"reference_video_urls\",\n \"reference_audio_urls\"\n ]\n },\n {\n \"when\": {\n \"model\": \"seedance-1.5-pro\"\n },\n \"forbidden\": [\n \"first_frame_image_url\",\n \"last_frame_image_url\",\n \"reference_image_urls\",\n \"reference_video_urls\",\n \"reference_audio_urls\",\n \"web_search\",\n \"return_last_frame\",\n \"output_format\"\n ]\n },\n {\n \"when\": {\n \"model\": \"seedance-2-mini\"\n },\n \"forbidden\": [\n \"source_image_urls\",\n \"lock_camera\",\n \"seed\",\n \"enable_safety_checker\",\n \"return_last_frame\",\n \"output_format\"\n ]\n },\n {\n \"when\": {\n \"model\": \"seedance-2.0\"\n },\n \"forbidden\": [\n \"source_image_urls\",\n \"lock_camera\",\n \"seed\",\n \"return_last_frame\",\n \"output_format\"\n ]\n },\n {\n \"when\": {\n \"model\": \"seedance-2.0-fast\"\n },\n \"forbidden\": [\n \"source_image_urls\",\n \"lock_camera\",\n \"seed\",\n \"return_last_frame\",\n \"output_format\"\n ]\n },\n {\n \"when\": {\n \"model\": \"seedance-2.5\"\n },\n \"forbidden\": [\n \"source_image_urls\",\n \"lock_camera\",\n \"seed\"\n ]\n },\n {\n \"when\": {\n \"model\": \"seedance-v1-pro\"\n },\n \"forbidden\": [\n \"source_image_urls\",\n \"last_frame_image_url\",\n \"reference_image_urls\",\n \"reference_video_urls\",\n \"reference_audio_urls\",\n \"web_search\",\n \"generate_audio\",\n \"return_last_frame\",\n \"output_format\"\n ]\n },\n {\n \"when\": {\n \"model\": \"seedance-v1-pro-fast\"\n },\n \"forbidden\": [\n \"aspect_ratio\",\n \"source_image_urls\",\n \"lock_camera\",\n \"last_frame_image_url\",\n \"reference_image_urls\",\n \"reference_video_urls\",\n \"reference_audio_urls\",\n \"web_search\",\n \"generate_audio\",\n \"return_last_frame\",\n \"output_format\"\n ]\n }\n ]\n }\n} as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,eAA+C;;;ACC/C,kBAA+D;AAC/D,sBAAkC;;;ACF3B,IAAM,WAAW;AAAA,EACtB,iBAAiB;AAAA,IACf,UAAU;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB,oBAAoB;AAAA,QAClB,gBAAgB;AAAA,UACd,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,QACA,oBAAoB;AAAA,UAClB,YAAY;AAAA,UACZ,OAAO;AAAA,UACP,OAAO;AAAA,UACP,QAAQ;AAAA,QACV;AAAA,QACA,qBAAqB;AAAA,UACnB,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,QACA,QAAQ;AAAA,UACN,OAAO;AAAA,UACP,OAAO;AAAA,UACP,QAAQ;AAAA,QACV;AAAA,QACA,qBAAqB;AAAA,UACnB,aAAa;AAAA,QACf;AAAA,MACF;AAAA,MACA,mBAAmB;AAAA,QACjB,gBAAgB;AAAA,UACd,QAAQ;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AACA,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO,MAAM,SAAS;AAAA,EACxB;AACA,MAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,WAAO,MAAM,SAAS;AAAA,EACxB;AACA,SAAO;AACT;;;AD1EO,IAAM,iBAAN,cAA6B,wBAAW;AAAA;AAAA,EAE7B;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO;AACb,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAAA,EAC9C;AACF;;;ADxBA,IAAAC,eAYO;","names":["import_core","import_core"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/client.ts","../src/resources/text-to-video.ts"],"sourcesContent":["export { SeedanceClient } 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 { TextToVideo } from './resources/text-to-video';\n\n/**\n * Seedance video API client.\n *\n * @example\n * ```typescript\n * const client = new SeedanceClient({\n * apiKey: 'your-api-key',\n * baseUrl: 'https://runapi.ai',\n * });\n *\n * const result = await client.textToVideo.run({\n * model: 'seedance-2.0',\n * prompt: 'A cat walking through a garden',\n * });\n * ```\n */\nexport class SeedanceClient extends BaseClient {\n /** Video generation operations. */\n public readonly textToVideo: TextToVideo;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.textToVideo = new TextToVideo(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 CompletedTextToVideoResponse,\n TextToVideoParams,\n TextToVideoResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/seedance/text_to_video';\n\n/** Generate video from text prompts, optionally conditioned on reference images, frame images, reference videos, or audio. */\nexport class TextToVideo {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Create a text to video task and wait until complete.\n * @param params Text to video parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed text to video response.\n */\n async run(params: TextToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<TextToVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedTextToVideoResponse;\n }\n\n /**\n * Create a text to video task; returns immediately with a task id.\n * @param params Text to video parameters.\n * @param options Per-request overrides.\n * @returns The task creation result.\n */\n async create(params: TextToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\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 video task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current text to video task status.\n */\n async get(id: string, options?: RequestOptions): Promise<TextToVideoResponse> {\n return this.http.request<TextToVideoResponse>('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;AAGV,IAAM,cAAN,MAAkB;AAAA,EACvB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ7B,MAAM,IAAI,QAA2B,SAAkF;AACrH,UAAM,EAAE,GAAG,IAAI,MAAM,KAAK,OAAO,QAAQ,OAAO;AAChD,UAAM,WAAW,UAAM,mCAAuC,MAAM,KAAK,IAAI,IAAI,OAAO,GAAG;AAAA,MACzF,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AACD,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,OAAO,QAA2B,SAAuD;AAC7F,UAAM,WAAO,2BAAc,MAAM;AACjC,WAAO,KAAK,KAAK,QAA4B,QAAQ,UAAU;AAAA,MAC7D;AAAA,MACA,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;;;ADrCO,IAAM,iBAAN,cAA6B,wBAAW;AAAA;AAAA,EAE7B;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO;AACb,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAAA,EAC9C;AACF;;;ADxBA,IAAAC,eAYO;","names":["import_core","import_core"]}
package/dist/index.mjs CHANGED
@@ -2,424 +2,8 @@
2
2
  import { BaseClient } from "@runapi.ai/core";
3
3
 
4
4
  // src/resources/text-to-video.ts
5
- import { compactParams, validateParams, ValidationError } from "@runapi.ai/core";
5
+ import { compactParams } from "@runapi.ai/core";
6
6
  import { pollUntilComplete } from "@runapi.ai/core/internal";
7
-
8
- // src/contract_gen.ts
9
- var contract = {
10
- "text-to-video": {
11
- "models": [
12
- "seedance-1.5-pro",
13
- "seedance-2-mini",
14
- "seedance-2.0",
15
- "seedance-2.0-fast",
16
- "seedance-2.5",
17
- "seedance-v1-pro",
18
- "seedance-v1-pro-fast"
19
- ],
20
- "fields_by_model": {
21
- "seedance-1.5-pro": {
22
- "aspect_ratio": {
23
- "enum": [
24
- "1:1",
25
- "4:3",
26
- "3:4",
27
- "16:9",
28
- "9:16",
29
- "21:9"
30
- ]
31
- },
32
- "duration_seconds": {
33
- "required": true,
34
- "min": 4,
35
- "max": 12,
36
- "type": "integer"
37
- },
38
- "output_resolution": {
39
- "enum": [
40
- "480p",
41
- "720p",
42
- "1080p"
43
- ]
44
- },
45
- "seed": {
46
- "min": -1,
47
- "max": 2147483647,
48
- "type": "integer"
49
- },
50
- "source_image_urls": {
51
- "max_items": 2
52
- }
53
- },
54
- "seedance-2-mini": {
55
- "aspect_ratio": {
56
- "enum": [
57
- "1:1",
58
- "4:3",
59
- "3:4",
60
- "16:9",
61
- "9:16",
62
- "21:9",
63
- "auto"
64
- ]
65
- },
66
- "duration_seconds": {
67
- "min": 4,
68
- "max": 15,
69
- "type": "integer"
70
- },
71
- "output_resolution": {
72
- "enum": [
73
- "480p",
74
- "720p"
75
- ]
76
- },
77
- "reference_audio_urls": {
78
- "max_items": 3
79
- },
80
- "reference_image_urls": {
81
- "max_items": 9
82
- },
83
- "reference_video_urls": {
84
- "max_items": 3
85
- }
86
- },
87
- "seedance-2.0": {
88
- "aspect_ratio": {
89
- "enum": [
90
- "1:1",
91
- "4:3",
92
- "3:4",
93
- "16:9",
94
- "9:16",
95
- "21:9",
96
- "auto"
97
- ]
98
- },
99
- "duration_seconds": {
100
- "min": 4,
101
- "max": 15,
102
- "type": "integer"
103
- },
104
- "output_resolution": {
105
- "enum": [
106
- "480p",
107
- "720p",
108
- "1080p",
109
- "4k"
110
- ]
111
- },
112
- "reference_audio_urls": {
113
- "max_items": 3
114
- },
115
- "reference_image_urls": {
116
- "max_items": 9
117
- },
118
- "reference_video_urls": {
119
- "max_items": 3
120
- }
121
- },
122
- "seedance-2.0-fast": {
123
- "aspect_ratio": {
124
- "enum": [
125
- "1:1",
126
- "4:3",
127
- "3:4",
128
- "16:9",
129
- "9:16",
130
- "21:9",
131
- "auto"
132
- ]
133
- },
134
- "duration_seconds": {
135
- "min": 4,
136
- "max": 15,
137
- "type": "integer"
138
- },
139
- "output_resolution": {
140
- "enum": [
141
- "480p",
142
- "720p"
143
- ]
144
- },
145
- "reference_audio_urls": {
146
- "max_items": 3
147
- },
148
- "reference_image_urls": {
149
- "max_items": 9
150
- },
151
- "reference_video_urls": {
152
- "max_items": 3
153
- }
154
- },
155
- "seedance-2.5": {
156
- "aspect_ratio": {
157
- "enum": [
158
- "1:1",
159
- "4:3",
160
- "3:4",
161
- "16:9",
162
- "9:16",
163
- "21:9",
164
- "auto"
165
- ]
166
- },
167
- "duration_seconds": {
168
- "enum": [
169
- -1,
170
- 4,
171
- 5,
172
- 6,
173
- 7,
174
- 8,
175
- 9,
176
- 10,
177
- 11,
178
- 12,
179
- 13,
180
- 14,
181
- 15,
182
- 16,
183
- 17,
184
- 18,
185
- 19,
186
- 20,
187
- 21,
188
- 22,
189
- 23,
190
- 24,
191
- 25,
192
- 26,
193
- 27,
194
- 28,
195
- 29,
196
- 30
197
- ],
198
- "type": "integer"
199
- },
200
- "model": {
201
- "required": true
202
- },
203
- "output_format": {
204
- "enum": [
205
- "mp4",
206
- "mov"
207
- ]
208
- },
209
- "output_resolution": {
210
- "enum": [
211
- "480p",
212
- "720p",
213
- "1080p"
214
- ]
215
- },
216
- "prompt": {
217
- "required": true,
218
- "min": 3,
219
- "max": 3e4,
220
- "length": true
221
- },
222
- "reference_audio_urls": {
223
- "max_items": 10
224
- },
225
- "reference_image_urls": {
226
- "max_items": 30
227
- },
228
- "reference_video_urls": {
229
- "max_items": 10
230
- }
231
- },
232
- "seedance-v1-pro": {
233
- "aspect_ratio": {
234
- "enum": [
235
- "1:1",
236
- "4:3",
237
- "3:4",
238
- "16:9",
239
- "9:16",
240
- "21:9"
241
- ]
242
- },
243
- "duration_seconds": {
244
- "enum": [
245
- 5,
246
- 10
247
- ],
248
- "required": true,
249
- "type": "integer"
250
- },
251
- "output_resolution": {
252
- "enum": [
253
- "480p",
254
- "720p",
255
- "1080p"
256
- ]
257
- },
258
- "seed": {
259
- "type": "integer"
260
- }
261
- },
262
- "seedance-v1-pro-fast": {
263
- "duration_seconds": {
264
- "enum": [
265
- 5,
266
- 10
267
- ],
268
- "required": true,
269
- "type": "integer"
270
- },
271
- "first_frame_image_url": {
272
- "required": true
273
- },
274
- "output_resolution": {
275
- "enum": [
276
- "720p",
277
- "1080p"
278
- ]
279
- },
280
- "seed": {
281
- "min": -1,
282
- "max": 2147483647,
283
- "type": "integer"
284
- }
285
- }
286
- },
287
- "rules": [
288
- {
289
- "enum": {
290
- "aspect_ratio": [
291
- "auto"
292
- ]
293
- },
294
- "when": {
295
- "model": "seedance-2.5",
296
- "first_frame_image_url": {
297
- "present": true
298
- }
299
- },
300
- "forbidden": [
301
- "reference_image_urls",
302
- "reference_video_urls",
303
- "reference_audio_urls"
304
- ]
305
- },
306
- {
307
- "when": {
308
- "model": "seedance-2.5",
309
- "last_frame_image_url": {
310
- "present": true
311
- }
312
- },
313
- "required": [
314
- "first_frame_image_url"
315
- ],
316
- "forbidden": [
317
- "reference_image_urls",
318
- "reference_video_urls",
319
- "reference_audio_urls"
320
- ]
321
- },
322
- {
323
- "when": {
324
- "model": "seedance-1.5-pro"
325
- },
326
- "forbidden": [
327
- "first_frame_image_url",
328
- "last_frame_image_url",
329
- "reference_image_urls",
330
- "reference_video_urls",
331
- "reference_audio_urls",
332
- "web_search",
333
- "return_last_frame",
334
- "output_format"
335
- ]
336
- },
337
- {
338
- "when": {
339
- "model": "seedance-2-mini"
340
- },
341
- "forbidden": [
342
- "source_image_urls",
343
- "lock_camera",
344
- "seed",
345
- "enable_safety_checker",
346
- "return_last_frame",
347
- "output_format"
348
- ]
349
- },
350
- {
351
- "when": {
352
- "model": "seedance-2.0"
353
- },
354
- "forbidden": [
355
- "source_image_urls",
356
- "lock_camera",
357
- "seed",
358
- "return_last_frame",
359
- "output_format"
360
- ]
361
- },
362
- {
363
- "when": {
364
- "model": "seedance-2.0-fast"
365
- },
366
- "forbidden": [
367
- "source_image_urls",
368
- "lock_camera",
369
- "seed",
370
- "return_last_frame",
371
- "output_format"
372
- ]
373
- },
374
- {
375
- "when": {
376
- "model": "seedance-2.5"
377
- },
378
- "forbidden": [
379
- "source_image_urls",
380
- "lock_camera",
381
- "seed"
382
- ]
383
- },
384
- {
385
- "when": {
386
- "model": "seedance-v1-pro"
387
- },
388
- "forbidden": [
389
- "source_image_urls",
390
- "last_frame_image_url",
391
- "reference_image_urls",
392
- "reference_video_urls",
393
- "reference_audio_urls",
394
- "web_search",
395
- "generate_audio",
396
- "return_last_frame",
397
- "output_format"
398
- ]
399
- },
400
- {
401
- "when": {
402
- "model": "seedance-v1-pro-fast"
403
- },
404
- "forbidden": [
405
- "aspect_ratio",
406
- "source_image_urls",
407
- "lock_camera",
408
- "last_frame_image_url",
409
- "reference_image_urls",
410
- "reference_video_urls",
411
- "reference_audio_urls",
412
- "web_search",
413
- "generate_audio",
414
- "return_last_frame",
415
- "output_format"
416
- ]
417
- }
418
- ]
419
- }
420
- };
421
-
422
- // src/resources/text-to-video.ts
423
7
  var ENDPOINT = "/api/v1/seedance/text_to_video";
424
8
  var TextToVideo = class {
425
9
  constructor(http) {
@@ -448,8 +32,6 @@ var TextToVideo = class {
448
32
  */
449
33
  async create(params, options) {
450
34
  const body = compactParams(params);
451
- validateParams(contract["text-to-video"], body);
452
- validateSeedance2FourKMode(body);
453
35
  return this.http.request("POST", ENDPOINT, {
454
36
  body,
455
37
  ...options
@@ -467,35 +49,6 @@ var TextToVideo = class {
467
49
  });
468
50
  }
469
51
  };
470
- var SEEDANCE_2_FOUR_K_UNSUPPORTED_FIELDS = [
471
- "first_frame_image_url",
472
- "last_frame_image_url",
473
- "reference_image_urls",
474
- "reference_video_urls",
475
- "reference_audio_urls"
476
- ];
477
- function validateSeedance2FourKMode(body) {
478
- if (body.model !== "seedance-2.0" || body.output_resolution !== "4k") {
479
- return;
480
- }
481
- const field = SEEDANCE_2_FOUR_K_UNSUPPORTED_FIELDS.find((candidate) => isPresent(body[candidate]));
482
- if (!field) {
483
- return;
484
- }
485
- throw new ValidationError(`${field} is not allowed when model is seedance-2.0 and output_resolution is 4k`);
486
- }
487
- function isPresent(value) {
488
- if (value === void 0 || value === null) {
489
- return false;
490
- }
491
- if (typeof value === "string") {
492
- return value.length > 0;
493
- }
494
- if (Array.isArray(value)) {
495
- return value.length > 0;
496
- }
497
- return true;
498
- }
499
52
 
500
53
  // src/client.ts
501
54
  var SeedanceClient = class extends BaseClient {
@@ -513,7 +66,7 @@ import {
513
66
  AuthenticationError,
514
67
  InsufficientCreditsError,
515
68
  NotFoundError,
516
- ValidationError as ValidationError2,
69
+ ValidationError,
517
70
  RateLimitError,
518
71
  ServiceUnavailableError,
519
72
  NetworkError,
@@ -533,6 +86,6 @@ export {
533
86
  TaskFailedError,
534
87
  TaskTimeoutError,
535
88
  TimeoutError,
536
- ValidationError2 as ValidationError
89
+ ValidationError
537
90
  };
538
91
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/client.ts","../src/resources/text-to-video.ts","../src/contract_gen.ts","../src/index.ts"],"sourcesContent":["import { BaseClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToVideo } from './resources/text-to-video';\n\n/**\n * Seedance video API client.\n *\n * @example\n * ```typescript\n * const client = new SeedanceClient({\n * apiKey: 'your-api-key',\n * baseUrl: 'https://runapi.ai',\n * });\n *\n * const result = await client.textToVideo.run({\n * model: 'seedance-2.0',\n * prompt: 'A cat walking through a garden',\n * });\n * ```\n */\nexport class SeedanceClient extends BaseClient {\n /** Video generation operations. */\n public readonly textToVideo: TextToVideo;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.textToVideo = new TextToVideo(this.http);\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams, ValidationError } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\nimport type {\n CompletedTextToVideoResponse,\n TextToVideoParams,\n TextToVideoResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/seedance/text_to_video';\n\n/** Generate video from text prompts, optionally conditioned on reference images, frame images, reference videos, or audio. */\nexport class TextToVideo {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Create a text to video task and wait until complete.\n * @param params Text to video parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed text to video response.\n */\n async run(params: TextToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<TextToVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedTextToVideoResponse;\n }\n\n /**\n * Create a text to video task; returns immediately with a task id.\n * @param params Text to video parameters.\n * @param options Per-request overrides.\n * @returns The task creation result.\n */\n async create(params: TextToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\n validateParams(contract['text-to-video'] as ActionSchema, body as Record<string, unknown>);\n validateSeedance2FourKMode(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 video task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current text to video task status.\n */\n async get(id: string, options?: RequestOptions): Promise<TextToVideoResponse> {\n return this.http.request<TextToVideoResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n\nconst SEEDANCE_2_FOUR_K_UNSUPPORTED_FIELDS = [\n 'first_frame_image_url',\n 'last_frame_image_url',\n 'reference_image_urls',\n 'reference_video_urls',\n 'reference_audio_urls',\n];\n\nfunction validateSeedance2FourKMode(body: Record<string, unknown>): void {\n if (body.model !== 'seedance-2.0' || body.output_resolution !== '4k') {\n return;\n }\n\n const field = SEEDANCE_2_FOUR_K_UNSUPPORTED_FIELDS.find((candidate) => isPresent(body[candidate]));\n if (!field) {\n return;\n }\n\n throw new ValidationError(`${field} is not allowed when model is seedance-2.0 and output_resolution is 4k`);\n}\n\nfunction isPresent(value: unknown): boolean {\n if (value === undefined || value === null) {\n return false;\n }\n if (typeof value === 'string') {\n return value.length > 0;\n }\n if (Array.isArray(value)) {\n return value.length > 0;\n }\n return true;\n}\n","export const contract = {\n \"text-to-video\": {\n \"models\": [\n \"seedance-1.5-pro\",\n \"seedance-2-mini\",\n \"seedance-2.0\",\n \"seedance-2.0-fast\",\n \"seedance-2.5\",\n \"seedance-v1-pro\",\n \"seedance-v1-pro-fast\"\n ],\n \"fields_by_model\": {\n \"seedance-1.5-pro\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"21:9\"\n ]\n },\n \"duration_seconds\": {\n \"required\": true,\n \"min\": 4,\n \"max\": 12,\n \"type\": \"integer\"\n },\n \"output_resolution\": {\n \"enum\": [\n \"480p\",\n \"720p\",\n \"1080p\"\n ]\n },\n \"seed\": {\n \"min\": -1,\n \"max\": 2147483647,\n \"type\": \"integer\"\n },\n \"source_image_urls\": {\n \"max_items\": 2\n }\n },\n \"seedance-2-mini\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"21:9\",\n \"auto\"\n ]\n },\n \"duration_seconds\": {\n \"min\": 4,\n \"max\": 15,\n \"type\": \"integer\"\n },\n \"output_resolution\": {\n \"enum\": [\n \"480p\",\n \"720p\"\n ]\n },\n \"reference_audio_urls\": {\n \"max_items\": 3\n },\n \"reference_image_urls\": {\n \"max_items\": 9\n },\n \"reference_video_urls\": {\n \"max_items\": 3\n }\n },\n \"seedance-2.0\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"21:9\",\n \"auto\"\n ]\n },\n \"duration_seconds\": {\n \"min\": 4,\n \"max\": 15,\n \"type\": \"integer\"\n },\n \"output_resolution\": {\n \"enum\": [\n \"480p\",\n \"720p\",\n \"1080p\",\n \"4k\"\n ]\n },\n \"reference_audio_urls\": {\n \"max_items\": 3\n },\n \"reference_image_urls\": {\n \"max_items\": 9\n },\n \"reference_video_urls\": {\n \"max_items\": 3\n }\n },\n \"seedance-2.0-fast\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"21:9\",\n \"auto\"\n ]\n },\n \"duration_seconds\": {\n \"min\": 4,\n \"max\": 15,\n \"type\": \"integer\"\n },\n \"output_resolution\": {\n \"enum\": [\n \"480p\",\n \"720p\"\n ]\n },\n \"reference_audio_urls\": {\n \"max_items\": 3\n },\n \"reference_image_urls\": {\n \"max_items\": 9\n },\n \"reference_video_urls\": {\n \"max_items\": 3\n }\n },\n \"seedance-2.5\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"21:9\",\n \"auto\"\n ]\n },\n \"duration_seconds\": {\n \"enum\": [\n -1,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30\n ],\n \"type\": \"integer\"\n },\n \"model\": {\n \"required\": true\n },\n \"output_format\": {\n \"enum\": [\n \"mp4\",\n \"mov\"\n ]\n },\n \"output_resolution\": {\n \"enum\": [\n \"480p\",\n \"720p\",\n \"1080p\"\n ]\n },\n \"prompt\": {\n \"required\": true,\n \"min\": 3,\n \"max\": 30000,\n \"length\": true\n },\n \"reference_audio_urls\": {\n \"max_items\": 10\n },\n \"reference_image_urls\": {\n \"max_items\": 30\n },\n \"reference_video_urls\": {\n \"max_items\": 10\n }\n },\n \"seedance-v1-pro\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"21:9\"\n ]\n },\n \"duration_seconds\": {\n \"enum\": [\n 5,\n 10\n ],\n \"required\": true,\n \"type\": \"integer\"\n },\n \"output_resolution\": {\n \"enum\": [\n \"480p\",\n \"720p\",\n \"1080p\"\n ]\n },\n \"seed\": {\n \"type\": \"integer\"\n }\n },\n \"seedance-v1-pro-fast\": {\n \"duration_seconds\": {\n \"enum\": [\n 5,\n 10\n ],\n \"required\": true,\n \"type\": \"integer\"\n },\n \"first_frame_image_url\": {\n \"required\": true\n },\n \"output_resolution\": {\n \"enum\": [\n \"720p\",\n \"1080p\"\n ]\n },\n \"seed\": {\n \"min\": -1,\n \"max\": 2147483647,\n \"type\": \"integer\"\n }\n }\n },\n \"rules\": [\n {\n \"enum\": {\n \"aspect_ratio\": [\n \"auto\"\n ]\n },\n \"when\": {\n \"model\": \"seedance-2.5\",\n \"first_frame_image_url\": {\n \"present\": true\n }\n },\n \"forbidden\": [\n \"reference_image_urls\",\n \"reference_video_urls\",\n \"reference_audio_urls\"\n ]\n },\n {\n \"when\": {\n \"model\": \"seedance-2.5\",\n \"last_frame_image_url\": {\n \"present\": true\n }\n },\n \"required\": [\n \"first_frame_image_url\"\n ],\n \"forbidden\": [\n \"reference_image_urls\",\n \"reference_video_urls\",\n \"reference_audio_urls\"\n ]\n },\n {\n \"when\": {\n \"model\": \"seedance-1.5-pro\"\n },\n \"forbidden\": [\n \"first_frame_image_url\",\n \"last_frame_image_url\",\n \"reference_image_urls\",\n \"reference_video_urls\",\n \"reference_audio_urls\",\n \"web_search\",\n \"return_last_frame\",\n \"output_format\"\n ]\n },\n {\n \"when\": {\n \"model\": \"seedance-2-mini\"\n },\n \"forbidden\": [\n \"source_image_urls\",\n \"lock_camera\",\n \"seed\",\n \"enable_safety_checker\",\n \"return_last_frame\",\n \"output_format\"\n ]\n },\n {\n \"when\": {\n \"model\": \"seedance-2.0\"\n },\n \"forbidden\": [\n \"source_image_urls\",\n \"lock_camera\",\n \"seed\",\n \"return_last_frame\",\n \"output_format\"\n ]\n },\n {\n \"when\": {\n \"model\": \"seedance-2.0-fast\"\n },\n \"forbidden\": [\n \"source_image_urls\",\n \"lock_camera\",\n \"seed\",\n \"return_last_frame\",\n \"output_format\"\n ]\n },\n {\n \"when\": {\n \"model\": \"seedance-2.5\"\n },\n \"forbidden\": [\n \"source_image_urls\",\n \"lock_camera\",\n \"seed\"\n ]\n },\n {\n \"when\": {\n \"model\": \"seedance-v1-pro\"\n },\n \"forbidden\": [\n \"source_image_urls\",\n \"last_frame_image_url\",\n \"reference_image_urls\",\n \"reference_video_urls\",\n \"reference_audio_urls\",\n \"web_search\",\n \"generate_audio\",\n \"return_last_frame\",\n \"output_format\"\n ]\n },\n {\n \"when\": {\n \"model\": \"seedance-v1-pro-fast\"\n },\n \"forbidden\": [\n \"aspect_ratio\",\n \"source_image_urls\",\n \"lock_camera\",\n \"last_frame_image_url\",\n \"reference_image_urls\",\n \"reference_video_urls\",\n \"reference_audio_urls\",\n \"web_search\",\n \"generate_audio\",\n \"return_last_frame\",\n \"output_format\"\n ]\n }\n ]\n }\n} as const;\n","export { SeedanceClient } 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,gBAAgB,uBAAuB;AAC/D,SAAS,yBAAyB;;;ACF3B,IAAM,WAAW;AAAA,EACtB,iBAAiB;AAAA,IACf,UAAU;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB,oBAAoB;AAAA,QAClB,gBAAgB;AAAA,UACd,QAAQ;AAAA,YAC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;AAAA,IACL,CAAC;AAAA,EACH;AACF;AAEA,IAAM,uCAAuC;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,SAAS,2BAA2B,MAAqC;AACvE,MAAI,KAAK,UAAU,kBAAkB,KAAK,sBAAsB,MAAM;AACpE;AAAA,EACF;AAEA,QAAM,QAAQ,qCAAqC,KAAK,CAAC,cAAc,UAAU,KAAK,SAAS,CAAC,CAAC;AACjG,MAAI,CAAC,OAAO;AACV;AAAA,EACF;AAEA,QAAM,IAAI,gBAAgB,GAAG,KAAK,wEAAwE;AAC5G;AAEA,SAAS,UAAU,OAAyB;AAC1C,MAAI,UAAU,UAAa,UAAU,MAAM;AACzC,WAAO;AAAA,EACT;AACA,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO,MAAM,SAAS;AAAA,EACxB;AACA,MAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,WAAO,MAAM,SAAS;AAAA,EACxB;AACA,SAAO;AACT;;;AD1EO,IAAM,iBAAN,cAA6B,WAAW;AAAA;AAAA,EAE7B;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO;AACb,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAAA,EAC9C;AACF;;;AGxBA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,mBAAAA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":["ValidationError"]}
1
+ {"version":3,"sources":["../src/client.ts","../src/resources/text-to-video.ts","../src/index.ts"],"sourcesContent":["import { BaseClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToVideo } from './resources/text-to-video';\n\n/**\n * Seedance video API client.\n *\n * @example\n * ```typescript\n * const client = new SeedanceClient({\n * apiKey: 'your-api-key',\n * baseUrl: 'https://runapi.ai',\n * });\n *\n * const result = await client.textToVideo.run({\n * model: 'seedance-2.0',\n * prompt: 'A cat walking through a garden',\n * });\n * ```\n */\nexport class SeedanceClient extends BaseClient {\n /** Video generation operations. */\n public readonly textToVideo: TextToVideo;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.textToVideo = new TextToVideo(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 CompletedTextToVideoResponse,\n TextToVideoParams,\n TextToVideoResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/seedance/text_to_video';\n\n/** Generate video from text prompts, optionally conditioned on reference images, frame images, reference videos, or audio. */\nexport class TextToVideo {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Create a text to video task and wait until complete.\n * @param params Text to video parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed text to video response.\n */\n async run(params: TextToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<TextToVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedTextToVideoResponse;\n }\n\n /**\n * Create a text to video task; returns immediately with a task id.\n * @param params Text to video parameters.\n * @param options Per-request overrides.\n * @returns The task creation result.\n */\n async create(params: TextToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\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 video task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current text to video task status.\n */\n async get(id: string, options?: RequestOptions): Promise<TextToVideoResponse> {\n return this.http.request<TextToVideoResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n","export { SeedanceClient } 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;AAGV,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,UAAM,OAAO,cAAc,MAAM;AACjC,WAAO,KAAK,KAAK,QAA4B,QAAQ,UAAU;AAAA,MAC7D;AAAA,MACA,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;;;ADrCO,IAAM,iBAAN,cAA6B,WAAW;AAAA;AAAA,EAE7B;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO;AACb,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAAA,EAC9C;AACF;;;AExBA;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":[]}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "runapi": {
4
4
  "slug": "seedance"
5
5
  },
6
- "version": "0.3.1",
6
+ "version": "0.4.0",
7
7
  "description": "RunAPI Seedance SDK for text-to-video workflows in JavaScript, Python, Ruby, Go, Java, and PHP",
8
8
  "main": "./dist/index.js",
9
9
  "module": "./dist/index.mjs",
@@ -31,7 +31,7 @@
31
31
  "clean": "rm -rf dist"
32
32
  },
33
33
  "dependencies": {
34
- "@runapi.ai/core": "^0.4.2"
34
+ "@runapi.ai/core": "^0.5.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/node": "^20.0.0",