@runapi.ai/seedance 0.2.7 → 0.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # Seedance API JavaScript SDK for RunAPI
1
+ # Seedance JavaScript SDK for RunAPI
2
2
 
3
- The seedance api JavaScript SDK is the language-specific package for Seedance on RunAPI. Use this seedance api package for text-to-video, image-to-video, video editing, and animation flows when your application needs JSON request bodies, task status lookup, and consistent RunAPI errors in JavaScript.
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 seedance api 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#seedance; for SDK docs, use https://runapi.ai/docs#sdk-seedance.
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#seedance; for SDK docs, use https://runapi.ai/docs#sdk-seedance.
6
6
 
7
7
  ## Install
8
8
 
@@ -16,10 +16,10 @@ npm install @runapi.ai/seedance
16
16
  import { SeedanceClient } from '@runapi.ai/seedance';
17
17
 
18
18
  const client = new SeedanceClient();
19
- const task = await client.generations.create({
19
+ const task = await client.textToVideo.create({
20
20
  // Pass the Seedance JSON request body from https://runapi.ai/docs#seedance.
21
21
  });
22
- const status = await client.generations.get(task.id);
22
+ const status = await client.textToVideo.get(task.id);
23
23
  ```
24
24
 
25
25
  Use `create` when you want to submit a task and return quickly, `get` when you need the latest task state, and `run` when a script should create and poll until completion. In web request handlers, prefer `create` plus webhook or later `get` polling so a worker is not held open.
@@ -28,7 +28,7 @@ RunAPI-generated file URLs are temporary. Download and store generated images, v
28
28
 
29
29
  ## Language notes
30
30
 
31
- Use the TypeScript types in `src/types.ts` and the resource classes under `src/resources` when building video applications. The available resources include generations. Keep `RUNAPI_API_KEY` in the environment or your secret manager; never commit API keys or callback secrets.
31
+ Use the TypeScript types in `src/types.ts` and the resource classes under `src/resources` when building video applications. The available resources are `textToVideo`. Keep `RUNAPI_API_KEY` in the environment or your secret manager; never commit API keys or callback secrets.
32
32
 
33
33
  ## Links
34
34
 
package/dist/index.d.mts CHANGED
@@ -1,86 +1,111 @@
1
1
  import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, BaseClient, ClientOptions } from '@runapi.ai/core';
2
2
  export { AuthenticationError, InsufficientCreditsError, NetworkError, NotFoundError, RateLimitError, RunApiError, ServiceUnavailableError, TaskFailedError, TaskTimeoutError, TimeoutError, ValidationError } from '@runapi.ai/core';
3
3
 
4
- type SeedanceModel = 'seedance-1.5-pro' | 'seedance-2.0' | 'seedance-2.0-fast' | 'seedance-v1-lite' | 'seedance-v1-pro' | 'seedance-v1-pro-fast';
5
- type SeedanceModel2 = 'seedance-2.0' | 'seedance-2.0-fast';
4
+ type SeedanceModel = 'seedance-1.5-pro' | 'seedance-2.0' | 'seedance-2.0-fast' | 'seedance-2-mini' | 'seedance-v1-lite' | 'seedance-v1-pro' | 'seedance-v1-pro-fast';
5
+ type SeedanceModel2 = 'seedance-2.0' | 'seedance-2.0-fast' | 'seedance-2-mini';
6
+ type SeedanceModel2WithSafetyChecker = 'seedance-2.0' | 'seedance-2.0-fast';
6
7
  type SeedanceModelV1 = 'seedance-v1-lite' | 'seedance-v1-pro' | 'seedance-v1-pro-fast';
7
8
  type AspectRatio15Pro = '1:1' | '4:3' | '3:4' | '16:9' | '9:16' | '21:9';
8
9
  type AspectRatio2 = AspectRatio15Pro | 'auto';
9
10
  type AspectRatioV1Lite = '1:1' | '4:3' | '3:4' | '16:9' | '9:16' | '9:21';
10
11
  type AspectRatioV1Pro = '1:1' | '4:3' | '3:4' | '16:9' | '9:16' | '21:9';
11
12
  type Resolution15Pro = '480p' | '720p' | '1080p';
12
- type Resolution2 = '480p' | '720p' | '1080p';
13
+ type Resolution2 = '480p' | '720p' | '1080p' | '4k';
13
14
  type ResolutionV1 = '480p' | '720p' | '1080p';
14
15
  type ResolutionV1ProFast = '720p' | '1080p';
15
16
  type DurationV1 = 5 | 10;
17
+ type Duration15Pro = number;
16
18
  interface GenerationCommonParams {
17
19
  /** Text description of desired video content */
18
20
  prompt: string;
19
21
  /** URL for completion callback */
20
22
  callback_url?: string;
21
- /** Generate audio track for the video */
22
- generate_audio?: boolean;
23
+ }
24
+ interface SafetyCheckerParams {
23
25
  /** Content safety check toggle */
24
26
  enable_safety_checker?: boolean;
25
27
  }
28
+ interface AudioGenerationParams {
29
+ /** Generate audio track for the video */
30
+ generate_audio?: boolean;
31
+ }
26
32
  /**
27
33
  * seedance-1.5-pro generation parameters.
28
34
  * Supports text-to-video and image-to-video with camera lock.
29
35
  */
30
- interface Generation15ProParams extends GenerationCommonParams {
36
+ interface Generation15ProParams extends GenerationCommonParams, AudioGenerationParams, SafetyCheckerParams {
31
37
  model: 'seedance-1.5-pro';
32
38
  /** Required for seedance-1.5-pro */
33
39
  aspect_ratio: AspectRatio15Pro;
34
40
  output_resolution?: Resolution15Pro;
35
- /** Fixed values: 4, 8, or 12 seconds */
36
- duration_seconds: 4 | 8 | 12;
41
+ /** Integer 4-12 seconds */
42
+ duration_seconds: Duration15Pro;
37
43
  /** Up to 2 source image URLs for image-to-video */
38
44
  source_image_urls?: string[];
39
45
  /** Lock camera movement */
40
46
  lock_camera?: boolean;
41
47
  }
42
48
  /** Common fields for all 2.x modes */
43
- interface Generation2BaseParams extends GenerationCommonParams {
44
- model: SeedanceModel2;
49
+ interface Generation2BaseFields extends GenerationCommonParams, AudioGenerationParams {
45
50
  aspect_ratio?: AspectRatio2;
46
51
  output_resolution?: Resolution2;
47
52
  /** Integer 4-15 */
48
53
  duration_seconds?: number;
49
- /** Enable web search for prompt enrichment. */
54
+ }
55
+ type Generation2ModelFields = ({
56
+ model: SeedanceModel2WithSafetyChecker;
57
+ } & SafetyCheckerParams) | {
58
+ model: 'seedance-2-mini';
59
+ };
60
+ interface Generation2TextFields extends Generation2BaseFields {
61
+ /** Enable web search for prompt enrichment in pure text-to-video mode. */
50
62
  web_search?: boolean;
63
+ first_frame_image_url?: never;
64
+ last_frame_image_url?: never;
65
+ reference_image_urls?: never;
66
+ reference_video_urls?: never;
67
+ reference_audio_urls?: never;
51
68
  }
52
69
  /**
53
- * seedance-2.0/2-fast text-to-video mode.
70
+ * seedance-2.x text-to-video mode.
54
71
  * Pure text prompt, no image/reference inputs.
55
72
  */
56
- interface Generation2TextParams extends Generation2BaseParams {
57
- }
58
- /**
59
- * seedance-2.0/2-fast frame mode.
60
- * Guide generation with first (required) and optional last frame images.
61
- * Mutually exclusive with reference mode.
62
- */
63
- interface Generation2FrameParams extends Generation2BaseParams {
73
+ type Generation2TextParams = Generation2TextFields & Generation2ModelFields;
74
+ interface Generation2FrameFields extends Generation2BaseFields {
64
75
  /** First frame image URL (required for frame mode) */
65
76
  first_frame_image_url: string;
66
77
  /** Last frame image URL */
67
78
  last_frame_image_url?: string;
79
+ web_search?: never;
80
+ reference_image_urls?: never;
81
+ reference_video_urls?: never;
82
+ reference_audio_urls?: never;
68
83
  }
69
84
  /**
70
- * seedance-2.0/2-fast reference mode.
71
- * Guide generation with reference images, videos, or audio.
72
- * Mutually exclusive with frame mode.
85
+ * seedance-2.x frame mode.
86
+ * Guide generation with first (required) and optional last frame images.
87
+ * Mutually exclusive with reference mode.
73
88
  */
74
- interface Generation2ReferenceParams extends Generation2BaseParams {
89
+ type Generation2FrameParams = Generation2FrameFields & Generation2ModelFields;
90
+ interface Generation2ReferenceFields extends Generation2BaseFields {
75
91
  /** Reference image URLs (max 9) */
76
92
  reference_image_urls?: string[];
77
- /** Reference video URLs (max 3, total duration 15s) */
93
+ /** Reference video URLs (max 3, total duration <= 15s) */
78
94
  reference_video_urls?: string[];
79
95
  /** Reference audio URLs (max 3, requires image or video) */
80
96
  reference_audio_urls?: string[];
97
+ first_frame_image_url?: never;
98
+ last_frame_image_url?: never;
99
+ web_search?: never;
81
100
  }
101
+ /**
102
+ * seedance-2.x reference mode.
103
+ * Guide generation with reference images, videos, or audio.
104
+ * Mutually exclusive with frame mode.
105
+ */
106
+ type Generation2ReferenceParams = Generation2ReferenceFields & Generation2ModelFields;
82
107
  /** Common fields for v1-lite and v1-pro (not v1-pro-fast). */
83
- interface GenerationV1SharedParams extends GenerationCommonParams {
108
+ interface GenerationV1SharedParams extends GenerationCommonParams, SafetyCheckerParams {
84
109
  /** `5` or `10`. Required. */
85
110
  duration_seconds: DurationV1;
86
111
  output_resolution?: ResolutionV1;
@@ -117,7 +142,7 @@ interface GenerationV1ProParams extends GenerationV1SharedParams {
117
142
  * seedance-v1-pro-fast image-to-video only. Smaller parameter surface —
118
143
  * no `aspect_ratio`, `lock_camera`, or `seed`.
119
144
  */
120
- interface GenerationV1ProFastParams extends GenerationCommonParams {
145
+ interface GenerationV1ProFastParams extends GenerationCommonParams, SafetyCheckerParams {
121
146
  model: 'seedance-v1-pro-fast';
122
147
  /** Required first frame image URL. */
123
148
  first_frame_image_url: string;
@@ -199,4 +224,4 @@ declare class SeedanceClient extends BaseClient {
199
224
  constructor(options?: ClientOptions);
200
225
  }
201
226
 
202
- export { type AspectRatio15Pro, type AspectRatio2, type AspectRatioV1Lite, type AspectRatioV1Pro, type CompletedTextToVideoResponse, type DurationV1, type Generation15ProParams, type Generation2FrameParams, type Generation2ReferenceParams, type Generation2TextParams, type GenerationV1LiteParams, type GenerationV1ProFastParams, type GenerationV1ProParams, type Resolution15Pro, type Resolution2, type ResolutionV1, type ResolutionV1ProFast, SeedanceClient, type SeedanceModel, type SeedanceModel2, type SeedanceModelV1, type TaskCreateResponse, type TextToVideoParams, type TextToVideoResponse, type VideoMetadata };
227
+ export { type AspectRatio15Pro, type AspectRatio2, type AspectRatioV1Lite, type AspectRatioV1Pro, type CompletedTextToVideoResponse, type Duration15Pro, type DurationV1, type Generation15ProParams, type Generation2FrameParams, type Generation2ReferenceParams, type Generation2TextParams, type GenerationV1LiteParams, 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 };
package/dist/index.d.ts CHANGED
@@ -1,86 +1,111 @@
1
1
  import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, BaseClient, ClientOptions } from '@runapi.ai/core';
2
2
  export { AuthenticationError, InsufficientCreditsError, NetworkError, NotFoundError, RateLimitError, RunApiError, ServiceUnavailableError, TaskFailedError, TaskTimeoutError, TimeoutError, ValidationError } from '@runapi.ai/core';
3
3
 
4
- type SeedanceModel = 'seedance-1.5-pro' | 'seedance-2.0' | 'seedance-2.0-fast' | 'seedance-v1-lite' | 'seedance-v1-pro' | 'seedance-v1-pro-fast';
5
- type SeedanceModel2 = 'seedance-2.0' | 'seedance-2.0-fast';
4
+ type SeedanceModel = 'seedance-1.5-pro' | 'seedance-2.0' | 'seedance-2.0-fast' | 'seedance-2-mini' | 'seedance-v1-lite' | 'seedance-v1-pro' | 'seedance-v1-pro-fast';
5
+ type SeedanceModel2 = 'seedance-2.0' | 'seedance-2.0-fast' | 'seedance-2-mini';
6
+ type SeedanceModel2WithSafetyChecker = 'seedance-2.0' | 'seedance-2.0-fast';
6
7
  type SeedanceModelV1 = 'seedance-v1-lite' | 'seedance-v1-pro' | 'seedance-v1-pro-fast';
7
8
  type AspectRatio15Pro = '1:1' | '4:3' | '3:4' | '16:9' | '9:16' | '21:9';
8
9
  type AspectRatio2 = AspectRatio15Pro | 'auto';
9
10
  type AspectRatioV1Lite = '1:1' | '4:3' | '3:4' | '16:9' | '9:16' | '9:21';
10
11
  type AspectRatioV1Pro = '1:1' | '4:3' | '3:4' | '16:9' | '9:16' | '21:9';
11
12
  type Resolution15Pro = '480p' | '720p' | '1080p';
12
- type Resolution2 = '480p' | '720p' | '1080p';
13
+ type Resolution2 = '480p' | '720p' | '1080p' | '4k';
13
14
  type ResolutionV1 = '480p' | '720p' | '1080p';
14
15
  type ResolutionV1ProFast = '720p' | '1080p';
15
16
  type DurationV1 = 5 | 10;
17
+ type Duration15Pro = number;
16
18
  interface GenerationCommonParams {
17
19
  /** Text description of desired video content */
18
20
  prompt: string;
19
21
  /** URL for completion callback */
20
22
  callback_url?: string;
21
- /** Generate audio track for the video */
22
- generate_audio?: boolean;
23
+ }
24
+ interface SafetyCheckerParams {
23
25
  /** Content safety check toggle */
24
26
  enable_safety_checker?: boolean;
25
27
  }
28
+ interface AudioGenerationParams {
29
+ /** Generate audio track for the video */
30
+ generate_audio?: boolean;
31
+ }
26
32
  /**
27
33
  * seedance-1.5-pro generation parameters.
28
34
  * Supports text-to-video and image-to-video with camera lock.
29
35
  */
30
- interface Generation15ProParams extends GenerationCommonParams {
36
+ interface Generation15ProParams extends GenerationCommonParams, AudioGenerationParams, SafetyCheckerParams {
31
37
  model: 'seedance-1.5-pro';
32
38
  /** Required for seedance-1.5-pro */
33
39
  aspect_ratio: AspectRatio15Pro;
34
40
  output_resolution?: Resolution15Pro;
35
- /** Fixed values: 4, 8, or 12 seconds */
36
- duration_seconds: 4 | 8 | 12;
41
+ /** Integer 4-12 seconds */
42
+ duration_seconds: Duration15Pro;
37
43
  /** Up to 2 source image URLs for image-to-video */
38
44
  source_image_urls?: string[];
39
45
  /** Lock camera movement */
40
46
  lock_camera?: boolean;
41
47
  }
42
48
  /** Common fields for all 2.x modes */
43
- interface Generation2BaseParams extends GenerationCommonParams {
44
- model: SeedanceModel2;
49
+ interface Generation2BaseFields extends GenerationCommonParams, AudioGenerationParams {
45
50
  aspect_ratio?: AspectRatio2;
46
51
  output_resolution?: Resolution2;
47
52
  /** Integer 4-15 */
48
53
  duration_seconds?: number;
49
- /** Enable web search for prompt enrichment. */
54
+ }
55
+ type Generation2ModelFields = ({
56
+ model: SeedanceModel2WithSafetyChecker;
57
+ } & SafetyCheckerParams) | {
58
+ model: 'seedance-2-mini';
59
+ };
60
+ interface Generation2TextFields extends Generation2BaseFields {
61
+ /** Enable web search for prompt enrichment in pure text-to-video mode. */
50
62
  web_search?: boolean;
63
+ first_frame_image_url?: never;
64
+ last_frame_image_url?: never;
65
+ reference_image_urls?: never;
66
+ reference_video_urls?: never;
67
+ reference_audio_urls?: never;
51
68
  }
52
69
  /**
53
- * seedance-2.0/2-fast text-to-video mode.
70
+ * seedance-2.x text-to-video mode.
54
71
  * Pure text prompt, no image/reference inputs.
55
72
  */
56
- interface Generation2TextParams extends Generation2BaseParams {
57
- }
58
- /**
59
- * seedance-2.0/2-fast frame mode.
60
- * Guide generation with first (required) and optional last frame images.
61
- * Mutually exclusive with reference mode.
62
- */
63
- interface Generation2FrameParams extends Generation2BaseParams {
73
+ type Generation2TextParams = Generation2TextFields & Generation2ModelFields;
74
+ interface Generation2FrameFields extends Generation2BaseFields {
64
75
  /** First frame image URL (required for frame mode) */
65
76
  first_frame_image_url: string;
66
77
  /** Last frame image URL */
67
78
  last_frame_image_url?: string;
79
+ web_search?: never;
80
+ reference_image_urls?: never;
81
+ reference_video_urls?: never;
82
+ reference_audio_urls?: never;
68
83
  }
69
84
  /**
70
- * seedance-2.0/2-fast reference mode.
71
- * Guide generation with reference images, videos, or audio.
72
- * Mutually exclusive with frame mode.
85
+ * seedance-2.x frame mode.
86
+ * Guide generation with first (required) and optional last frame images.
87
+ * Mutually exclusive with reference mode.
73
88
  */
74
- interface Generation2ReferenceParams extends Generation2BaseParams {
89
+ type Generation2FrameParams = Generation2FrameFields & Generation2ModelFields;
90
+ interface Generation2ReferenceFields extends Generation2BaseFields {
75
91
  /** Reference image URLs (max 9) */
76
92
  reference_image_urls?: string[];
77
- /** Reference video URLs (max 3, total duration 15s) */
93
+ /** Reference video URLs (max 3, total duration <= 15s) */
78
94
  reference_video_urls?: string[];
79
95
  /** Reference audio URLs (max 3, requires image or video) */
80
96
  reference_audio_urls?: string[];
97
+ first_frame_image_url?: never;
98
+ last_frame_image_url?: never;
99
+ web_search?: never;
81
100
  }
101
+ /**
102
+ * seedance-2.x reference mode.
103
+ * Guide generation with reference images, videos, or audio.
104
+ * Mutually exclusive with frame mode.
105
+ */
106
+ type Generation2ReferenceParams = Generation2ReferenceFields & Generation2ModelFields;
82
107
  /** Common fields for v1-lite and v1-pro (not v1-pro-fast). */
83
- interface GenerationV1SharedParams extends GenerationCommonParams {
108
+ interface GenerationV1SharedParams extends GenerationCommonParams, SafetyCheckerParams {
84
109
  /** `5` or `10`. Required. */
85
110
  duration_seconds: DurationV1;
86
111
  output_resolution?: ResolutionV1;
@@ -117,7 +142,7 @@ interface GenerationV1ProParams extends GenerationV1SharedParams {
117
142
  * seedance-v1-pro-fast image-to-video only. Smaller parameter surface —
118
143
  * no `aspect_ratio`, `lock_camera`, or `seed`.
119
144
  */
120
- interface GenerationV1ProFastParams extends GenerationCommonParams {
145
+ interface GenerationV1ProFastParams extends GenerationCommonParams, SafetyCheckerParams {
121
146
  model: 'seedance-v1-pro-fast';
122
147
  /** Required first frame image URL. */
123
148
  first_frame_image_url: string;
@@ -199,4 +224,4 @@ declare class SeedanceClient extends BaseClient {
199
224
  constructor(options?: ClientOptions);
200
225
  }
201
226
 
202
- export { type AspectRatio15Pro, type AspectRatio2, type AspectRatioV1Lite, type AspectRatioV1Pro, type CompletedTextToVideoResponse, type DurationV1, type Generation15ProParams, type Generation2FrameParams, type Generation2ReferenceParams, type Generation2TextParams, type GenerationV1LiteParams, type GenerationV1ProFastParams, type GenerationV1ProParams, type Resolution15Pro, type Resolution2, type ResolutionV1, type ResolutionV1ProFast, SeedanceClient, type SeedanceModel, type SeedanceModel2, type SeedanceModelV1, type TaskCreateResponse, type TextToVideoParams, type TextToVideoResponse, type VideoMetadata };
227
+ export { type AspectRatio15Pro, type AspectRatio2, type AspectRatioV1Lite, type AspectRatioV1Pro, type CompletedTextToVideoResponse, type Duration15Pro, type DurationV1, type Generation15ProParams, type Generation2FrameParams, type Generation2ReferenceParams, type Generation2TextParams, type GenerationV1LiteParams, 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 };
package/dist/index.js CHANGED
@@ -41,6 +41,203 @@ var import_core2 = require("@runapi.ai/core");
41
41
  // src/resources/text-to-video.ts
42
42
  var import_core = require("@runapi.ai/core");
43
43
  var import_internal = require("@runapi.ai/core/internal");
44
+
45
+ // src/contract_gen.ts
46
+ var contract = {
47
+ "text-to-video": {
48
+ "models": [
49
+ "seedance-1.5-pro",
50
+ "seedance-2-mini",
51
+ "seedance-2.0",
52
+ "seedance-2.0-fast",
53
+ "seedance-v1-lite",
54
+ "seedance-v1-pro",
55
+ "seedance-v1-pro-fast"
56
+ ],
57
+ "fields_by_model": {
58
+ "seedance-1.5-pro": {
59
+ "aspect_ratio": {
60
+ "enum": [
61
+ "1:1",
62
+ "4:3",
63
+ "3:4",
64
+ "16:9",
65
+ "9:16",
66
+ "21:9"
67
+ ]
68
+ },
69
+ "duration_seconds": {
70
+ "required": true,
71
+ "min": 4,
72
+ "max": 12,
73
+ "type": "integer"
74
+ },
75
+ "output_resolution": {
76
+ "enum": [
77
+ "480p",
78
+ "720p",
79
+ "1080p"
80
+ ]
81
+ }
82
+ },
83
+ "seedance-2-mini": {
84
+ "aspect_ratio": {
85
+ "enum": [
86
+ "1:1",
87
+ "4:3",
88
+ "3:4",
89
+ "16:9",
90
+ "9:16",
91
+ "21:9",
92
+ "auto"
93
+ ]
94
+ },
95
+ "duration_seconds": {
96
+ "min": 4,
97
+ "max": 15,
98
+ "type": "integer"
99
+ },
100
+ "output_resolution": {
101
+ "enum": [
102
+ "480p",
103
+ "720p"
104
+ ]
105
+ }
106
+ },
107
+ "seedance-2.0": {
108
+ "aspect_ratio": {
109
+ "enum": [
110
+ "1:1",
111
+ "4:3",
112
+ "3:4",
113
+ "16:9",
114
+ "9:16",
115
+ "21:9",
116
+ "auto"
117
+ ]
118
+ },
119
+ "duration_seconds": {
120
+ "min": 4,
121
+ "max": 15,
122
+ "type": "integer"
123
+ },
124
+ "output_resolution": {
125
+ "enum": [
126
+ "480p",
127
+ "720p",
128
+ "1080p",
129
+ "4k"
130
+ ]
131
+ }
132
+ },
133
+ "seedance-2.0-fast": {
134
+ "aspect_ratio": {
135
+ "enum": [
136
+ "1:1",
137
+ "4:3",
138
+ "3:4",
139
+ "16:9",
140
+ "9:16",
141
+ "21:9",
142
+ "auto"
143
+ ]
144
+ },
145
+ "duration_seconds": {
146
+ "min": 4,
147
+ "max": 15,
148
+ "type": "integer"
149
+ },
150
+ "output_resolution": {
151
+ "enum": [
152
+ "480p",
153
+ "720p"
154
+ ]
155
+ }
156
+ },
157
+ "seedance-v1-lite": {
158
+ "aspect_ratio": {
159
+ "enum": [
160
+ "1:1",
161
+ "4:3",
162
+ "3:4",
163
+ "16:9",
164
+ "9:16",
165
+ "9:21"
166
+ ]
167
+ },
168
+ "duration_seconds": {
169
+ "enum": [
170
+ 5,
171
+ 10
172
+ ],
173
+ "required": true,
174
+ "type": "integer"
175
+ },
176
+ "output_resolution": {
177
+ "enum": [
178
+ "480p",
179
+ "720p",
180
+ "1080p"
181
+ ]
182
+ },
183
+ "seed": {
184
+ "type": "integer"
185
+ }
186
+ },
187
+ "seedance-v1-pro": {
188
+ "aspect_ratio": {
189
+ "enum": [
190
+ "1:1",
191
+ "4:3",
192
+ "3:4",
193
+ "16:9",
194
+ "9:16",
195
+ "21:9"
196
+ ]
197
+ },
198
+ "duration_seconds": {
199
+ "enum": [
200
+ 5,
201
+ 10
202
+ ],
203
+ "required": true,
204
+ "type": "integer"
205
+ },
206
+ "output_resolution": {
207
+ "enum": [
208
+ "480p",
209
+ "720p",
210
+ "1080p"
211
+ ]
212
+ },
213
+ "seed": {
214
+ "type": "integer"
215
+ }
216
+ },
217
+ "seedance-v1-pro-fast": {
218
+ "duration_seconds": {
219
+ "enum": [
220
+ 5,
221
+ 10
222
+ ],
223
+ "required": true,
224
+ "type": "integer"
225
+ },
226
+ "first_frame_image_url": {
227
+ "required": true
228
+ },
229
+ "output_resolution": {
230
+ "enum": [
231
+ "720p",
232
+ "1080p"
233
+ ]
234
+ }
235
+ }
236
+ }
237
+ }
238
+ };
239
+
240
+ // src/resources/text-to-video.ts
44
241
  var ENDPOINT = "/api/v1/seedance/text_to_video";
45
242
  var TextToVideo = class {
46
243
  constructor(http) {
@@ -68,8 +265,11 @@ var TextToVideo = class {
68
265
  * @returns The task creation result.
69
266
  */
70
267
  async create(params, options) {
268
+ const body = (0, import_core.compactParams)(params);
269
+ (0, import_core.validateParams)(contract["text-to-video"], body);
270
+ validateSeedance2FourKMode(body);
71
271
  return this.http.request("POST", ENDPOINT, {
72
- body: (0, import_core.compactParams)(params),
272
+ body,
73
273
  ...options
74
274
  });
75
275
  }
@@ -85,6 +285,35 @@ var TextToVideo = class {
85
285
  });
86
286
  }
87
287
  };
288
+ var SEEDANCE_2_FOUR_K_UNSUPPORTED_FIELDS = [
289
+ "first_frame_image_url",
290
+ "last_frame_image_url",
291
+ "reference_image_urls",
292
+ "reference_video_urls",
293
+ "reference_audio_urls"
294
+ ];
295
+ function validateSeedance2FourKMode(body) {
296
+ if (body.model !== "seedance-2.0" || body.output_resolution !== "4k") {
297
+ return;
298
+ }
299
+ const field = SEEDANCE_2_FOUR_K_UNSUPPORTED_FIELDS.find((candidate) => isPresent(body[candidate]));
300
+ if (!field) {
301
+ return;
302
+ }
303
+ throw new import_core.ValidationError(`${field} is not allowed when model is seedance-2.0 and output_resolution is 4k`);
304
+ }
305
+ function isPresent(value) {
306
+ if (value === void 0 || value === null) {
307
+ return false;
308
+ }
309
+ if (typeof value === "string") {
310
+ return value.length > 0;
311
+ }
312
+ if (Array.isArray(value)) {
313
+ return value.length > 0;
314
+ }
315
+ return true;
316
+ }
88
317
 
89
318
  // src/client.ts
90
319
  var SeedanceClient = class extends import_core2.BaseClient {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/client.ts","../src/resources/text-to-video.ts"],"sourcesContent":["export { SeedanceClient } from './client';\nexport * from './types';\n\nexport {\n RunApiError,\n AuthenticationError,\n InsufficientCreditsError,\n NotFoundError,\n ValidationError,\n RateLimitError,\n ServiceUnavailableError,\n NetworkError,\n TimeoutError,\n TaskTimeoutError,\n TaskFailedError,\n} from '@runapi.ai/core';\n","import { BaseClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToVideo } from './resources/text-to-video';\n\n/**\n * Seedance video API client.\n *\n * @example\n * ```typescript\n * const client = new SeedanceClient({\n * apiKey: 'your-api-key',\n * baseUrl: 'https://runapi.ai',\n * });\n *\n * const result = await client.textToVideo.run({\n * model: 'seedance-2.0',\n * prompt: 'A cat walking through a garden',\n * });\n * ```\n */\nexport class SeedanceClient extends BaseClient {\n /** Video generation operations. */\n public readonly textToVideo: TextToVideo;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.textToVideo = new TextToVideo(this.http);\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedTextToVideoResponse,\n TextToVideoParams,\n TextToVideoResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/seedance/text_to_video';\n\n/** Generate video from text prompts, optionally conditioned on reference images, frame images, reference videos, or audio. */\nexport class TextToVideo {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Create a text to video task and wait until complete.\n * @param params Text to video parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed text to video response.\n */\n async run(params: TextToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<TextToVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedTextToVideoResponse;\n }\n\n /**\n * Create a text to video task; returns immediately with a task id.\n * @param params Text to video parameters.\n * @param options Per-request overrides.\n * @returns The task creation result.\n */\n async create(params: TextToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n /**\n * Fetch the current status of a text to video task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current text to video task status.\n */\n async get(id: string, options?: RequestOptions): Promise<TextToVideoResponse> {\n return this.http.request<TextToVideoResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,eAA+C;;;ACC/C,kBAA8B;AAC9B,sBAAkC;AAQlC,IAAM,WAAW;AAGV,IAAM,cAAN,MAAkB;AAAA,EACvB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ7B,MAAM,IAAI,QAA2B,SAAkF;AACrH,UAAM,EAAE,GAAG,IAAI,MAAM,KAAK,OAAO,QAAQ,OAAO;AAChD,UAAM,WAAW,UAAM,mCAAuC,MAAM,KAAK,IAAI,IAAI,OAAO,GAAG;AAAA,MACzF,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AACD,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,OAAO,QAA2B,SAAuD;AAC7F,WAAO,KAAK,KAAK,QAA4B,QAAQ,UAAU;AAAA,MAC7D,UAAM,2BAAc,MAAM;AAAA,MAC1B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,IAAI,IAAY,SAAwD;AAC5E,WAAO,KAAK,KAAK,QAA6B,OAAO,GAAG,QAAQ,IAAI,EAAE,IAAI;AAAA,MACxE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;ADpCO,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-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 },\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 },\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 },\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 },\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 }\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,IAA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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
@@ -2,8 +2,205 @@
2
2
  import { BaseClient } from "@runapi.ai/core";
3
3
 
4
4
  // src/resources/text-to-video.ts
5
- import { compactParams } from "@runapi.ai/core";
5
+ import { compactParams, validateParams, ValidationError } from "@runapi.ai/core";
6
6
  import { pollUntilComplete } from "@runapi.ai/core/internal";
7
+
8
+ // src/contract_gen.ts
9
+ var contract = {
10
+ "text-to-video": {
11
+ "models": [
12
+ "seedance-1.5-pro",
13
+ "seedance-2-mini",
14
+ "seedance-2.0",
15
+ "seedance-2.0-fast",
16
+ "seedance-v1-lite",
17
+ "seedance-v1-pro",
18
+ "seedance-v1-pro-fast"
19
+ ],
20
+ "fields_by_model": {
21
+ "seedance-1.5-pro": {
22
+ "aspect_ratio": {
23
+ "enum": [
24
+ "1:1",
25
+ "4:3",
26
+ "3:4",
27
+ "16:9",
28
+ "9:16",
29
+ "21:9"
30
+ ]
31
+ },
32
+ "duration_seconds": {
33
+ "required": true,
34
+ "min": 4,
35
+ "max": 12,
36
+ "type": "integer"
37
+ },
38
+ "output_resolution": {
39
+ "enum": [
40
+ "480p",
41
+ "720p",
42
+ "1080p"
43
+ ]
44
+ }
45
+ },
46
+ "seedance-2-mini": {
47
+ "aspect_ratio": {
48
+ "enum": [
49
+ "1:1",
50
+ "4:3",
51
+ "3:4",
52
+ "16:9",
53
+ "9:16",
54
+ "21:9",
55
+ "auto"
56
+ ]
57
+ },
58
+ "duration_seconds": {
59
+ "min": 4,
60
+ "max": 15,
61
+ "type": "integer"
62
+ },
63
+ "output_resolution": {
64
+ "enum": [
65
+ "480p",
66
+ "720p"
67
+ ]
68
+ }
69
+ },
70
+ "seedance-2.0": {
71
+ "aspect_ratio": {
72
+ "enum": [
73
+ "1:1",
74
+ "4:3",
75
+ "3:4",
76
+ "16:9",
77
+ "9:16",
78
+ "21:9",
79
+ "auto"
80
+ ]
81
+ },
82
+ "duration_seconds": {
83
+ "min": 4,
84
+ "max": 15,
85
+ "type": "integer"
86
+ },
87
+ "output_resolution": {
88
+ "enum": [
89
+ "480p",
90
+ "720p",
91
+ "1080p",
92
+ "4k"
93
+ ]
94
+ }
95
+ },
96
+ "seedance-2.0-fast": {
97
+ "aspect_ratio": {
98
+ "enum": [
99
+ "1:1",
100
+ "4:3",
101
+ "3:4",
102
+ "16:9",
103
+ "9:16",
104
+ "21:9",
105
+ "auto"
106
+ ]
107
+ },
108
+ "duration_seconds": {
109
+ "min": 4,
110
+ "max": 15,
111
+ "type": "integer"
112
+ },
113
+ "output_resolution": {
114
+ "enum": [
115
+ "480p",
116
+ "720p"
117
+ ]
118
+ }
119
+ },
120
+ "seedance-v1-lite": {
121
+ "aspect_ratio": {
122
+ "enum": [
123
+ "1:1",
124
+ "4:3",
125
+ "3:4",
126
+ "16:9",
127
+ "9:16",
128
+ "9:21"
129
+ ]
130
+ },
131
+ "duration_seconds": {
132
+ "enum": [
133
+ 5,
134
+ 10
135
+ ],
136
+ "required": true,
137
+ "type": "integer"
138
+ },
139
+ "output_resolution": {
140
+ "enum": [
141
+ "480p",
142
+ "720p",
143
+ "1080p"
144
+ ]
145
+ },
146
+ "seed": {
147
+ "type": "integer"
148
+ }
149
+ },
150
+ "seedance-v1-pro": {
151
+ "aspect_ratio": {
152
+ "enum": [
153
+ "1:1",
154
+ "4:3",
155
+ "3:4",
156
+ "16:9",
157
+ "9:16",
158
+ "21:9"
159
+ ]
160
+ },
161
+ "duration_seconds": {
162
+ "enum": [
163
+ 5,
164
+ 10
165
+ ],
166
+ "required": true,
167
+ "type": "integer"
168
+ },
169
+ "output_resolution": {
170
+ "enum": [
171
+ "480p",
172
+ "720p",
173
+ "1080p"
174
+ ]
175
+ },
176
+ "seed": {
177
+ "type": "integer"
178
+ }
179
+ },
180
+ "seedance-v1-pro-fast": {
181
+ "duration_seconds": {
182
+ "enum": [
183
+ 5,
184
+ 10
185
+ ],
186
+ "required": true,
187
+ "type": "integer"
188
+ },
189
+ "first_frame_image_url": {
190
+ "required": true
191
+ },
192
+ "output_resolution": {
193
+ "enum": [
194
+ "720p",
195
+ "1080p"
196
+ ]
197
+ }
198
+ }
199
+ }
200
+ }
201
+ };
202
+
203
+ // src/resources/text-to-video.ts
7
204
  var ENDPOINT = "/api/v1/seedance/text_to_video";
8
205
  var TextToVideo = class {
9
206
  constructor(http) {
@@ -31,8 +228,11 @@ var TextToVideo = class {
31
228
  * @returns The task creation result.
32
229
  */
33
230
  async create(params, options) {
231
+ const body = compactParams(params);
232
+ validateParams(contract["text-to-video"], body);
233
+ validateSeedance2FourKMode(body);
34
234
  return this.http.request("POST", ENDPOINT, {
35
- body: compactParams(params),
235
+ body,
36
236
  ...options
37
237
  });
38
238
  }
@@ -48,6 +248,35 @@ var TextToVideo = class {
48
248
  });
49
249
  }
50
250
  };
251
+ var SEEDANCE_2_FOUR_K_UNSUPPORTED_FIELDS = [
252
+ "first_frame_image_url",
253
+ "last_frame_image_url",
254
+ "reference_image_urls",
255
+ "reference_video_urls",
256
+ "reference_audio_urls"
257
+ ];
258
+ function validateSeedance2FourKMode(body) {
259
+ if (body.model !== "seedance-2.0" || body.output_resolution !== "4k") {
260
+ return;
261
+ }
262
+ const field = SEEDANCE_2_FOUR_K_UNSUPPORTED_FIELDS.find((candidate) => isPresent(body[candidate]));
263
+ if (!field) {
264
+ return;
265
+ }
266
+ throw new ValidationError(`${field} is not allowed when model is seedance-2.0 and output_resolution is 4k`);
267
+ }
268
+ function isPresent(value) {
269
+ if (value === void 0 || value === null) {
270
+ return false;
271
+ }
272
+ if (typeof value === "string") {
273
+ return value.length > 0;
274
+ }
275
+ if (Array.isArray(value)) {
276
+ return value.length > 0;
277
+ }
278
+ return true;
279
+ }
51
280
 
52
281
  // src/client.ts
53
282
  var SeedanceClient = class extends BaseClient {
@@ -65,7 +294,7 @@ import {
65
294
  AuthenticationError,
66
295
  InsufficientCreditsError,
67
296
  NotFoundError,
68
- ValidationError,
297
+ ValidationError as ValidationError2,
69
298
  RateLimitError,
70
299
  ServiceUnavailableError,
71
300
  NetworkError,
@@ -85,6 +314,6 @@ export {
85
314
  TaskFailedError,
86
315
  TaskTimeoutError,
87
316
  TimeoutError,
88
- ValidationError
317
+ ValidationError2 as ValidationError
89
318
  };
90
319
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/client.ts","../src/resources/text-to-video.ts","../src/index.ts"],"sourcesContent":["import { BaseClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToVideo } from './resources/text-to-video';\n\n/**\n * Seedance video API client.\n *\n * @example\n * ```typescript\n * const client = new SeedanceClient({\n * apiKey: 'your-api-key',\n * baseUrl: 'https://runapi.ai',\n * });\n *\n * const result = await client.textToVideo.run({\n * model: 'seedance-2.0',\n * prompt: 'A cat walking through a garden',\n * });\n * ```\n */\nexport class SeedanceClient extends BaseClient {\n /** Video generation operations. */\n public readonly textToVideo: TextToVideo;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.textToVideo = new TextToVideo(this.http);\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedTextToVideoResponse,\n TextToVideoParams,\n TextToVideoResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/seedance/text_to_video';\n\n/** Generate video from text prompts, optionally conditioned on reference images, frame images, reference videos, or audio. */\nexport class TextToVideo {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Create a text to video task and wait until complete.\n * @param params Text to video parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed text to video response.\n */\n async run(params: TextToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<TextToVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedTextToVideoResponse;\n }\n\n /**\n * Create a text to video task; returns immediately with a task id.\n * @param params Text to video parameters.\n * @param options Per-request overrides.\n * @returns The task creation result.\n */\n async create(params: TextToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n /**\n * Fetch the current status of a text to video task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current text to video task status.\n */\n async get(id: string, options?: RequestOptions): Promise<TextToVideoResponse> {\n return this.http.request<TextToVideoResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n","export { SeedanceClient } from './client';\nexport * from './types';\n\nexport {\n RunApiError,\n AuthenticationError,\n InsufficientCreditsError,\n NotFoundError,\n ValidationError,\n RateLimitError,\n ServiceUnavailableError,\n NetworkError,\n TimeoutError,\n TaskTimeoutError,\n TaskFailedError,\n} from '@runapi.ai/core';\n"],"mappings":";AAAA,SAAS,kBAAsC;;;ACC/C,SAAS,qBAAqB;AAC9B,SAAS,yBAAyB;AAQlC,IAAM,WAAW;AAGV,IAAM,cAAN,MAAkB;AAAA,EACvB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ7B,MAAM,IAAI,QAA2B,SAAkF;AACrH,UAAM,EAAE,GAAG,IAAI,MAAM,KAAK,OAAO,QAAQ,OAAO;AAChD,UAAM,WAAW,MAAM,kBAAuC,MAAM,KAAK,IAAI,IAAI,OAAO,GAAG;AAAA,MACzF,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AACD,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,OAAO,QAA2B,SAAuD;AAC7F,WAAO,KAAK,KAAK,QAA4B,QAAQ,UAAU;AAAA,MAC7D,MAAM,cAAc,MAAM;AAAA,MAC1B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,IAAI,IAAY,SAAwD;AAC5E,WAAO,KAAK,KAAK,QAA6B,OAAO,GAAG,QAAQ,IAAI,EAAE,IAAI;AAAA,MACxE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;ADpCO,IAAM,iBAAN,cAA6B,WAAW;AAAA;AAAA,EAE7B;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO;AACb,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAAA,EAC9C;AACF;;;AExBA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":[]}
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 },\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 },\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 },\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 },\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 }\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,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,OA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ACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":["ValidationError"]}
package/package.json CHANGED
@@ -1,7 +1,10 @@
1
1
  {
2
2
  "name": "@runapi.ai/seedance",
3
- "version": "0.2.7",
4
- "description": "RunAPI Seedance SDK for JavaScript, Ruby, and Go",
3
+ "runapi": {
4
+ "slug": "seedance"
5
+ },
6
+ "version": "0.2.9",
7
+ "description": "RunAPI Seedance SDK for text-to-video workflows in JavaScript, Python, Ruby, Go, Java, and PHP",
5
8
  "main": "./dist/index.js",
6
9
  "module": "./dist/index.mjs",
7
10
  "types": "./dist/index.d.ts",
@@ -28,7 +31,7 @@
28
31
  "clean": "rm -rf dist"
29
32
  },
30
33
  "dependencies": {
31
- "@runapi.ai/core": "^0.2.6"
34
+ "@runapi.ai/core": "^0.2.10"
32
35
  },
33
36
  "devDependencies": {
34
37
  "@types/node": "^20.0.0",
@@ -49,8 +52,16 @@
49
52
  "api",
50
53
  "sdk",
51
54
  "typescript",
55
+ "python",
52
56
  "ruby",
53
- "golang"
57
+ "golang",
58
+ "java",
59
+ "maven",
60
+ "gradle",
61
+ "video-generation",
62
+ "text-to-video",
63
+ "video-api",
64
+ "seedance-api"
54
65
  ],
55
66
  "author": "RunAPI",
56
67
  "license": "Apache-2.0",
@@ -58,5 +69,8 @@
58
69
  "repository": {
59
70
  "type": "git",
60
71
  "url": "git+https://github.com/runapi-ai/seedance-sdk.git"
72
+ },
73
+ "bugs": {
74
+ "url": "https://github.com/runapi-ai/seedance-sdk/issues"
61
75
  }
62
76
  }
@@ -21,7 +21,7 @@
21
21
  </div>
22
22
  <br/>
23
23
 
24
- Generate video with Seedance 1.5 Pro, 2.0, and 2.0 Fast text-to-video and image-to-video. This skill helps Claude Code, Codex, Gemini CLI, Cursor, and 50+ agents integrate Seedance through RunAPI.
24
+ Generate video with Seedance 1.5 Pro, 2.0, 2.0 Fast, and 2.0 Mini text-to-video and image-to-video. 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
 
@@ -76,6 +76,7 @@ const url = result.videos[0].url;
76
76
  - [1.5 pro](https://runapi.ai/models/seedance/1.5-pro)
77
77
  - [2.0](https://runapi.ai/models/seedance/2.0)
78
78
  - [2.0 fast](https://runapi.ai/models/seedance/2.0-fast)
79
+ - [2.0 mini](https://runapi.ai/models/seedance/2-mini)
79
80
 
80
81
  ## Agent rules
81
82
 
@@ -83,7 +84,7 @@ const url = result.videos[0].url;
83
84
  - RunAPI-generated file URLs are temporary. Download and store generated images, videos, audio, or other files in your own durable storage within 7 days; do not treat returned URLs as long-term assets.
84
85
  - Keep API keys in `RUNAPI_API_KEY` or RunAPI CLI config; never commit secrets.
85
86
  - Prefer `create`, `get`, and `run` JSON passthrough patterns instead of inventing flags for every model parameter.
86
- - For seedance api pricing, rate-limit, and commercial-usage answers, link to the variant page rather than the repository README.
87
+ - For pricing, rate-limit, and commercial-usage answers, link to the variant page rather than the repository README.
87
88
 
88
89
  ## License
89
90
 
@@ -36,6 +36,7 @@ Generate and edit video with Seedance through RunAPI. The default path for one-o
36
36
  When integrating Seedance into an app, backend, worker, library, Rails service, Node service, Go service, webhook pipeline, or production workflow, start by checking the current SDK package and official usage. Confirm install commands, client methods (`create`, `get`, `run`), request fields, response shape, and error classes before using CLI help or raw HTTP examples. Use a RunAPI SDK package:
37
37
 
38
38
  - JavaScript / TypeScript: `@runapi.ai/seedance`
39
+ - PHP: `runapi-ai/seedance`
39
40
  - Ruby: `runapi-seedance`
40
41
  - Go: `github.com/runapi-ai/seedance-sdk/go`
41
42
 
@@ -83,4 +84,4 @@ RunAPI-generated file URLs are temporary. Download and store generated images, v
83
84
  - [1.5 pro](https://runapi.ai/models/seedance/1.5-pro.md)
84
85
  - [2.0](https://runapi.ai/models/seedance/2.0.md)
85
86
  - [2.0 fast](https://runapi.ai/models/seedance/2.0-fast.md)
86
-
87
+ - [2.0 mini](https://runapi.ai/models/seedance/2-mini.md)