@runapi.ai/seedance 0.2.13 → 0.3.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 +42 -3
- package/dist/index.d.ts +42 -3
- package/dist/index.js +134 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +134 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/skills/seedance/README.md +7 -4
- package/skills/seedance/SKILL.md +68 -33
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TaskResponse, AsyncTaskStatus, TaskBillingResponse, 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
|
-
type SeedanceModel = 'seedance-1.5-pro' | 'seedance-2.0' | 'seedance-2.0-fast' | 'seedance-2-mini' | 'seedance-v1-pro' | 'seedance-v1-pro-fast';
|
|
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';
|
|
5
5
|
type SeedanceModel2 = 'seedance-2.0' | 'seedance-2.0-fast' | 'seedance-2-mini';
|
|
6
6
|
type SeedanceModel2WithSafetyChecker = 'seedance-2.0' | 'seedance-2.0-fast';
|
|
7
7
|
type SeedanceModelV1 = 'seedance-v1-pro' | 'seedance-v1-pro-fast';
|
|
@@ -10,6 +10,7 @@ type AspectRatio2 = AspectRatio15Pro | 'auto';
|
|
|
10
10
|
type AspectRatioV1Pro = '1:1' | '4:3' | '3:4' | '16:9' | '9:16' | '21:9';
|
|
11
11
|
type Resolution15Pro = '480p' | '720p' | '1080p';
|
|
12
12
|
type Resolution2 = '480p' | '720p' | '1080p' | '4k';
|
|
13
|
+
type Resolution25 = '480p' | '720p' | '1080p';
|
|
13
14
|
type ResolutionV1 = '480p' | '720p' | '1080p';
|
|
14
15
|
type ResolutionV1ProFast = '720p' | '1080p';
|
|
15
16
|
type DurationV1 = 5 | 10;
|
|
@@ -107,6 +108,44 @@ interface Generation2ReferenceFields extends Generation2BaseFields {
|
|
|
107
108
|
* Mutually exclusive with frame mode.
|
|
108
109
|
*/
|
|
109
110
|
type Generation2ReferenceParams = Generation2ReferenceFields & Generation2ModelFields;
|
|
111
|
+
type OutputFormat25 = 'mp4' | 'mov';
|
|
112
|
+
interface Generation25BaseFields extends GenerationCommonParams, AudioGenerationParams, SafetyCheckerParams {
|
|
113
|
+
model: 'seedance-2.5';
|
|
114
|
+
aspect_ratio?: AspectRatio2;
|
|
115
|
+
output_resolution?: Resolution25;
|
|
116
|
+
/** `-1` selects duration automatically; explicit durations are integers from 4 through 30. */
|
|
117
|
+
duration_seconds?: number;
|
|
118
|
+
/** Return the generated video's last frame. */
|
|
119
|
+
return_last_frame?: boolean;
|
|
120
|
+
/** Output video container. */
|
|
121
|
+
output_format?: OutputFormat25;
|
|
122
|
+
/** Enable online prompt enrichment. */
|
|
123
|
+
web_search?: boolean;
|
|
124
|
+
}
|
|
125
|
+
interface Generation25TextParams extends Generation25BaseFields {
|
|
126
|
+
first_frame_image_url?: never;
|
|
127
|
+
last_frame_image_url?: never;
|
|
128
|
+
reference_image_urls?: never;
|
|
129
|
+
reference_video_urls?: never;
|
|
130
|
+
reference_audio_urls?: never;
|
|
131
|
+
}
|
|
132
|
+
interface Generation25FrameParams extends Generation25BaseFields {
|
|
133
|
+
first_frame_image_url: string;
|
|
134
|
+
last_frame_image_url?: string;
|
|
135
|
+
reference_image_urls?: never;
|
|
136
|
+
reference_video_urls?: never;
|
|
137
|
+
reference_audio_urls?: never;
|
|
138
|
+
}
|
|
139
|
+
interface Generation25ReferenceParams extends Generation25BaseFields {
|
|
140
|
+
/** Reference image URLs, up to 30. */
|
|
141
|
+
reference_image_urls?: string[];
|
|
142
|
+
/** Reference video URLs, up to 10. */
|
|
143
|
+
reference_video_urls?: string[];
|
|
144
|
+
/** Reference audio URLs, up to 10. */
|
|
145
|
+
reference_audio_urls?: string[];
|
|
146
|
+
first_frame_image_url?: never;
|
|
147
|
+
last_frame_image_url?: never;
|
|
148
|
+
}
|
|
110
149
|
/** Common fields for v1-pro (not v1-pro-fast). */
|
|
111
150
|
interface GenerationV1SharedParams extends GenerationCommonParams, SafetyCheckerParams, SeedParams {
|
|
112
151
|
/** `5` or `10`. Required. */
|
|
@@ -138,7 +177,7 @@ interface GenerationV1ProFastParams extends GenerationCommonParams, SafetyChecke
|
|
|
138
177
|
duration_seconds: DurationV1;
|
|
139
178
|
}
|
|
140
179
|
/** Discriminated union of all generation parameter variants */
|
|
141
|
-
type TextToVideoParams = Generation15ProParams | Generation2TextParams | Generation2FrameParams | Generation2ReferenceParams | GenerationV1ProParams | GenerationV1ProFastParams;
|
|
180
|
+
type TextToVideoParams = Generation15ProParams | Generation2TextParams | Generation2FrameParams | Generation2ReferenceParams | Generation25TextParams | Generation25FrameParams | Generation25ReferenceParams | GenerationV1ProParams | GenerationV1ProFastParams;
|
|
142
181
|
interface TaskCreateResponse extends TaskBillingResponse {
|
|
143
182
|
id: string;
|
|
144
183
|
}
|
|
@@ -212,4 +251,4 @@ declare class SeedanceClient extends BaseClient {
|
|
|
212
251
|
constructor(options?: ClientOptions);
|
|
213
252
|
}
|
|
214
253
|
|
|
215
|
-
export { type AspectRatio15Pro, type AspectRatio2, type AspectRatioV1Pro, type CompletedTextToVideoResponse, type Duration15Pro, type DurationV1, type Generation15ProParams, type Generation2FrameParams, type Generation2ReferenceParams, type Generation2TextParams, type GenerationV1ProFastParams, type GenerationV1ProParams, type Resolution15Pro, type Resolution2, type ResolutionV1, type ResolutionV1ProFast, SeedanceClient, type SeedanceModel, type SeedanceModel2, type SeedanceModel2WithSafetyChecker, type SeedanceModelV1, type TaskCreateResponse, type TextToVideoParams, type TextToVideoResponse, type VideoMetadata };
|
|
254
|
+
export { type AspectRatio15Pro, type AspectRatio2, type AspectRatioV1Pro, type CompletedTextToVideoResponse, type Duration15Pro, type DurationV1, type Generation15ProParams, type Generation25FrameParams, type Generation25ReferenceParams, type Generation25TextParams, type Generation2FrameParams, type Generation2ReferenceParams, type Generation2TextParams, type GenerationV1ProFastParams, type GenerationV1ProParams, type OutputFormat25, type Resolution15Pro, type Resolution2, type Resolution25, type ResolutionV1, type ResolutionV1ProFast, SeedanceClient, type SeedanceModel, type SeedanceModel2, type SeedanceModel2WithSafetyChecker, type SeedanceModelV1, type TaskCreateResponse, type TextToVideoParams, type TextToVideoResponse, type VideoMetadata };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TaskResponse, AsyncTaskStatus, TaskBillingResponse, 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
|
-
type SeedanceModel = 'seedance-1.5-pro' | 'seedance-2.0' | 'seedance-2.0-fast' | 'seedance-2-mini' | 'seedance-v1-pro' | 'seedance-v1-pro-fast';
|
|
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';
|
|
5
5
|
type SeedanceModel2 = 'seedance-2.0' | 'seedance-2.0-fast' | 'seedance-2-mini';
|
|
6
6
|
type SeedanceModel2WithSafetyChecker = 'seedance-2.0' | 'seedance-2.0-fast';
|
|
7
7
|
type SeedanceModelV1 = 'seedance-v1-pro' | 'seedance-v1-pro-fast';
|
|
@@ -10,6 +10,7 @@ type AspectRatio2 = AspectRatio15Pro | 'auto';
|
|
|
10
10
|
type AspectRatioV1Pro = '1:1' | '4:3' | '3:4' | '16:9' | '9:16' | '21:9';
|
|
11
11
|
type Resolution15Pro = '480p' | '720p' | '1080p';
|
|
12
12
|
type Resolution2 = '480p' | '720p' | '1080p' | '4k';
|
|
13
|
+
type Resolution25 = '480p' | '720p' | '1080p';
|
|
13
14
|
type ResolutionV1 = '480p' | '720p' | '1080p';
|
|
14
15
|
type ResolutionV1ProFast = '720p' | '1080p';
|
|
15
16
|
type DurationV1 = 5 | 10;
|
|
@@ -107,6 +108,44 @@ interface Generation2ReferenceFields extends Generation2BaseFields {
|
|
|
107
108
|
* Mutually exclusive with frame mode.
|
|
108
109
|
*/
|
|
109
110
|
type Generation2ReferenceParams = Generation2ReferenceFields & Generation2ModelFields;
|
|
111
|
+
type OutputFormat25 = 'mp4' | 'mov';
|
|
112
|
+
interface Generation25BaseFields extends GenerationCommonParams, AudioGenerationParams, SafetyCheckerParams {
|
|
113
|
+
model: 'seedance-2.5';
|
|
114
|
+
aspect_ratio?: AspectRatio2;
|
|
115
|
+
output_resolution?: Resolution25;
|
|
116
|
+
/** `-1` selects duration automatically; explicit durations are integers from 4 through 30. */
|
|
117
|
+
duration_seconds?: number;
|
|
118
|
+
/** Return the generated video's last frame. */
|
|
119
|
+
return_last_frame?: boolean;
|
|
120
|
+
/** Output video container. */
|
|
121
|
+
output_format?: OutputFormat25;
|
|
122
|
+
/** Enable online prompt enrichment. */
|
|
123
|
+
web_search?: boolean;
|
|
124
|
+
}
|
|
125
|
+
interface Generation25TextParams extends Generation25BaseFields {
|
|
126
|
+
first_frame_image_url?: never;
|
|
127
|
+
last_frame_image_url?: never;
|
|
128
|
+
reference_image_urls?: never;
|
|
129
|
+
reference_video_urls?: never;
|
|
130
|
+
reference_audio_urls?: never;
|
|
131
|
+
}
|
|
132
|
+
interface Generation25FrameParams extends Generation25BaseFields {
|
|
133
|
+
first_frame_image_url: string;
|
|
134
|
+
last_frame_image_url?: string;
|
|
135
|
+
reference_image_urls?: never;
|
|
136
|
+
reference_video_urls?: never;
|
|
137
|
+
reference_audio_urls?: never;
|
|
138
|
+
}
|
|
139
|
+
interface Generation25ReferenceParams extends Generation25BaseFields {
|
|
140
|
+
/** Reference image URLs, up to 30. */
|
|
141
|
+
reference_image_urls?: string[];
|
|
142
|
+
/** Reference video URLs, up to 10. */
|
|
143
|
+
reference_video_urls?: string[];
|
|
144
|
+
/** Reference audio URLs, up to 10. */
|
|
145
|
+
reference_audio_urls?: string[];
|
|
146
|
+
first_frame_image_url?: never;
|
|
147
|
+
last_frame_image_url?: never;
|
|
148
|
+
}
|
|
110
149
|
/** Common fields for v1-pro (not v1-pro-fast). */
|
|
111
150
|
interface GenerationV1SharedParams extends GenerationCommonParams, SafetyCheckerParams, SeedParams {
|
|
112
151
|
/** `5` or `10`. Required. */
|
|
@@ -138,7 +177,7 @@ interface GenerationV1ProFastParams extends GenerationCommonParams, SafetyChecke
|
|
|
138
177
|
duration_seconds: DurationV1;
|
|
139
178
|
}
|
|
140
179
|
/** Discriminated union of all generation parameter variants */
|
|
141
|
-
type TextToVideoParams = Generation15ProParams | Generation2TextParams | Generation2FrameParams | Generation2ReferenceParams | GenerationV1ProParams | GenerationV1ProFastParams;
|
|
180
|
+
type TextToVideoParams = Generation15ProParams | Generation2TextParams | Generation2FrameParams | Generation2ReferenceParams | Generation25TextParams | Generation25FrameParams | Generation25ReferenceParams | GenerationV1ProParams | GenerationV1ProFastParams;
|
|
142
181
|
interface TaskCreateResponse extends TaskBillingResponse {
|
|
143
182
|
id: string;
|
|
144
183
|
}
|
|
@@ -212,4 +251,4 @@ declare class SeedanceClient extends BaseClient {
|
|
|
212
251
|
constructor(options?: ClientOptions);
|
|
213
252
|
}
|
|
214
253
|
|
|
215
|
-
export { type AspectRatio15Pro, type AspectRatio2, type AspectRatioV1Pro, type CompletedTextToVideoResponse, type Duration15Pro, type DurationV1, type Generation15ProParams, type Generation2FrameParams, type Generation2ReferenceParams, type Generation2TextParams, type GenerationV1ProFastParams, type GenerationV1ProParams, type Resolution15Pro, type Resolution2, type ResolutionV1, type ResolutionV1ProFast, SeedanceClient, type SeedanceModel, type SeedanceModel2, type SeedanceModel2WithSafetyChecker, type SeedanceModelV1, type TaskCreateResponse, type TextToVideoParams, type TextToVideoResponse, type VideoMetadata };
|
|
254
|
+
export { type AspectRatio15Pro, type AspectRatio2, type AspectRatioV1Pro, type CompletedTextToVideoResponse, type Duration15Pro, type DurationV1, type Generation15ProParams, type Generation25FrameParams, type Generation25ReferenceParams, type Generation25TextParams, type Generation2FrameParams, type Generation2ReferenceParams, type Generation2TextParams, type GenerationV1ProFastParams, type GenerationV1ProParams, type OutputFormat25, type Resolution15Pro, type Resolution2, type Resolution25, type ResolutionV1, type ResolutionV1ProFast, SeedanceClient, type SeedanceModel, type SeedanceModel2, type SeedanceModel2WithSafetyChecker, type SeedanceModelV1, type TaskCreateResponse, type TextToVideoParams, type TextToVideoResponse, type VideoMetadata };
|
package/dist/index.js
CHANGED
|
@@ -50,6 +50,7 @@ var contract = {
|
|
|
50
50
|
"seedance-2-mini",
|
|
51
51
|
"seedance-2.0",
|
|
52
52
|
"seedance-2.0-fast",
|
|
53
|
+
"seedance-2.5",
|
|
53
54
|
"seedance-v1-pro",
|
|
54
55
|
"seedance-v1-pro-fast"
|
|
55
56
|
],
|
|
@@ -188,6 +189,83 @@ var contract = {
|
|
|
188
189
|
"max_items": 3
|
|
189
190
|
}
|
|
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
|
+
},
|
|
191
269
|
"seedance-v1-pro": {
|
|
192
270
|
"aspect_ratio": {
|
|
193
271
|
"enum": [
|
|
@@ -244,6 +322,35 @@ var contract = {
|
|
|
244
322
|
}
|
|
245
323
|
},
|
|
246
324
|
"rules": [
|
|
325
|
+
{
|
|
326
|
+
"when": {
|
|
327
|
+
"model": "seedance-2.5",
|
|
328
|
+
"first_frame_image_url": {
|
|
329
|
+
"present": true
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
"forbidden": [
|
|
333
|
+
"reference_image_urls",
|
|
334
|
+
"reference_video_urls",
|
|
335
|
+
"reference_audio_urls"
|
|
336
|
+
]
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
"when": {
|
|
340
|
+
"model": "seedance-2.5",
|
|
341
|
+
"last_frame_image_url": {
|
|
342
|
+
"present": true
|
|
343
|
+
}
|
|
344
|
+
},
|
|
345
|
+
"required": [
|
|
346
|
+
"first_frame_image_url"
|
|
347
|
+
],
|
|
348
|
+
"forbidden": [
|
|
349
|
+
"reference_image_urls",
|
|
350
|
+
"reference_video_urls",
|
|
351
|
+
"reference_audio_urls"
|
|
352
|
+
]
|
|
353
|
+
},
|
|
247
354
|
{
|
|
248
355
|
"when": {
|
|
249
356
|
"model": "seedance-1.5-pro"
|
|
@@ -254,7 +361,9 @@ var contract = {
|
|
|
254
361
|
"reference_image_urls",
|
|
255
362
|
"reference_video_urls",
|
|
256
363
|
"reference_audio_urls",
|
|
257
|
-
"web_search"
|
|
364
|
+
"web_search",
|
|
365
|
+
"return_last_frame",
|
|
366
|
+
"output_format"
|
|
258
367
|
]
|
|
259
368
|
},
|
|
260
369
|
{
|
|
@@ -265,7 +374,9 @@ var contract = {
|
|
|
265
374
|
"source_image_urls",
|
|
266
375
|
"lock_camera",
|
|
267
376
|
"seed",
|
|
268
|
-
"enable_safety_checker"
|
|
377
|
+
"enable_safety_checker",
|
|
378
|
+
"return_last_frame",
|
|
379
|
+
"output_format"
|
|
269
380
|
]
|
|
270
381
|
},
|
|
271
382
|
{
|
|
@@ -275,13 +386,27 @@ var contract = {
|
|
|
275
386
|
"forbidden": [
|
|
276
387
|
"source_image_urls",
|
|
277
388
|
"lock_camera",
|
|
278
|
-
"seed"
|
|
389
|
+
"seed",
|
|
390
|
+
"return_last_frame",
|
|
391
|
+
"output_format"
|
|
279
392
|
]
|
|
280
393
|
},
|
|
281
394
|
{
|
|
282
395
|
"when": {
|
|
283
396
|
"model": "seedance-2.0-fast"
|
|
284
397
|
},
|
|
398
|
+
"forbidden": [
|
|
399
|
+
"source_image_urls",
|
|
400
|
+
"lock_camera",
|
|
401
|
+
"seed",
|
|
402
|
+
"return_last_frame",
|
|
403
|
+
"output_format"
|
|
404
|
+
]
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
"when": {
|
|
408
|
+
"model": "seedance-2.5"
|
|
409
|
+
},
|
|
285
410
|
"forbidden": [
|
|
286
411
|
"source_image_urls",
|
|
287
412
|
"lock_camera",
|
|
@@ -299,7 +424,9 @@ var contract = {
|
|
|
299
424
|
"reference_video_urls",
|
|
300
425
|
"reference_audio_urls",
|
|
301
426
|
"web_search",
|
|
302
|
-
"generate_audio"
|
|
427
|
+
"generate_audio",
|
|
428
|
+
"return_last_frame",
|
|
429
|
+
"output_format"
|
|
303
430
|
]
|
|
304
431
|
},
|
|
305
432
|
{
|
|
@@ -315,7 +442,9 @@ var contract = {
|
|
|
315
442
|
"reference_video_urls",
|
|
316
443
|
"reference_audio_urls",
|
|
317
444
|
"web_search",
|
|
318
|
-
"generate_audio"
|
|
445
|
+
"generate_audio",
|
|
446
|
+
"return_last_frame",
|
|
447
|
+
"output_format"
|
|
319
448
|
]
|
|
320
449
|
}
|
|
321
450
|
]
|
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-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-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 \"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 ]\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 ]\n },\n {\n \"when\": {\n \"model\": \"seedance-2.0\"\n },\n \"forbidden\": [\n \"source_image_urls\",\n \"lock_camera\",\n \"seed\"\n ]\n },\n {\n \"when\": {\n \"model\": \"seedance-2.0-fast\"\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 ]\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 ]\n }\n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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,4BAAgB,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,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","../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 \"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,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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;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,4BAAgB,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,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
|
@@ -13,6 +13,7 @@ var contract = {
|
|
|
13
13
|
"seedance-2-mini",
|
|
14
14
|
"seedance-2.0",
|
|
15
15
|
"seedance-2.0-fast",
|
|
16
|
+
"seedance-2.5",
|
|
16
17
|
"seedance-v1-pro",
|
|
17
18
|
"seedance-v1-pro-fast"
|
|
18
19
|
],
|
|
@@ -151,6 +152,83 @@ var contract = {
|
|
|
151
152
|
"max_items": 3
|
|
152
153
|
}
|
|
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
|
+
},
|
|
154
232
|
"seedance-v1-pro": {
|
|
155
233
|
"aspect_ratio": {
|
|
156
234
|
"enum": [
|
|
@@ -207,6 +285,35 @@ var contract = {
|
|
|
207
285
|
}
|
|
208
286
|
},
|
|
209
287
|
"rules": [
|
|
288
|
+
{
|
|
289
|
+
"when": {
|
|
290
|
+
"model": "seedance-2.5",
|
|
291
|
+
"first_frame_image_url": {
|
|
292
|
+
"present": true
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
"forbidden": [
|
|
296
|
+
"reference_image_urls",
|
|
297
|
+
"reference_video_urls",
|
|
298
|
+
"reference_audio_urls"
|
|
299
|
+
]
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
"when": {
|
|
303
|
+
"model": "seedance-2.5",
|
|
304
|
+
"last_frame_image_url": {
|
|
305
|
+
"present": true
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
"required": [
|
|
309
|
+
"first_frame_image_url"
|
|
310
|
+
],
|
|
311
|
+
"forbidden": [
|
|
312
|
+
"reference_image_urls",
|
|
313
|
+
"reference_video_urls",
|
|
314
|
+
"reference_audio_urls"
|
|
315
|
+
]
|
|
316
|
+
},
|
|
210
317
|
{
|
|
211
318
|
"when": {
|
|
212
319
|
"model": "seedance-1.5-pro"
|
|
@@ -217,7 +324,9 @@ var contract = {
|
|
|
217
324
|
"reference_image_urls",
|
|
218
325
|
"reference_video_urls",
|
|
219
326
|
"reference_audio_urls",
|
|
220
|
-
"web_search"
|
|
327
|
+
"web_search",
|
|
328
|
+
"return_last_frame",
|
|
329
|
+
"output_format"
|
|
221
330
|
]
|
|
222
331
|
},
|
|
223
332
|
{
|
|
@@ -228,7 +337,9 @@ var contract = {
|
|
|
228
337
|
"source_image_urls",
|
|
229
338
|
"lock_camera",
|
|
230
339
|
"seed",
|
|
231
|
-
"enable_safety_checker"
|
|
340
|
+
"enable_safety_checker",
|
|
341
|
+
"return_last_frame",
|
|
342
|
+
"output_format"
|
|
232
343
|
]
|
|
233
344
|
},
|
|
234
345
|
{
|
|
@@ -238,13 +349,27 @@ var contract = {
|
|
|
238
349
|
"forbidden": [
|
|
239
350
|
"source_image_urls",
|
|
240
351
|
"lock_camera",
|
|
241
|
-
"seed"
|
|
352
|
+
"seed",
|
|
353
|
+
"return_last_frame",
|
|
354
|
+
"output_format"
|
|
242
355
|
]
|
|
243
356
|
},
|
|
244
357
|
{
|
|
245
358
|
"when": {
|
|
246
359
|
"model": "seedance-2.0-fast"
|
|
247
360
|
},
|
|
361
|
+
"forbidden": [
|
|
362
|
+
"source_image_urls",
|
|
363
|
+
"lock_camera",
|
|
364
|
+
"seed",
|
|
365
|
+
"return_last_frame",
|
|
366
|
+
"output_format"
|
|
367
|
+
]
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
"when": {
|
|
371
|
+
"model": "seedance-2.5"
|
|
372
|
+
},
|
|
248
373
|
"forbidden": [
|
|
249
374
|
"source_image_urls",
|
|
250
375
|
"lock_camera",
|
|
@@ -262,7 +387,9 @@ var contract = {
|
|
|
262
387
|
"reference_video_urls",
|
|
263
388
|
"reference_audio_urls",
|
|
264
389
|
"web_search",
|
|
265
|
-
"generate_audio"
|
|
390
|
+
"generate_audio",
|
|
391
|
+
"return_last_frame",
|
|
392
|
+
"output_format"
|
|
266
393
|
]
|
|
267
394
|
},
|
|
268
395
|
{
|
|
@@ -278,7 +405,9 @@ var contract = {
|
|
|
278
405
|
"reference_video_urls",
|
|
279
406
|
"reference_audio_urls",
|
|
280
407
|
"web_search",
|
|
281
|
-
"generate_audio"
|
|
408
|
+
"generate_audio",
|
|
409
|
+
"return_last_frame",
|
|
410
|
+
"output_format"
|
|
282
411
|
]
|
|
283
412
|
}
|
|
284
413
|
]
|
package/dist/index.mjs.map
CHANGED
|
@@ -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-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-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 \"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 ]\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 ]\n },\n {\n \"when\": {\n \"model\": \"seedance-2.0\"\n },\n \"forbidden\": [\n \"source_image_urls\",\n \"lock_camera\",\n \"seed\"\n ]\n },\n {\n \"when\": {\n \"model\": \"seedance-2.0-fast\"\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 ]\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 ]\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,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;AAAA,YACN;AAAA,YACA;AAAA,YACA;A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/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 \"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,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;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,QACA,oBAAoB;AAAA,UAClB,OAAO;AAAA,UACP,OAAO;AAAA,UACP,QAAQ;AAAA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G;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"]}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"runapi": {
|
|
4
4
|
"slug": "seedance"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.3.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.
|
|
34
|
+
"@runapi.ai/core": "^0.4.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "^20.0.0",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
</div>
|
|
22
22
|
<br/>
|
|
23
23
|
|
|
24
|
-
Generate video with Seedance 1.5 Pro, 2.0, 2.0 Fast,
|
|
24
|
+
Generate video with Seedance 1.5 Pro, 2.0, 2.0 Fast, 2.0 Mini, and 2.5 text, frame, and reference workflows. This skill helps Claude Code, Codex, Gemini CLI, Cursor, and 50+ agents integrate Seedance through RunAPI.
|
|
25
25
|
|
|
26
26
|
The canonical agent file is `skills/seedance/SKILL.md`.
|
|
27
27
|
|
|
@@ -51,9 +51,11 @@ import { SeedanceClient } from '@runapi.ai/seedance';
|
|
|
51
51
|
|
|
52
52
|
const client = new SeedanceClient();
|
|
53
53
|
const result = await client.textToVideo.run({
|
|
54
|
-
model: 'seedance-2.
|
|
55
|
-
prompt: 'A drone shot over mountains at sunset',
|
|
56
|
-
|
|
54
|
+
model: 'seedance-2.5',
|
|
55
|
+
prompt: 'A drone shot over mountains at sunset, following the reference pacing',
|
|
56
|
+
reference_video_urls: ['https://storage.googleapis.com/gtv-videos-bucket/sample/ForBiggerJoyrides.mp4'],
|
|
57
|
+
duration_seconds: -1,
|
|
58
|
+
output_resolution: '720p',
|
|
57
59
|
});
|
|
58
60
|
const url = result.videos[0].url;
|
|
59
61
|
```
|
|
@@ -76,6 +78,7 @@ const url = result.videos[0].url;
|
|
|
76
78
|
- [2.0](https://runapi.ai/models/seedance/2.0)
|
|
77
79
|
- [2.0 fast](https://runapi.ai/models/seedance/2.0-fast)
|
|
78
80
|
- [2.0 mini](https://runapi.ai/models/seedance/2-mini)
|
|
81
|
+
- [2.5](https://runapi.ai/models/seedance/2.5)
|
|
79
82
|
|
|
80
83
|
## Agent rules
|
|
81
84
|
|
package/skills/seedance/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: seedance
|
|
3
|
-
description: Generate and edit video with Seedance through RunAPI. Use when the user asks an agent to create, edit, or transform video with Seedance. Default to the RunAPI CLI for one-off generation; use SDKs only when the user is integrating RunAPI into an app or backend.
|
|
3
|
+
description: "Generate and edit video with Seedance through RunAPI. Use when the user asks an agent to create, edit, or transform video with Seedance. Default to the RunAPI CLI for one-off generation; use SDKs only when the user is integrating RunAPI into an app or backend."
|
|
4
4
|
documentation: https://runapi.ai/models/seedance.md
|
|
5
5
|
provider_page: https://runapi.ai/providers/bytedance.md
|
|
6
6
|
catalog: https://runapi.ai/models.md
|
|
@@ -23,64 +23,99 @@ metadata:
|
|
|
23
23
|
|
|
24
24
|
# Seedance on RunAPI
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
## Choose route
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
- For a one-off artifact or result, use the registered `seedance` service in the `runapi` CLI. If the installed command catalog does not list it, stop and report the missing service instead of inventing a command.
|
|
29
|
+
- For an app, backend, worker, library, webhook pipeline, or production codebase, go directly to **Integrate with SDK**. Never shell out to the CLI as the production runtime.
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
- One-off generation, editing, transformation, manual smoke tests, debugging, or user-requested CLI runs use the **CLI path** with the `runapi` binary. For full CLI-specific agent guidance, see https://github.com/runapi-ai/cli-skill.
|
|
32
|
-
- Never shell out to the `runapi` CLI as the production runtime integration layer.
|
|
31
|
+
## Discover contract
|
|
33
32
|
|
|
34
|
-
|
|
33
|
+
Authenticate, then inspect the installed command catalog and the selected operation's current contract:
|
|
35
34
|
|
|
36
|
-
|
|
35
|
+
```shell
|
|
36
|
+
runapi auth status > auth.json
|
|
37
|
+
jq -e '.authenticated == true' auth.json
|
|
38
|
+
runapi seedance --help
|
|
39
|
+
runapi seedance <operation> --help
|
|
40
|
+
curl --fail --location https://runapi.ai/docs/api/seedance/<operation>.md --output contract.md
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
If authentication is false, stop before submitting. Ask the user to provide a valid `RUNAPI_API_KEY`, or import a user-provided key from stdin with `runapi auth import-token --token -`; use interactive browser login only when the user explicitly requests it. Choose `<operation>` only from service help. Treat command help as authoritative for the installed operation, model, and top-level field roster. Treat its API Reference as authoritative for the complete request schema, nested fields, conditional rules, task behavior, and response variants. If the two surfaces disagree, stop and report the contract mismatch instead of guessing.
|
|
44
|
+
|
|
45
|
+
## Build request
|
|
37
46
|
|
|
38
|
-
|
|
39
|
-
- PHP: `runapi-ai/seedance`
|
|
40
|
-
- Ruby: `runapi-seedance`
|
|
41
|
-
- Go: `github.com/runapi-ai/seedance-sdk/go`
|
|
47
|
+
Create `request.json` as valid JSON using only fields accepted by the discovered operation contract. For the chosen model and values, evaluate every applicable conditional rule as a set: satisfy every required field, omit every forbidden field, and stop on unresolved contradictions.
|
|
42
48
|
|
|
43
|
-
|
|
49
|
+
Traverse nested objects and arrays before execution. Close every relationship stated by the discovered contract, including uniqueness constraints and cross-references between nested values.
|
|
44
50
|
|
|
45
|
-
|
|
51
|
+
For a discovered local media input, including file-typed fields and top-level media URL fields, put an agent-readable local file path directly in `request.json`. The CLI consumes file fields as declared and uploads local paths in top-level media URL fields. Use `runapi files create` only when the user needs a reusable URL, provides Base64, or the discovered contract explicitly requires a separate upload.
|
|
46
52
|
|
|
47
|
-
|
|
53
|
+
Validate the file before sending it:
|
|
48
54
|
|
|
49
55
|
```shell
|
|
50
|
-
|
|
51
|
-
|
|
56
|
+
jq empty request.json
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Execute
|
|
60
|
+
|
|
61
|
+
Submit exactly once and persist the task response before waiting:
|
|
62
|
+
|
|
63
|
+
```shell
|
|
64
|
+
runapi seedance <operation> --async --input-file request.json > task.json
|
|
65
|
+
task_id="$(jq -er '.id' task.json)"
|
|
52
66
|
```
|
|
53
67
|
|
|
54
|
-
|
|
68
|
+
For a one-off result, immediately wait for that same task and save the complete JSON response. This blocking wait is the default:
|
|
55
69
|
|
|
56
70
|
```shell
|
|
57
|
-
runapi
|
|
71
|
+
runapi wait "$task_id" --service seedance --action <operation> > result.json
|
|
58
72
|
```
|
|
59
73
|
|
|
60
|
-
|
|
74
|
+
Only when the user explicitly asks for background execution, polling, or webhook integration may you stop after validating `task.json`. Report the task id and do not claim that the deliverable is complete.
|
|
75
|
+
|
|
76
|
+
## Verify
|
|
77
|
+
|
|
78
|
+
A success status is not the deliverable. Read and validate the complete response according to the discovered result contract. Preserve the complete non-media result in the exact requested format, including JSON, text, SRT, or VTT.
|
|
79
|
+
|
|
80
|
+
For every requested media deliverable listed anywhere in the response, download all of them rather than returning only the first URL. Before downloading, derive its expected MIME type or family from response metadata when present, then the selected output format, then an unambiguous result field such as `videos`, `images`, or `audios` in the API Reference. The Catalog-declared fallback families for this skill are `video/*`. Stop only when no single expected type or family can be established from those sources.
|
|
81
|
+
|
|
82
|
+
For every downloaded file, require both a non-empty file and the expected MIME type or family:
|
|
61
83
|
|
|
62
84
|
```shell
|
|
63
|
-
|
|
64
|
-
|
|
85
|
+
curl --fail --location <deliverable-url> --output <downloaded-file>
|
|
86
|
+
for file in <downloaded-files>; do
|
|
87
|
+
expected_mime=<expected-MIME-or-family-pattern-for-this-file>
|
|
88
|
+
test -s "$file"
|
|
89
|
+
[[ "$(file --brief --mime-type "$file")" == $expected_mime ]]
|
|
90
|
+
done
|
|
65
91
|
```
|
|
66
92
|
|
|
67
|
-
|
|
93
|
+
Do not report completion when any requested deliverable is missing, empty, or has an unexpected MIME type. Record `Skill Conformance` separately from `Task Outcome` so a service failure does not hide whether this recipe was followed.
|
|
94
|
+
|
|
95
|
+
## Recover or stop
|
|
68
96
|
|
|
69
|
-
|
|
97
|
+
- Correct a request shape at most once, and only when the discovered contract or returned validation error identifies the correction.
|
|
98
|
+
- Retry a transient transport failure at most once, and only when evidence confirms that no task was created, no billing occurred, and retrying is safe.
|
|
99
|
+
- If waiting times out or loses transport after `task.json` exists, preserve the error and rerun `runapi wait` for that same task at most once. Never submit a replacement task.
|
|
100
|
+
- On a terminal RunAPI or service failure, preserve the task/error evidence and stop. Keep the selected model and capability, and do not submit another paid request without user authorization.
|
|
101
|
+
- If the contract is missing a fact required to build or verify the request, stop and report the contract gap. Do not turn a product defect into a permanent skill workaround.
|
|
70
102
|
|
|
71
|
-
|
|
103
|
+
## Integrate with SDK
|
|
104
|
+
|
|
105
|
+
Use this route only for application or production-code integration. Open the current RunAPI SDK reference below, select the package for the target language and `Seedance`, and confirm its install command, client methods, request types, response types, and error classes before coding. Build the request from the same discovered product contract and apply the same deliverable verification and stop rules. Do not invoke `runapi` as a subprocess from production code.
|
|
72
106
|
|
|
73
107
|
## References
|
|
74
108
|
|
|
75
109
|
- Model overview, pricing, and rate limits: https://runapi.ai/models/seedance.md
|
|
76
|
-
- Provider
|
|
110
|
+
- Provider overview: https://runapi.ai/providers/bytedance.md
|
|
77
111
|
- Full model catalog: https://runapi.ai/models.md
|
|
112
|
+
- SDK integration: https://github.com/runapi-ai/seedance-sdk
|
|
78
113
|
|
|
79
114
|
## Variants
|
|
80
|
-
|
|
81
|
-
-
|
|
82
|
-
-
|
|
83
|
-
-
|
|
84
|
-
-
|
|
85
|
-
-
|
|
86
|
-
-
|
|
115
|
+
- `seedance-1.5-pro`: https://runapi.ai/models/seedance/1.5-pro.md
|
|
116
|
+
- `seedance-2-mini`: https://runapi.ai/models/seedance/2-mini.md
|
|
117
|
+
- `seedance-2.0`: https://runapi.ai/models/seedance/2.0.md
|
|
118
|
+
- `seedance-2.0-fast`: https://runapi.ai/models/seedance/2.0-fast.md
|
|
119
|
+
- `seedance-2.5`: https://runapi.ai/models/seedance/2.5.md
|
|
120
|
+
- `seedance-v1-pro`: https://runapi.ai/models/seedance/v1-pro.md
|
|
121
|
+
- `seedance-v1-pro-fast`: https://runapi.ai/models/seedance/v1-pro-fast.md
|