@runapi.ai/kling 0.2.9 → 0.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,22 +1,47 @@
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
+ declare const modelValues: {
5
+ readonly textToVideo: {
6
+ readonly KLING_3_0: "kling-3.0";
7
+ readonly KLING_V2_1_MASTER_TEXT_TO_VIDEO: "kling-v2.1-master-text-to-video";
8
+ readonly KLING_V2_5_TURBO_TEXT_TO_VIDEO_PRO: "kling-v2.5-turbo-text-to-video-pro";
9
+ readonly KLING_V2_6: "kling-v2.6";
10
+ readonly KLING_V3_OMNI: "kling-v3-omni";
11
+ readonly KLING_V3_TURBO_TEXT_TO_VIDEO: "kling-v3-turbo-text-to-video";
12
+ };
13
+ readonly imageToVideo: {
14
+ readonly KLING_V2_1_MASTER_IMAGE_TO_VIDEO: "kling-v2.1-master-image-to-video";
15
+ readonly KLING_V2_1_PRO: "kling-v2.1-pro";
16
+ readonly KLING_V2_1_STANDARD: "kling-v2.1-standard";
17
+ readonly KLING_V2_5_TURBO_IMAGE_TO_VIDEO_PRO: "kling-v2.5-turbo-image-to-video-pro";
18
+ readonly KLING_V2_6: "kling-v2.6";
19
+ readonly KLING_V3_OMNI: "kling-v3-omni";
20
+ readonly KLING_V3_TURBO_IMAGE_TO_VIDEO: "kling-v3-turbo-image-to-video";
21
+ };
22
+ readonly avatar: {
23
+ readonly KLING_AI_AVATAR_PRO: "kling-ai-avatar-pro";
24
+ readonly KLING_AI_AVATAR_STANDARD: "kling-ai-avatar-standard";
25
+ readonly KLING_AI_AVATAR_V1_PRO: "kling-ai-avatar-v1-pro";
26
+ readonly KLING_V1_AVATAR_STANDARD: "kling-v1-avatar-standard";
27
+ };
28
+ };
29
+
4
30
  /**
5
31
  * Text-to-video model variants. kling-3.0 supports multi-shot, sound, first/last frame images,
6
32
  * and Kling elements. V2.x models support negative prompts and cfg_scale instead.
7
33
  */
8
- type KlingTextToVideoModel = 'kling-3.0' | 'kling-v3-turbo-text-to-video' | 'kling-v2.5-turbo-text-to-video-pro' | 'kling-v2.1-master-text-to-video';
9
- /**
10
- * Image-to-video model variants. V2.5 turbo and V2.1 pro support last-frame image control.
11
- */
12
- type KlingV2ImageToVideoModel = 'kling-v2.5-turbo-image-to-video-pro' | 'kling-v2.1-pro' | 'kling-v2.1-standard' | 'kling-v2.1-master-image-to-video';
13
- type KlingImageToVideoModel = KlingV2ImageToVideoModel | 'kling-v3-turbo-image-to-video';
34
+ type KlingTextToVideoModel = (typeof modelValues.textToVideo)[keyof typeof modelValues.textToVideo];
35
+ /** Earlier V2 image-to-video variants. V2.5 turbo and V2.1 pro support last-frame image control. */
36
+ type KlingV2ImageToVideoModel = (typeof modelValues.imageToVideo.KLING_V2_5_TURBO_IMAGE_TO_VIDEO_PRO) | (typeof modelValues.imageToVideo.KLING_V2_1_PRO) | (typeof modelValues.imageToVideo.KLING_V2_1_STANDARD) | (typeof modelValues.imageToVideo.KLING_V2_1_MASTER_IMAGE_TO_VIDEO);
37
+ type KlingImageToVideoModel = (typeof modelValues.imageToVideo)[keyof typeof modelValues.imageToVideo];
14
38
  /** Output resolution for text-to-video. 4k is highest quality but slowest. */
15
39
  type KlingTextToVideoOutputResolution = '720p' | '1080p' | '4k';
16
40
  type KlingV3TurboOutputResolution = '720p' | '1080p';
17
41
  type KlingAspectRatio = '16:9' | '9:16' | '1:1';
