@runapi.ai/seedance 0.2.12 → 0.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/index.d.mts +44 -19
- package/dist/index.d.ts +44 -19
- package/dist/index.js +105 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +105 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/skills/seedance/README.md +10 -8
- package/skills/seedance/SKILL.md +68 -34
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The Seedance JavaScript SDK is the language-specific package for Seedance on RunAPI. Use this package for video generation, animation, and video editing workflows when your application needs request bodies, task status lookup, and consistent RunAPI errors in JavaScript.
|
|
4
4
|
|
|
5
|
-
This README is the JavaScript package guide inside the public `seedance-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/seedance; for API reference, use https://runapi.ai/docs
|
|
5
|
+
This README is the JavaScript package guide inside the public `seedance-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/seedance; for API reference, use https://runapi.ai/docs/api/seedance/text-to-video; for SDK docs, use https://runapi.ai/docs/resources/sdks.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -17,7 +17,7 @@ import { SeedanceClient } from '@runapi.ai/seedance';
|
|
|
17
17
|
|
|
18
18
|
const client = new SeedanceClient();
|
|
19
19
|
const task = await client.textToVideo.create({
|
|
20
|
-
// Pass the Seedance JSON request body from https://runapi.ai/docs
|
|
20
|
+
// Pass the Seedance JSON request body from https://runapi.ai/docs/api/seedance/text-to-video.
|
|
21
21
|
});
|
|
22
22
|
const status = await client.textToVideo.get(task.id);
|
|
23
23
|
```
|
|
@@ -33,9 +33,9 @@ Use the TypeScript types in `src/types.ts` and the resource classes under `src/r
|
|
|
33
33
|
## Links
|
|
34
34
|
|
|
35
35
|
- Model page: https://runapi.ai/models/seedance
|
|
36
|
-
- SDK docs: https://runapi.ai/docs
|
|
37
|
-
- Product docs: https://runapi.ai/docs
|
|
38
|
-
- Pricing and rate limits: https://runapi.ai/models/seedance/v1-
|
|
36
|
+
- SDK docs: https://runapi.ai/docs/resources/sdks
|
|
37
|
+
- Product docs: https://runapi.ai/docs/api/seedance/text-to-video
|
|
38
|
+
- Pricing and rate limits: https://runapi.ai/models/seedance/v1-pro
|
|
39
39
|
- Provider comparison: https://runapi.ai/providers/bytedance
|
|
40
40
|
- Full catalog: https://runapi.ai/models
|
|
41
41
|
- Repository: https://github.com/runapi-ai/seedance-sdk
|
package/dist/index.d.mts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
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
|
|
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
|
-
type SeedanceModelV1 = 'seedance-v1-
|
|
7
|
+
type SeedanceModelV1 = 'seedance-v1-pro' | 'seedance-v1-pro-fast';
|
|
8
8
|
type AspectRatio15Pro = '1:1' | '4:3' | '3:4' | '16:9' | '9:16' | '21:9';
|
|
9
9
|
type AspectRatio2 = AspectRatio15Pro | 'auto';
|
|
10
|
-
type AspectRatioV1Lite = '1:1' | '4:3' | '3:4' | '16:9' | '9:16' | '9:21';
|
|
11
10
|
type AspectRatioV1Pro = '1:1' | '4:3' | '3:4' | '16:9' | '9:16' | '21:9';
|
|
12
11
|
type Resolution15Pro = '480p' | '720p' | '1080p';
|
|
13
12
|
type Resolution2 = '480p' | '720p' | '1080p' | '4k';
|
|
13
|
+
type Resolution25 = '480p' | '720p';
|
|
14
14
|
type ResolutionV1 = '480p' | '720p' | '1080p';
|
|
15
15
|
type ResolutionV1ProFast = '720p' | '1080p';
|
|
16
16
|
type DurationV1 = 5 | 10;
|
|
@@ -108,7 +108,45 @@ interface Generation2ReferenceFields extends Generation2BaseFields {
|
|
|
108
108
|
* Mutually exclusive with frame mode.
|
|
109
109
|
*/
|
|
110
110
|
type Generation2ReferenceParams = Generation2ReferenceFields & Generation2ModelFields;
|
|
111
|
-
|
|
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
|
+
}
|
|
149
|
+
/** Common fields for v1-pro (not v1-pro-fast). */
|
|
112
150
|
interface GenerationV1SharedParams extends GenerationCommonParams, SafetyCheckerParams, SeedParams {
|
|
113
151
|
/** `5` or `10`. Required. */
|
|
114
152
|
duration_seconds: DurationV1;
|
|
@@ -116,19 +154,6 @@ interface GenerationV1SharedParams extends GenerationCommonParams, SafetyChecker
|
|
|
116
154
|
/** Lock camera movement */
|
|
117
155
|
lock_camera?: boolean;
|
|
118
156
|
}
|
|
119
|
-
/**
|
|
120
|
-
* seedance-v1-lite text-to-video or image-to-video. Mode is auto-detected by
|
|
121
|
-
* `first_frame_image_url` presence. `last_frame_image_url` is only valid in image-to-video mode.
|
|
122
|
-
*/
|
|
123
|
-
interface GenerationV1LiteParams extends GenerationV1SharedParams {
|
|
124
|
-
model: 'seedance-v1-lite';
|
|
125
|
-
/** Required in text-to-video mode. Omit when `first_frame_image_url` is set. */
|
|
126
|
-
aspect_ratio?: AspectRatioV1Lite;
|
|
127
|
-
/** First frame image URL. Triggers image-to-video mode when set. */
|
|
128
|
-
first_frame_image_url?: string;
|
|
129
|
-
/** Ending frame image URL; image-to-video mode only. */
|
|
130
|
-
last_frame_image_url?: string;
|
|
131
|
-
}
|
|
132
157
|
/**
|
|
133
158
|
* seedance-v1-pro text-to-video or image-to-video. Mode is auto-detected by
|
|
134
159
|
* `first_frame_image_url` presence.
|
|
@@ -152,7 +177,7 @@ interface GenerationV1ProFastParams extends GenerationCommonParams, SafetyChecke
|
|
|
152
177
|
duration_seconds: DurationV1;
|
|
153
178
|
}
|
|
154
179
|
/** Discriminated union of all generation parameter variants */
|
|
155
|
-
type TextToVideoParams = Generation15ProParams | Generation2TextParams | Generation2FrameParams | Generation2ReferenceParams |
|
|
180
|
+
type TextToVideoParams = Generation15ProParams | Generation2TextParams | Generation2FrameParams | Generation2ReferenceParams | Generation25TextParams | Generation25FrameParams | Generation25ReferenceParams | GenerationV1ProParams | GenerationV1ProFastParams;
|
|
156
181
|
interface TaskCreateResponse extends TaskBillingResponse {
|
|
157
182
|
id: string;
|
|
158
183
|
}
|
|
@@ -226,4 +251,4 @@ declare class SeedanceClient extends BaseClient {
|
|
|
226
251
|
constructor(options?: ClientOptions);
|
|
227
252
|
}
|
|
228
253
|
|
|
229
|
-
export { type AspectRatio15Pro, type AspectRatio2, type
|
|
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,16 +1,16 @@
|
|
|
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
|
|
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
|
-
type SeedanceModelV1 = 'seedance-v1-
|
|
7
|
+
type SeedanceModelV1 = 'seedance-v1-pro' | 'seedance-v1-pro-fast';
|
|
8
8
|
type AspectRatio15Pro = '1:1' | '4:3' | '3:4' | '16:9' | '9:16' | '21:9';
|
|
9
9
|
type AspectRatio2 = AspectRatio15Pro | 'auto';
|
|
10
|
-
type AspectRatioV1Lite = '1:1' | '4:3' | '3:4' | '16:9' | '9:16' | '9:21';
|
|
11
10
|
type AspectRatioV1Pro = '1:1' | '4:3' | '3:4' | '16:9' | '9:16' | '21:9';
|
|
12
11
|
type Resolution15Pro = '480p' | '720p' | '1080p';
|
|
13
12
|
type Resolution2 = '480p' | '720p' | '1080p' | '4k';
|
|
13
|
+
type Resolution25 = '480p' | '720p';
|
|
14
14
|
type ResolutionV1 = '480p' | '720p' | '1080p';
|
|
15
15
|
type ResolutionV1ProFast = '720p' | '1080p';
|
|
16
16
|
type DurationV1 = 5 | 10;
|
|
@@ -108,7 +108,45 @@ interface Generation2ReferenceFields extends Generation2BaseFields {
|
|
|
108
108
|
* Mutually exclusive with frame mode.
|
|
109
109
|
*/
|
|
110
110
|
type Generation2ReferenceParams = Generation2ReferenceFields & Generation2ModelFields;
|
|
111
|
-
|
|
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
|
+
}
|
|
149
|
+
/** Common fields for v1-pro (not v1-pro-fast). */
|
|
112
150
|
interface GenerationV1SharedParams extends GenerationCommonParams, SafetyCheckerParams, SeedParams {
|
|
113
151
|
/** `5` or `10`. Required. */
|
|
114
152
|
duration_seconds: DurationV1;
|
|
@@ -116,19 +154,6 @@ interface GenerationV1SharedParams extends GenerationCommonParams, SafetyChecker
|
|
|
116
154
|
/** Lock camera movement */
|
|
117
155
|
lock_camera?: boolean;
|
|
118
156
|
}
|
|
119
|
-
/**
|
|
120
|
-
* seedance-v1-lite text-to-video or image-to-video. Mode is auto-detected by
|
|
121
|
-
* `first_frame_image_url` presence. `last_frame_image_url` is only valid in image-to-video mode.
|
|
122
|
-
*/
|
|
123
|
-
interface GenerationV1LiteParams extends GenerationV1SharedParams {
|
|
124
|
-
model: 'seedance-v1-lite';
|
|
125
|
-
/** Required in text-to-video mode. Omit when `first_frame_image_url` is set. */
|
|
126
|
-
aspect_ratio?: AspectRatioV1Lite;
|
|
127
|
-
/** First frame image URL. Triggers image-to-video mode when set. */
|
|
128
|
-
first_frame_image_url?: string;
|
|
129
|
-
/** Ending frame image URL; image-to-video mode only. */
|
|
130
|
-
last_frame_image_url?: string;
|
|
131
|
-
}
|
|
132
157
|
/**
|
|
133
158
|
* seedance-v1-pro text-to-video or image-to-video. Mode is auto-detected by
|
|
134
159
|
* `first_frame_image_url` presence.
|
|
@@ -152,7 +177,7 @@ interface GenerationV1ProFastParams extends GenerationCommonParams, SafetyChecke
|
|
|
152
177
|
duration_seconds: DurationV1;
|
|
153
178
|
}
|
|
154
179
|
/** Discriminated union of all generation parameter variants */
|
|
155
|
-
type TextToVideoParams = Generation15ProParams | Generation2TextParams | Generation2FrameParams | Generation2ReferenceParams |
|
|
180
|
+
type TextToVideoParams = Generation15ProParams | Generation2TextParams | Generation2FrameParams | Generation2ReferenceParams | Generation25TextParams | Generation25FrameParams | Generation25ReferenceParams | GenerationV1ProParams | GenerationV1ProFastParams;
|
|
156
181
|
interface TaskCreateResponse extends TaskBillingResponse {
|
|
157
182
|
id: string;
|
|
158
183
|
}
|
|
@@ -226,4 +251,4 @@ declare class SeedanceClient extends BaseClient {
|
|
|
226
251
|
constructor(options?: ClientOptions);
|
|
227
252
|
}
|
|
228
253
|
|
|
229
|
-
export { type AspectRatio15Pro, type AspectRatio2, type
|
|
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,7 +50,7 @@ var contract = {
|
|
|
50
50
|
"seedance-2-mini",
|
|
51
51
|
"seedance-2.0",
|
|
52
52
|
"seedance-2.0-fast",
|
|
53
|
-
"seedance-
|
|
53
|
+
"seedance-2.5",
|
|
54
54
|
"seedance-v1-pro",
|
|
55
55
|
"seedance-v1-pro-fast"
|
|
56
56
|
],
|
|
@@ -189,7 +189,7 @@ var contract = {
|
|
|
189
189
|
"max_items": 3
|
|
190
190
|
}
|
|
191
191
|
},
|
|
192
|
-
"seedance-
|
|
192
|
+
"seedance-2.5": {
|
|
193
193
|
"aspect_ratio": {
|
|
194
194
|
"enum": [
|
|
195
195
|
"1:1",
|
|
@@ -197,26 +197,72 @@ var contract = {
|
|
|
197
197
|
"3:4",
|
|
198
198
|
"16:9",
|
|
199
199
|
"9:16",
|
|
200
|
-
"9
|
|
200
|
+
"21:9",
|
|
201
|
+
"auto"
|
|
201
202
|
]
|
|
202
203
|
},
|
|
203
204
|
"duration_seconds": {
|
|
204
205
|
"enum": [
|
|
206
|
+
-1,
|
|
207
|
+
4,
|
|
205
208
|
5,
|
|
206
|
-
|
|
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
|
|
207
234
|
],
|
|
208
|
-
"required": true,
|
|
209
235
|
"type": "integer"
|
|
210
236
|
},
|
|
237
|
+
"model": {
|
|
238
|
+
"required": true
|
|
239
|
+
},
|
|
240
|
+
"output_format": {
|
|
241
|
+
"enum": [
|
|
242
|
+
"mp4",
|
|
243
|
+
"mov"
|
|
244
|
+
]
|
|
245
|
+
},
|
|
211
246
|
"output_resolution": {
|
|
212
247
|
"enum": [
|
|
213
248
|
"480p",
|
|
214
|
-
"720p"
|
|
215
|
-
"1080p"
|
|
249
|
+
"720p"
|
|
216
250
|
]
|
|
217
251
|
},
|
|
218
|
-
"
|
|
219
|
-
"
|
|
252
|
+
"prompt": {
|
|
253
|
+
"required": true,
|
|
254
|
+
"min": 3,
|
|
255
|
+
"max": 3e4,
|
|
256
|
+
"length": true
|
|
257
|
+
},
|
|
258
|
+
"reference_audio_urls": {
|
|
259
|
+
"max_items": 10
|
|
260
|
+
},
|
|
261
|
+
"reference_image_urls": {
|
|
262
|
+
"max_items": 30
|
|
263
|
+
},
|
|
264
|
+
"reference_video_urls": {
|
|
265
|
+
"max_items": 10
|
|
220
266
|
}
|
|
221
267
|
},
|
|
222
268
|
"seedance-v1-pro": {
|
|
@@ -275,6 +321,35 @@ var contract = {
|
|
|
275
321
|
}
|
|
276
322
|
},
|
|
277
323
|
"rules": [
|
|
324
|
+
{
|
|
325
|
+
"when": {
|
|
326
|
+
"model": "seedance-2.5",
|
|
327
|
+
"first_frame_image_url": {
|
|
328
|
+
"present": true
|
|
329
|
+
}
|
|
330
|
+
},
|
|
331
|
+
"forbidden": [
|
|
332
|
+
"reference_image_urls",
|
|
333
|
+
"reference_video_urls",
|
|
334
|
+
"reference_audio_urls"
|
|
335
|
+
]
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
"when": {
|
|
339
|
+
"model": "seedance-2.5",
|
|
340
|
+
"last_frame_image_url": {
|
|
341
|
+
"present": true
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
"required": [
|
|
345
|
+
"first_frame_image_url"
|
|
346
|
+
],
|
|
347
|
+
"forbidden": [
|
|
348
|
+
"reference_image_urls",
|
|
349
|
+
"reference_video_urls",
|
|
350
|
+
"reference_audio_urls"
|
|
351
|
+
]
|
|
352
|
+
},
|
|
278
353
|
{
|
|
279
354
|
"when": {
|
|
280
355
|
"model": "seedance-1.5-pro"
|
|
@@ -285,7 +360,9 @@ var contract = {
|
|
|
285
360
|
"reference_image_urls",
|
|
286
361
|
"reference_video_urls",
|
|
287
362
|
"reference_audio_urls",
|
|
288
|
-
"web_search"
|
|
363
|
+
"web_search",
|
|
364
|
+
"return_last_frame",
|
|
365
|
+
"output_format"
|
|
289
366
|
]
|
|
290
367
|
},
|
|
291
368
|
{
|
|
@@ -296,7 +373,9 @@ var contract = {
|
|
|
296
373
|
"source_image_urls",
|
|
297
374
|
"lock_camera",
|
|
298
375
|
"seed",
|
|
299
|
-
"enable_safety_checker"
|
|
376
|
+
"enable_safety_checker",
|
|
377
|
+
"return_last_frame",
|
|
378
|
+
"output_format"
|
|
300
379
|
]
|
|
301
380
|
},
|
|
302
381
|
{
|
|
@@ -306,7 +385,9 @@ var contract = {
|
|
|
306
385
|
"forbidden": [
|
|
307
386
|
"source_image_urls",
|
|
308
387
|
"lock_camera",
|
|
309
|
-
"seed"
|
|
388
|
+
"seed",
|
|
389
|
+
"return_last_frame",
|
|
390
|
+
"output_format"
|
|
310
391
|
]
|
|
311
392
|
},
|
|
312
393
|
{
|
|
@@ -316,20 +397,19 @@ var contract = {
|
|
|
316
397
|
"forbidden": [
|
|
317
398
|
"source_image_urls",
|
|
318
399
|
"lock_camera",
|
|
319
|
-
"seed"
|
|
400
|
+
"seed",
|
|
401
|
+
"return_last_frame",
|
|
402
|
+
"output_format"
|
|
320
403
|
]
|
|
321
404
|
},
|
|
322
405
|
{
|
|
323
406
|
"when": {
|
|
324
|
-
"model": "seedance-
|
|
407
|
+
"model": "seedance-2.5"
|
|
325
408
|
},
|
|
326
409
|
"forbidden": [
|
|
327
410
|
"source_image_urls",
|
|
328
|
-
"
|
|
329
|
-
"
|
|
330
|
-
"reference_audio_urls",
|
|
331
|
-
"web_search",
|
|
332
|
-
"generate_audio"
|
|
411
|
+
"lock_camera",
|
|
412
|
+
"seed"
|
|
333
413
|
]
|
|
334
414
|
},
|
|
335
415
|
{
|
|
@@ -343,7 +423,9 @@ var contract = {
|
|
|
343
423
|
"reference_video_urls",
|
|
344
424
|
"reference_audio_urls",
|
|
345
425
|
"web_search",
|
|
346
|
-
"generate_audio"
|
|
426
|
+
"generate_audio",
|
|
427
|
+
"return_last_frame",
|
|
428
|
+
"output_format"
|
|
347
429
|
]
|
|
348
430
|
},
|
|
349
431
|
{
|
|
@@ -359,7 +441,9 @@ var contract = {
|
|
|
359
441
|
"reference_video_urls",
|
|
360
442
|
"reference_audio_urls",
|
|
361
443
|
"web_search",
|
|
362
|
-
"generate_audio"
|
|
444
|
+
"generate_audio",
|
|
445
|
+
"return_last_frame",
|
|
446
|
+
"output_format"
|
|
363
447
|
]
|
|
364
448
|
}
|
|
365
449
|
]
|
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-lite\",\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-lite\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"9:21\"\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\": {\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-lite\"\n },\n \"forbidden\": [\n \"source_image_urls\",\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\"\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"],"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;AA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EA,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 ]\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,kBAA+D;AAC/D,sBAAkC;;;ACF3B,IAAM,WAAW;AAAA,EACtB,iBA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QA,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,7 +13,7 @@ var contract = {
|
|
|
13
13
|
"seedance-2-mini",
|
|
14
14
|
"seedance-2.0",
|
|
15
15
|
"seedance-2.0-fast",
|
|
16
|
-
"seedance-
|
|
16
|
+
"seedance-2.5",
|
|
17
17
|
"seedance-v1-pro",
|
|
18
18
|
"seedance-v1-pro-fast"
|
|
19
19
|
],
|
|
@@ -152,7 +152,7 @@ var contract = {
|
|
|
152
152
|
"max_items": 3
|
|
153
153
|
}
|
|
154
154
|
},
|
|
155
|
-
"seedance-
|
|
155
|
+
"seedance-2.5": {
|
|
156
156
|
"aspect_ratio": {
|
|
157
157
|
"enum": [
|
|
158
158
|
"1:1",
|
|
@@ -160,26 +160,72 @@ var contract = {
|
|
|
160
160
|
"3:4",
|
|
161
161
|
"16:9",
|
|
162
162
|
"9:16",
|
|
163
|
-
"9
|
|
163
|
+
"21:9",
|
|
164
|
+
"auto"
|
|
164
165
|
]
|
|
165
166
|
},
|
|
166
167
|
"duration_seconds": {
|
|
167
168
|
"enum": [
|
|
169
|
+
-1,
|
|
170
|
+
4,
|
|
168
171
|
5,
|
|
169
|
-
|
|
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
|
|
170
197
|
],
|
|
171
|
-
"required": true,
|
|
172
198
|
"type": "integer"
|
|
173
199
|
},
|
|
200
|
+
"model": {
|
|
201
|
+
"required": true
|
|
202
|
+
},
|
|
203
|
+
"output_format": {
|
|
204
|
+
"enum": [
|
|
205
|
+
"mp4",
|
|
206
|
+
"mov"
|
|
207
|
+
]
|
|
208
|
+
},
|
|
174
209
|
"output_resolution": {
|
|
175
210
|
"enum": [
|
|
176
211
|
"480p",
|
|
177
|
-
"720p"
|
|
178
|
-
"1080p"
|
|
212
|
+
"720p"
|
|
179
213
|
]
|
|
180
214
|
},
|
|
181
|
-
"
|
|
182
|
-
"
|
|
215
|
+
"prompt": {
|
|
216
|
+
"required": true,
|
|
217
|
+
"min": 3,
|
|
218
|
+
"max": 3e4,
|
|
219
|
+
"length": true
|
|
220
|
+
},
|
|
221
|
+
"reference_audio_urls": {
|
|
222
|
+
"max_items": 10
|
|
223
|
+
},
|
|
224
|
+
"reference_image_urls": {
|
|
225
|
+
"max_items": 30
|
|
226
|
+
},
|
|
227
|
+
"reference_video_urls": {
|
|
228
|
+
"max_items": 10
|
|
183
229
|
}
|
|
184
230
|
},
|
|
185
231
|
"seedance-v1-pro": {
|
|
@@ -238,6 +284,35 @@ var contract = {
|
|
|
238
284
|
}
|
|
239
285
|
},
|
|
240
286
|
"rules": [
|
|
287
|
+
{
|
|
288
|
+
"when": {
|
|
289
|
+
"model": "seedance-2.5",
|
|
290
|
+
"first_frame_image_url": {
|
|
291
|
+
"present": true
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
"forbidden": [
|
|
295
|
+
"reference_image_urls",
|
|
296
|
+
"reference_video_urls",
|
|
297
|
+
"reference_audio_urls"
|
|
298
|
+
]
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
"when": {
|
|
302
|
+
"model": "seedance-2.5",
|
|
303
|
+
"last_frame_image_url": {
|
|
304
|
+
"present": true
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
"required": [
|
|
308
|
+
"first_frame_image_url"
|
|
309
|
+
],
|
|
310
|
+
"forbidden": [
|
|
311
|
+
"reference_image_urls",
|
|
312
|
+
"reference_video_urls",
|
|
313
|
+
"reference_audio_urls"
|
|
314
|
+
]
|
|
315
|
+
},
|
|
241
316
|
{
|
|
242
317
|
"when": {
|
|
243
318
|
"model": "seedance-1.5-pro"
|
|
@@ -248,7 +323,9 @@ var contract = {
|
|
|
248
323
|
"reference_image_urls",
|
|
249
324
|
"reference_video_urls",
|
|
250
325
|
"reference_audio_urls",
|
|
251
|
-
"web_search"
|
|
326
|
+
"web_search",
|
|
327
|
+
"return_last_frame",
|
|
328
|
+
"output_format"
|
|
252
329
|
]
|
|
253
330
|
},
|
|
254
331
|
{
|
|
@@ -259,7 +336,9 @@ var contract = {
|
|
|
259
336
|
"source_image_urls",
|
|
260
337
|
"lock_camera",
|
|
261
338
|
"seed",
|
|
262
|
-
"enable_safety_checker"
|
|
339
|
+
"enable_safety_checker",
|
|
340
|
+
"return_last_frame",
|
|
341
|
+
"output_format"
|
|
263
342
|
]
|
|
264
343
|
},
|
|
265
344
|
{
|
|
@@ -269,7 +348,9 @@ var contract = {
|
|
|
269
348
|
"forbidden": [
|
|
270
349
|
"source_image_urls",
|
|
271
350
|
"lock_camera",
|
|
272
|
-
"seed"
|
|
351
|
+
"seed",
|
|
352
|
+
"return_last_frame",
|
|
353
|
+
"output_format"
|
|
273
354
|
]
|
|
274
355
|
},
|
|
275
356
|
{
|
|
@@ -279,20 +360,19 @@ var contract = {
|
|
|
279
360
|
"forbidden": [
|
|
280
361
|
"source_image_urls",
|
|
281
362
|
"lock_camera",
|
|
282
|
-
"seed"
|
|
363
|
+
"seed",
|
|
364
|
+
"return_last_frame",
|
|
365
|
+
"output_format"
|
|
283
366
|
]
|
|
284
367
|
},
|
|
285
368
|
{
|
|
286
369
|
"when": {
|
|
287
|
-
"model": "seedance-
|
|
370
|
+
"model": "seedance-2.5"
|
|
288
371
|
},
|
|
289
372
|
"forbidden": [
|
|
290
373
|
"source_image_urls",
|
|
291
|
-
"
|
|
292
|
-
"
|
|
293
|
-
"reference_audio_urls",
|
|
294
|
-
"web_search",
|
|
295
|
-
"generate_audio"
|
|
374
|
+
"lock_camera",
|
|
375
|
+
"seed"
|
|
296
376
|
]
|
|
297
377
|
},
|
|
298
378
|
{
|
|
@@ -306,7 +386,9 @@ var contract = {
|
|
|
306
386
|
"reference_video_urls",
|
|
307
387
|
"reference_audio_urls",
|
|
308
388
|
"web_search",
|
|
309
|
-
"generate_audio"
|
|
389
|
+
"generate_audio",
|
|
390
|
+
"return_last_frame",
|
|
391
|
+
"output_format"
|
|
310
392
|
]
|
|
311
393
|
},
|
|
312
394
|
{
|
|
@@ -322,7 +404,9 @@ var contract = {
|
|
|
322
404
|
"reference_video_urls",
|
|
323
405
|
"reference_audio_urls",
|
|
324
406
|
"web_search",
|
|
325
|
-
"generate_audio"
|
|
407
|
+
"generate_audio",
|
|
408
|
+
"return_last_frame",
|
|
409
|
+
"output_format"
|
|
326
410
|
]
|
|
327
411
|
}
|
|
328
412
|
]
|
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-lite\",\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-lite\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"9:21\"\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\": {\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-lite\"\n },\n \"forbidden\": [\n \"source_image_urls\",\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\"\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;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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 ]\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,QACV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AAO;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.2.
|
|
6
|
+
"version": "0.2.14",
|
|
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.3.
|
|
34
|
+
"@runapi.ai/core": "^0.3.5"
|
|
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
|
```
|
|
@@ -61,22 +63,22 @@ const url = result.videos[0].url;
|
|
|
61
63
|
## Routing
|
|
62
64
|
|
|
63
65
|
- Model page: https://runapi.ai/models/seedance
|
|
64
|
-
- Product docs: https://runapi.ai/docs
|
|
65
|
-
- SDK docs: https://runapi.ai/docs
|
|
66
|
+
- Product docs: https://runapi.ai/docs/api/seedance/text-to-video
|
|
67
|
+
- SDK docs: https://runapi.ai/docs/resources/sdks
|
|
66
68
|
- SDK repository: https://github.com/runapi-ai/seedance-sdk
|
|
67
|
-
- Pricing and rate limits: https://runapi.ai/models/seedance/v1-
|
|
69
|
+
- Pricing and rate limits: https://runapi.ai/models/seedance/v1-pro
|
|
68
70
|
- Provider comparison: https://runapi.ai/providers/bytedance
|
|
69
71
|
- Browse all RunAPI models and skills: https://runapi.ai/models
|
|
70
72
|
|
|
71
73
|
## Variants
|
|
72
74
|
|
|
73
|
-
- [v1 lite](https://runapi.ai/models/seedance/v1-lite)
|
|
74
75
|
- [v1 pro](https://runapi.ai/models/seedance/v1-pro)
|
|
75
76
|
- [v1 pro fast](https://runapi.ai/models/seedance/v1-pro-fast)
|
|
76
77
|
- [1.5 pro](https://runapi.ai/models/seedance/1.5-pro)
|
|
77
78
|
- [2.0](https://runapi.ai/models/seedance/2.0)
|
|
78
79
|
- [2.0 fast](https://runapi.ai/models/seedance/2.0-fast)
|
|
79
80
|
- [2.0 mini](https://runapi.ai/models/seedance/2-mini)
|
|
81
|
+
- [2.5](https://runapi.ai/models/seedance/2.5)
|
|
80
82
|
|
|
81
83
|
## Agent rules
|
|
82
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,65 +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
|
-
-
|
|
87
|
-
- [2.0 mini](https://runapi.ai/models/seedance/2-mini.md)
|
|
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
|