18
42
  /** Duration in seconds. Range varies by model: 3-15 for kling-3.0, 5 or 10 for V2.x. */
19
43
  type KlingDuration = number;
44
+ type KlingV26Mode = 'std' | 'pro';
20
45
  /** A single shot in a multi-shot text-to-video sequence. */
21
46
  interface MultiPromptItem {
22
47
  prompt: string;
@@ -40,7 +65,7 @@ interface KlingElement {
40
65
  end_time?: number;
41
66
  }
42
67
  interface Kling3TextToVideoCommonParams {
43
- model: 'kling-3.0';
68
+ model: (typeof modelValues.textToVideo.KLING_3_0);
44
69
  /** Duration in seconds (3-15). */
45
70
  duration_seconds?: KlingDuration;
46
71
  aspect_ratio?: KlingAspectRatio;
@@ -74,7 +99,7 @@ interface Kling3TextToVideoMultiShotParams extends Kling3TextToVideoCommonParams
74
99
  }
75
100
  /** V2.5 Turbo text-to-video: fast, high-quality generation with negative prompt and cfg_scale control. */
76
101
  interface V25TurboTextToVideoParams {
77
- model: 'kling-v2.5-turbo-text-to-video-pro';
102
+ model: (typeof modelValues.textToVideo.KLING_V2_5_TURBO_TEXT_TO_VIDEO_PRO);
78
103
  prompt: string;
79
104
  /** Duration: 5 or 10 seconds. */
80
105
  duration_seconds?: 5 | 10;
@@ -87,7 +112,7 @@ interface V25TurboTextToVideoParams {
87
112
  }
88
113
  /** V2.1 Master text-to-video: highest V2.1 quality with negative prompt and cfg_scale control. */
89
114
  interface V21MasterTextToVideoParams {
90
- model: 'kling-v2.1-master-text-to-video';
115
+ model: (typeof modelValues.textToVideo.KLING_V2_1_MASTER_TEXT_TO_VIDEO);
91
116
  prompt: string;
92
117
  duration_seconds?: 5 | 10;
93
118
  aspect_ratio?: KlingAspectRatio;
@@ -97,7 +122,7 @@ interface V21MasterTextToVideoParams {
97
122
  }
98
123
  /** V3 Turbo text-to-video: prompt-driven 3-15 second clips at 720p or 1080p. */
99
124
  interface V3TurboTextToVideoParams {
100
- model: 'kling-v3-turbo-text-to-video';
125
+ model: (typeof modelValues.textToVideo.KLING_V3_TURBO_TEXT_TO_VIDEO);
101
126
  prompt: string;
102
127
  /** Duration in seconds (3-15). */
103
128
  duration_seconds?: KlingDuration;
@@ -105,10 +130,31 @@ interface V3TurboTextToVideoParams {
105
130
  output_resolution?: KlingV3TurboOutputResolution;
106
131
  callback_url?: string;
107
132
  }
133
+ /** Kling 2.6 text-to-video with standard/pro quality modes and optional sound in pro mode. */
134
+ interface KlingV26TextToVideoParams {
135
+ model: 'kling-v2.6';
136
+ prompt: string;
137
+ mode?: KlingV26Mode;
138
+ duration_seconds?: 5 | 10;
139
+ /** Generate synchronized audio; true requires mode pro. */
140
+ enable_sound?: boolean;
141
+ aspect_ratio?: KlingAspectRatio;
142
+ callback_url?: string;
143
+ }
144
+ /** Kling v3 Omni text-to-video with native 4K, synchronized sound, and flexible duration. */
145
+ interface V3OmniTextToVideoParams {
146
+ model: (typeof modelValues.textToVideo.KLING_V3_OMNI);
147
+ prompt: string;
148
+ output_resolution?: KlingTextToVideoOutputResolution;
149
+ duration_seconds?: KlingDuration;
150
+ enable_sound?: boolean;
151
+ aspect_ratio?: KlingAspectRatio;
152
+ callback_url?: string;
153
+ }
108
154
  /**
109
- * Image-to-video generation parameters. A first-frame image is required; the model
155
+ * Earlier V2 image-to-video parameters. A first-frame image is required; the model
110
156
  * animates it into video guided by the text prompt. last_frame_image_url is supported
111
- * on V2.5 turbo and V2.1 pro models only.
157
+ * on V2.5 turbo and V2.1 pro.
112
158
  */
113
159
  interface V2ImageToVideoParams {
114
160
  model: KlingV2ImageToVideoModel;
@@ -125,15 +171,49 @@ interface V2ImageToVideoParams {
125
171
  }
126
172
  /** V3 Turbo image-to-video: animate one first-frame image at 720p or 1080p. */
127
173
  interface V3TurboImageToVideoParams {
128
- model: 'kling-v3-turbo-image-to-video';
174
+ model: (typeof modelValues.imageToVideo.KLING_V3_TURBO_IMAGE_TO_VIDEO);
129
175
  prompt: string;
130
176
  first_frame_image_url: string;
131
177
  duration_seconds?: KlingDuration;
132
178
  output_resolution?: KlingV3TurboOutputResolution;
133
179
  callback_url?: string;
134
180
  }
135
- type TextToVideoParams = Kling3TextToVideoSingleShotParams | Kling3TextToVideoMultiShotParams | V25TurboTextToVideoParams | V21MasterTextToVideoParams | V3TurboTextToVideoParams;
136
- type ImageToVideoParams = V2ImageToVideoParams | V3TurboImageToVideoParams;
181
+ /** Kling 2.6 image-to-video with optional sound and final-frame control in pro mode. */
182
+ interface KlingV26ImageToVideoParams {
183
+ model: 'kling-v2.6';
184
+ prompt: string;
185
+ first_frame_image_url: string;
186
+ /** Final frame URL; requires mode pro and duration_seconds 5. */
187
+ last_frame_image_url?: string;
188
+ mode?: KlingV26Mode;
189
+ duration_seconds?: 5 | 10;
190
+ /** Generate synchronized audio; true requires mode pro. */
191
+ enable_sound?: boolean;
192
+ aspect_ratio?: KlingAspectRatio;
193
+ callback_url?: string;
194
+ }
195
+ /** Kling v3 Omni image-to-video from caller-owned first and optional final frames. */
196
+ interface V3OmniImageToVideoParams {
197
+ model: (typeof modelValues.imageToVideo.KLING_V3_OMNI);
198
+ prompt: string;
199
+ first_frame_image_url: string;
200
+ /** Final frame image URL; requires duration_seconds 5. */
201
+ last_frame_image_url?: string;
202
+ output_resolution?: KlingTextToVideoOutputResolution;
203
+ duration_seconds?: KlingDuration;
204
+ enable_sound?: boolean;
205
+ aspect_ratio?: KlingAspectRatio;
206
+ callback_url?: string;
207
+ }
208
+ type TextToVideoParams = Kling3TextToVideoSingleShotParams | Kling3TextToVideoMultiShotParams | KlingV26TextToVideoParams | V25TurboTextToVideoParams | V21MasterTextToVideoParams | V3TurboTextToVideoParams | V3OmniTextToVideoParams;
209
+ type ImageToVideoParams = V2ImageToVideoParams | KlingV26ImageToVideoParams | V3TurboImageToVideoParams | V3OmniImageToVideoParams;
210
+ /** Continue a completed Kling V2.5 Turbo video task. */
211
+ interface KlingExtendVideoParams {
212
+ source_task_id: string;
213
+ mode?: 'std' | 'pro';
214
+ prompt?: string;
215
+ callback_url?: string;
216
+ }
137
217
  interface AsyncTaskResponse {
138
218
  id: string;
139
219
  status: AsyncTaskStatus;
@@ -158,7 +238,7 @@ interface ImageToVideoResponse extends AsyncTaskResponse {
158
238
  * AI avatar quality tier. Pro models produce the most natural lip movements;
159
239
  * Standard models are faster with slightly less refined lip sync.
160
240
  */
161
- type AiAvatarModel = 'kling-ai-avatar-pro' | 'kling-ai-avatar-standard' | 'kling-ai-avatar-v1-pro' | 'kling-v1-avatar-standard';
241
+ type AiAvatarModel = (typeof modelValues.avatar)[keyof typeof modelValues.avatar];
162
242
  /** Lip-sync a face image to an audio track, producing a talking-head video. */
163
243
  interface AiAvatarParams {
164
244
  model: AiAvatarModel;
@@ -180,7 +260,7 @@ interface AiAvatarResponse extends AsyncTaskResponse {
180
260
  * the movement patterns from the reference while preserving its own appearance.
181
261
  */
182
262
  interface MotionControlParams {
183
- model: 'kling-3.0';
263
+ model: (typeof modelValues.textToVideo.KLING_3_0);
184
264
  /** Subject image URL whose appearance is preserved. */
185
265
  source_image_url: string;
186
266
  /** Reference video URL whose motion patterns are transferred. */
@@ -324,6 +404,14 @@ declare class MotionControl {
324
404
  get(id: string, options?: RequestOptions): Promise<MotionControlResponse>;
325
405
  }
326
406
 
407
+ declare class ExtendVideo {
408
+ private readonly http;
409
+ constructor(http: HttpClient);
410
+ run(params: KlingExtendVideoParams, options?: RequestOptions & PollingOptions): Promise<TextToVideoResponse>;
411
+ create(params: KlingExtendVideoParams, options?: RequestOptions): Promise<TaskCreateResponse>;
412
+ get(id: string, options?: RequestOptions): Promise<TextToVideoResponse>;
413
+ }
414
+
327
415
  /**
328
416
  * Kling video generation, AI avatar lip-sync, and motion control API client.
329
417
  *
@@ -346,7 +434,8 @@ declare class KlingClient extends BaseClient {
346
434
  readonly aiAvatar: AiAvatar;
347
435
  /** Transfer motion from a reference video onto a subject image. */
348
436
  readonly motionControl: MotionControl;
437
+ readonly extendVideo: ExtendVideo;
349
438
  constructor(options?: ClientOptions);
350
439
  }
351
440
 
352
- export { type AiAvatarModel, type AiAvatarParams, type AiAvatarResponse, type AsyncTaskResponse, type CompletedAiAvatarResponse, type CompletedImageToVideoResponse, type CompletedMotionControlResponse, type CompletedTextToVideoResponse, type ImageToVideoParams, type ImageToVideoResponse, type Kling3TextToVideoMultiShotParams, type Kling3TextToVideoSingleShotParams, type KlingAspectRatio, KlingClient, type KlingDuration, type KlingElement, type KlingImageToVideoModel, type KlingTextToVideoModel, type KlingTextToVideoOutputResolution, type KlingV2ImageToVideoModel, type KlingV3TurboOutputResolution, type MotionControlParams, type MotionControlResponse, type MultiPromptItem, type TaskCreateResponse, type TextToVideoParams, type TextToVideoResponse, type V21MasterTextToVideoParams, type V25TurboTextToVideoParams, type V2ImageToVideoParams, type V3TurboImageToVideoParams, type V3TurboTextToVideoParams, type VideoMetadata };
441
+ export { type AiAvatarModel, type AiAvatarParams, type AiAvatarResponse, type AsyncTaskResponse, type CompletedAiAvatarResponse, type CompletedImageToVideoResponse, type CompletedMotionControlResponse, type CompletedTextToVideoResponse, type ImageToVideoParams, type ImageToVideoResponse, type Kling3TextToVideoMultiShotParams, type Kling3TextToVideoSingleShotParams, type KlingAspectRatio, KlingClient, type KlingDuration, type KlingElement, type KlingExtendVideoParams, type KlingImageToVideoModel, type KlingTextToVideoModel, type KlingTextToVideoOutputResolution, type KlingV26ImageToVideoParams, type KlingV26Mode, type KlingV26TextToVideoParams, type KlingV2ImageToVideoModel, type KlingV3TurboOutputResolution, type MotionControlParams, type MotionControlResponse, type MultiPromptItem, type TaskCreateResponse, type TextToVideoParams, type TextToVideoResponse, type V21MasterTextToVideoParams, type V25TurboTextToVideoParams, type V2ImageToVideoParams, type V3OmniImageToVideoParams, type V3OmniTextToVideoParams, type V3TurboImageToVideoParams, type V3TurboTextToVideoParams, type VideoMetadata };
package/dist/index.d.ts CHANGED
@@ -1,22 +1,47 @@
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
+ declare const modelValues: {
5
+ readonly textToVideo: {
6
+ readonly KLING_3_0: "kling-3.0";
7
+ readonly KLING_V2_1_MASTER_TEXT_TO_VIDEO: "kling-v2.1-master-text-to-video";
8
+ readonly KLING_V2_5_TURBO_TEXT_TO_VIDEO_PRO: "kling-v2.5-turbo-text-to-video-pro";
9
+ readonly KLING_V2_6: "kling-v2.6";
10
+ readonly KLING_V3_OMNI: "kling-v3-omni";
11
+ readonly KLING_V3_TURBO_TEXT_TO_VIDEO: "kling-v3-turbo-text-to-video";
12
+ };
13
+ readonly imageToVideo: {
14
+ readonly KLING_V2_1_MASTER_IMAGE_TO_VIDEO: "kling-v2.1-master-image-to-video";
15
+ readonly KLING_V2_1_PRO: "kling-v2.1-pro";
16
+ readonly KLING_V2_1_STANDARD: "kling-v2.1-standard";
17
+ readonly KLING_V2_5_TURBO_IMAGE_TO_VIDEO_PRO: "kling-v2.5-turbo-image-to-video-pro";
18
+ readonly KLING_V2_6: "kling-v2.6";
19
+ readonly KLING_V3_OMNI: "kling-v3-omni";
20
+ readonly KLING_V3_TURBO_IMAGE_TO_VIDEO: "kling-v3-turbo-image-to-video";
21
+ };
22
+ readonly avatar: {
23
+ readonly KLING_AI_AVATAR_PRO: "kling-ai-avatar-pro";
24
+ readonly KLING_AI_AVATAR_STANDARD: "kling-ai-avatar-standard";
25
+ readonly KLING_AI_AVATAR_V1_PRO: "kling-ai-avatar-v1-pro";
26
+ readonly KLING_V1_AVATAR_STANDARD: "kling-v1-avatar-standard";
27
+ };
28
+ };
29
+
4
30
  /**
5
31
  * Text-to-video model variants. kling-3.0 supports multi-shot, sound, first/last frame images,
6
32
  * and Kling elements. V2.x models support negative prompts and cfg_scale instead.
7
33
  */
8
- type KlingTextToVideoModel = 'kling-3.0' | 'kling-v3-turbo-text-to-video' | 'kling-v2.5-turbo-text-to-video-pro' | 'kling-v2.1-master-text-to-video';
9
- /**
10
- * Image-to-video model variants. V2.5 turbo and V2.1 pro support last-frame image control.
11
- */
12
- type KlingV2ImageToVideoModel = 'kling-v2.5-turbo-image-to-video-pro' | 'kling-v2.1-pro' | 'kling-v2.1-standard' | 'kling-v2.1-master-image-to-video';
13
- type KlingImageToVideoModel = KlingV2ImageToVideoModel | 'kling-v3-turbo-image-to-video';
34
+ type KlingTextToVideoModel = (typeof modelValues.textToVideo)[keyof typeof modelValues.textToVideo];
35
+ /** Earlier V2 image-to-video variants. V2.5 turbo and V2.1 pro support last-frame image control. */
36
+ type KlingV2ImageToVideoModel = (typeof modelValues.imageToVideo.KLING_V2_5_TURBO_IMAGE_TO_VIDEO_PRO) | (typeof modelValues.imageToVideo.KLING_V2_1_PRO) | (typeof modelValues.imageToVideo.KLING_V2_1_STANDARD) | (typeof modelValues.imageToVideo.KLING_V2_1_MASTER_IMAGE_TO_VIDEO);
37
+ type KlingImageToVideoModel = (typeof modelValues.imageToVideo)[keyof typeof modelValues.imageToVideo];
14
38
  /** Output resolution for text-to-video. 4k is highest quality but slowest. */
15
39
  type KlingTextToVideoOutputResolution = '720p' | '1080p' | '4k';
16
40
  type KlingV3TurboOutputResolution = '720p' | '1080p';
17
41
  type KlingAspectRatio = '16:9' | '9:16' | '1:1';
18
42
  /** Duration in seconds. Range varies by model: 3-15 for kling-3.0, 5 or 10 for V2.x. */
19
43
  type KlingDuration = number;
44
+ type KlingV26Mode = 'std' | 'pro';
20
45
  /** A single shot in a multi-shot text-to-video sequence. */
21
46
  interface MultiPromptItem {
22
47
  prompt: string;
@@ -40,7 +65,7 @@ interface KlingElement {
40
65
  end_time?: number;
41
66
  }
42
67
  interface Kling3TextToVideoCommonParams {
43
- model: 'kling-3.0';
68
+ model: (typeof modelValues.textToVideo.KLING_3_0);
44
69
  /** Duration in seconds (3-15). */
45
70
  duration_seconds?: KlingDuration;
46
71
  aspect_ratio?: KlingAspectRatio;
@@ -74,7 +99,7 @@ interface Kling3TextToVideoMultiShotParams extends Kling3TextToVideoCommonParams
74
99
  }
75
100
  /** V2.5 Turbo text-to-video: fast, high-quality generation with negative prompt and cfg_scale control. */
76
101
  interface V25TurboTextToVideoParams {
77
- model: 'kling-v2.5-turbo-text-to-video-pro';
102
+ model: (typeof modelValues.textToVideo.KLING_V2_5_TURBO_TEXT_TO_VIDEO_PRO);
78
103
  prompt: string;
79
104
  /** Duration: 5 or 10 seconds. */
80
105
  duration_seconds?: 5 | 10;
@@ -87,7 +112,7 @@ interface V25TurboTextToVideoParams {
87
112
  }
88
113
  /** V2.1 Master text-to-video: highest V2.1 quality with negative prompt and cfg_scale control. */
89
114
  interface V21MasterTextToVideoParams {
90
- model: 'kling-v2.1-master-text-to-video';
115
+ model: (typeof modelValues.textToVideo.KLING_V2_1_MASTER_TEXT_TO_VIDEO);
91
116
  prompt: string;
92
117
  duration_seconds?: 5 | 10;
93
118
  aspect_ratio?: KlingAspectRatio;
@@ -97,7 +122,7 @@ interface V21MasterTextToVideoParams {
97
122
  }
98
123
  /** V3 Turbo text-to-video: prompt-driven 3-15 second clips at 720p or 1080p. */
99
124
  interface V3TurboTextToVideoParams {
100
- model: 'kling-v3-turbo-text-to-video';
125
+ model: (typeof modelValues.textToVideo.KLING_V3_TURBO_TEXT_TO_VIDEO);
101
126
  prompt: string;
102
127
  /** Duration in seconds (3-15). */
103
128
  duration_seconds?: KlingDuration;
@@ -105,10 +130,31 @@ interface V3TurboTextToVideoParams {
105
130
  output_resolution?: KlingV3TurboOutputResolution;
106
131
  callback_url?: string;
107
132
  }
133
+ /** Kling 2.6 text-to-video with standard/pro quality modes and optional sound in pro mode. */
134
+ interface KlingV26TextToVideoParams {
135
+ model: 'kling-v2.6';
136
+ prompt: string;
137
+ mode?: KlingV26Mode;
138
+ duration_seconds?: 5 | 10;
139
+ /** Generate synchronized audio; true requires mode pro. */
140
+ enable_sound?: boolean;
141
+ aspect_ratio?: KlingAspectRatio;
142
+ callback_url?: string;
143
+ }
144
+ /** Kling v3 Omni text-to-video with native 4K, synchronized sound, and flexible duration. */
145
+ interface V3OmniTextToVideoParams {
146
+ model: (typeof modelValues.textToVideo.KLING_V3_OMNI);
147
+ prompt: string;
148
+ output_resolution?: KlingTextToVideoOutputResolution;
149
+ duration_seconds?: KlingDuration;
150
+ enable_sound?: boolean;
151
+ aspect_ratio?: KlingAspectRatio;
152
+ callback_url?: string;
153
+ }
108
154
  /**
109
- * Image-to-video generation parameters. A first-frame image is required; the model
155
+ * Earlier V2 image-to-video parameters. A first-frame image is required; the model
110
156
  * animates it into video guided by the text prompt. last_frame_image_url is supported
111
- * on V2.5 turbo and V2.1 pro models only.
157
+ * on V2.5 turbo and V2.1 pro.
112
158
  */
113
159
  interface V2ImageToVideoParams {
114
160
  model: KlingV2ImageToVideoModel;
@@ -125,15 +171,49 @@ interface V2ImageToVideoParams {
125
171
  }
126
172
  /** V3 Turbo image-to-video: animate one first-frame image at 720p or 1080p. */
127
173
  interface V3TurboImageToVideoParams {
128
- model: 'kling-v3-turbo-image-to-video';
174
+ model: (typeof modelValues.imageToVideo.KLING_V3_TURBO_IMAGE_TO_VIDEO);
129
175
  prompt: string;
130
176
  first_frame_image_url: string;
131
177
  duration_seconds?: KlingDuration;
132
178
  output_resolution?: KlingV3TurboOutputResolution;
133
179
  callback_url?: string;
134
180
  }
135
- type TextToVideoParams = Kling3TextToVideoSingleShotParams | Kling3TextToVideoMultiShotParams | V25TurboTextToVideoParams | V21MasterTextToVideoParams | V3TurboTextToVideoParams;
136
- type ImageToVideoParams = V2ImageToVideoParams | V3TurboImageToVideoParams;
181
+ /** Kling 2.6 image-to-video with optional sound and final-frame control in pro mode. */
182
+ interface KlingV26ImageToVideoParams {
183
+ model: 'kling-v2.6';
184
+ prompt: string;
185
+ first_frame_image_url: string;
186
+ /** Final frame URL; requires mode pro and duration_seconds 5. */
187
+ last_frame_image_url?: string;
188
+ mode?: KlingV26Mode;
189
+ duration_seconds?: 5 | 10;
190
+ /** Generate synchronized audio; true requires mode pro. */
191
+ enable_sound?: boolean;
192
+ aspect_ratio?: KlingAspectRatio;
193
+ callback_url?: string;
194
+ }
195
+ /** Kling v3 Omni image-to-video from caller-owned first and optional final frames. */
196
+ interface V3OmniImageToVideoParams {
197
+ model: (typeof modelValues.imageToVideo.KLING_V3_OMNI);
198
+ prompt: string;
199
+ first_frame_image_url: string;
200
+ /** Final frame image URL; requires duration_seconds 5. */
201
+ last_frame_image_url?: string;
202
+ output_resolution?: KlingTextToVideoOutputResolution;
203
+ duration_seconds?: KlingDuration;
204
+ enable_sound?: boolean;
205
+ aspect_ratio?: KlingAspectRatio;
206
+ callback_url?: string;
207
+ }
208
+ type TextToVideoParams = Kling3TextToVideoSingleShotParams | Kling3TextToVideoMultiShotParams | KlingV26TextToVideoParams | V25TurboTextToVideoParams | V21MasterTextToVideoParams | V3TurboTextToVideoParams | V3OmniTextToVideoParams;
209
+ type ImageToVideoParams = V2ImageToVideoParams | KlingV26ImageToVideoParams | V3TurboImageToVideoParams | V3OmniImageToVideoParams;
210
+ /** Continue a completed Kling V2.5 Turbo video task. */
211
+ interface KlingExtendVideoParams {
212
+ source_task_id: string;
213
+ mode?: 'std' | 'pro';
214
+ prompt?: string;
215
+ callback_url?: string;
216
+ }
137
217
  interface AsyncTaskResponse {
138
218
  id: string;
139
219
  status: AsyncTaskStatus;
@@ -158,7 +238,7 @@ interface ImageToVideoResponse extends AsyncTaskResponse {
158
238
  * AI avatar quality tier. Pro models produce the most natural lip movements;
159
239
  * Standard models are faster with slightly less refined lip sync.
160
240
  */
161
- type AiAvatarModel = 'kling-ai-avatar-pro' | 'kling-ai-avatar-standard' | 'kling-ai-avatar-v1-pro' | 'kling-v1-avatar-standard';
241
+ type AiAvatarModel = (typeof modelValues.avatar)[keyof typeof modelValues.avatar];
162
242
  /** Lip-sync a face image to an audio track, producing a talking-head video. */
163
243
  interface AiAvatarParams {
164
244
  model: AiAvatarModel;
@@ -180,7 +260,7 @@ interface AiAvatarResponse extends AsyncTaskResponse {
180
260
  * the movement patterns from the reference while preserving its own appearance.
181
261
  */
182
262
  interface MotionControlParams {
183
- model: 'kling-3.0';
263
+ model: (typeof modelValues.textToVideo.KLING_3_0);
184
264
  /** Subject image URL whose appearance is preserved. */
185
265
  source_image_url: string;
186
266
  /** Reference video URL whose motion patterns are transferred. */
@@ -324,6 +404,14 @@ declare class MotionControl {
324
404
  get(id: string, options?: RequestOptions): Promise<MotionControlResponse>;
325
405
  }
326
406
 
407
+ declare class ExtendVideo {
408
+ private readonly http;
409
+ constructor(http: HttpClient);
410
+ run(params: KlingExtendVideoParams, options?: RequestOptions & PollingOptions): Promise<TextToVideoResponse>;
411
+ create(params: KlingExtendVideoParams, options?: RequestOptions): Promise<TaskCreateResponse>;
412
+ get(id: string, options?: RequestOptions): Promise<TextToVideoResponse>;
413
+ }
414
+
327
415
  /**
328
416
  * Kling video generation, AI avatar lip-sync, and motion control API client.
329
417
  *
@@ -346,7 +434,8 @@ declare class KlingClient extends BaseClient {
346
434
  readonly aiAvatar: AiAvatar;
347
435
  /** Transfer motion from a reference video onto a subject image. */
348
436
  readonly motionControl: MotionControl;
437
+ readonly extendVideo: ExtendVideo;
349
438
  constructor(options?: ClientOptions);
350
439
  }
351
440
 
352
- export { type AiAvatarModel, type AiAvatarParams, type AiAvatarResponse, type AsyncTaskResponse, type CompletedAiAvatarResponse, type CompletedImageToVideoResponse, type CompletedMotionControlResponse, type CompletedTextToVideoResponse, type ImageToVideoParams, type ImageToVideoResponse, type Kling3TextToVideoMultiShotParams, type Kling3TextToVideoSingleShotParams, type KlingAspectRatio, KlingClient, type KlingDuration, type KlingElement, type KlingImageToVideoModel, type KlingTextToVideoModel, type KlingTextToVideoOutputResolution, type KlingV2ImageToVideoModel, type KlingV3TurboOutputResolution, type MotionControlParams, type MotionControlResponse, type MultiPromptItem, type TaskCreateResponse, type TextToVideoParams, type TextToVideoResponse, type V21MasterTextToVideoParams, type V25TurboTextToVideoParams, type V2ImageToVideoParams, type V3TurboImageToVideoParams, type V3TurboTextToVideoParams, type VideoMetadata };
441
+ export { type AiAvatarModel, type AiAvatarParams, type AiAvatarResponse, type AsyncTaskResponse, type CompletedAiAvatarResponse, type CompletedImageToVideoResponse, type CompletedMotionControlResponse, type CompletedTextToVideoResponse, type ImageToVideoParams, type ImageToVideoResponse, type Kling3TextToVideoMultiShotParams, type Kling3TextToVideoSingleShotParams, type KlingAspectRatio, KlingClient, type KlingDuration, type KlingElement, type KlingExtendVideoParams, type KlingImageToVideoModel, type KlingTextToVideoModel, type KlingTextToVideoOutputResolution, type KlingV26ImageToVideoParams, type KlingV26Mode, type KlingV26TextToVideoParams, type KlingV2ImageToVideoModel, type KlingV3TurboOutputResolution, type MotionControlParams, type MotionControlResponse, type MultiPromptItem, type TaskCreateResponse, type TextToVideoParams, type TextToVideoResponse, type V21MasterTextToVideoParams, type V25TurboTextToVideoParams, type V2ImageToVideoParams, type V3OmniImageToVideoParams, type V3OmniTextToVideoParams, type V3TurboImageToVideoParams, type V3TurboTextToVideoParams, type VideoMetadata };