@runapi.ai/kling 0.2.10 → 0.2.12

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,14 +1,44 @@
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
+ readonly motionControl: {
29
+ readonly KLING_3_0: "kling-3.0";
30
+ readonly KLING_V2_6: "kling-v2.6";
31
+ };
32
+ };
33
+
4
34
  /**
5
35
  * Text-to-video model variants. kling-3.0 supports multi-shot, sound, first/last frame images,
6
36
  * and Kling elements. V2.x models support negative prompts and cfg_scale instead.
7
37
  */
8
- type KlingTextToVideoModel = 'kling-3.0' | 'kling-v2.6' | 'kling-v3-turbo-text-to-video' | 'kling-v2.5-turbo-text-to-video-pro' | 'kling-v2.1-master-text-to-video';
38
+ type KlingTextToVideoModel = (typeof modelValues.textToVideo)[keyof typeof modelValues.textToVideo];
9
39
  /** Earlier V2 image-to-video variants. V2.5 turbo and V2.1 pro support last-frame image control. */
10
- 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';
11
- type KlingImageToVideoModel = KlingV2ImageToVideoModel | 'kling-v2.6' | 'kling-v3-turbo-image-to-video';
40
+ 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);
41
+ type KlingImageToVideoModel = (typeof modelValues.imageToVideo)[keyof typeof modelValues.imageToVideo];
12
42
  /** Output resolution for text-to-video. 4k is highest quality but slowest. */
13
43
  type KlingTextToVideoOutputResolution = '720p' | '1080p' | '4k';
14
44
  type KlingV3TurboOutputResolution = '720p' | '1080p';
@@ -39,7 +69,7 @@ interface KlingElement {
39
69
  end_time?: number;
40
70
  }
41
71
  interface Kling3TextToVideoCommonParams {
42
- model: 'kling-3.0';
72
+ model: (typeof modelValues.textToVideo.KLING_3_0);
43
73
  /** Duration in seconds (3-15). */
44
74
  duration_seconds?: KlingDuration;
45
75
  aspect_ratio?: KlingAspectRatio;
@@ -73,7 +103,7 @@ interface Kling3TextToVideoMultiShotParams extends Kling3TextToVideoCommonParams
73
103
  }
74
104
  /** V2.5 Turbo text-to-video: fast, high-quality generation with negative prompt and cfg_scale control. */
75
105
  interface V25TurboTextToVideoParams {
76
- model: 'kling-v2.5-turbo-text-to-video-pro';
106
+ model: (typeof modelValues.textToVideo.KLING_V2_5_TURBO_TEXT_TO_VIDEO_PRO);
77
107
  prompt: string;
78
108
  /** Duration: 5 or 10 seconds. */
79
109
  duration_seconds?: 5 | 10;
@@ -86,7 +116,7 @@ interface V25TurboTextToVideoParams {
86
116
  }
87
117
  /** V2.1 Master text-to-video: highest V2.1 quality with negative prompt and cfg_scale control. */
88
118
  interface V21MasterTextToVideoParams {
89
- model: 'kling-v2.1-master-text-to-video';
119
+ model: (typeof modelValues.textToVideo.KLING_V2_1_MASTER_TEXT_TO_VIDEO);
90
120
  prompt: string;
91
121
  duration_seconds?: 5 | 10;
92
122
  aspect_ratio?: KlingAspectRatio;
@@ -96,7 +126,7 @@ interface V21MasterTextToVideoParams {
96
126
  }
97
127
  /** V3 Turbo text-to-video: prompt-driven 3-15 second clips at 720p or 1080p. */
98
128
  interface V3TurboTextToVideoParams {
99
- model: 'kling-v3-turbo-text-to-video';
129
+ model: (typeof modelValues.textToVideo.KLING_V3_TURBO_TEXT_TO_VIDEO);
100
130
  prompt: string;
101
131
  /** Duration in seconds (3-15). */
102
132
  duration_seconds?: KlingDuration;
@@ -115,6 +145,16 @@ interface KlingV26TextToVideoParams {
115
145
  aspect_ratio?: KlingAspectRatio;
116
146
  callback_url?: string;
117
147
  }
148
+ /** Kling v3 Omni text-to-video with native 4K, synchronized sound, and flexible duration. */
149
+ interface V3OmniTextToVideoParams {
150
+ model: (typeof modelValues.textToVideo.KLING_V3_OMNI);
151
+ prompt: string;
152
+ output_resolution?: KlingTextToVideoOutputResolution;
153
+ duration_seconds?: KlingDuration;
154
+ enable_sound?: boolean;
155
+ aspect_ratio?: KlingAspectRatio;
156
+ callback_url?: string;
157
+ }
118
158
  /**
119
159
  * Earlier V2 image-to-video parameters. A first-frame image is required; the model
120
160
  * animates it into video guided by the text prompt. last_frame_image_url is supported
@@ -135,7 +175,7 @@ interface V2ImageToVideoParams {
135
175
  }
136
176
  /** V3 Turbo image-to-video: animate one first-frame image at 720p or 1080p. */
137
177
  interface V3TurboImageToVideoParams {
138
- model: 'kling-v3-turbo-image-to-video';
178
+ model: (typeof modelValues.imageToVideo.KLING_V3_TURBO_IMAGE_TO_VIDEO);
139
179
  prompt: string;
140
180
  first_frame_image_url: string;
141
181
  duration_seconds?: KlingDuration;
@@ -156,8 +196,28 @@ interface KlingV26ImageToVideoParams {
156
196
  aspect_ratio?: KlingAspectRatio;
157
197
  callback_url?: string;
158
198
  }
159
- type TextToVideoParams = Kling3TextToVideoSingleShotParams | Kling3TextToVideoMultiShotParams | KlingV26TextToVideoParams | V25TurboTextToVideoParams | V21MasterTextToVideoParams | V3TurboTextToVideoParams;
160
- type ImageToVideoParams = V2ImageToVideoParams | KlingV26ImageToVideoParams | V3TurboImageToVideoParams;
199
+ /** Kling v3 Omni image-to-video from caller-owned first and optional final frames. */
200
+ interface V3OmniImageToVideoParams {
201
+ model: (typeof modelValues.imageToVideo.KLING_V3_OMNI);
202
+ prompt: string;
203
+ first_frame_image_url: string;
204
+ /** Final frame image URL; requires duration_seconds 5. */
205
+ last_frame_image_url?: string;
206
+ output_resolution?: KlingTextToVideoOutputResolution;
207
+ duration_seconds?: KlingDuration;
208
+ enable_sound?: boolean;
209
+ aspect_ratio?: KlingAspectRatio;
210
+ callback_url?: string;
211
+ }
212
+ type TextToVideoParams = Kling3TextToVideoSingleShotParams | Kling3TextToVideoMultiShotParams | KlingV26TextToVideoParams | V25TurboTextToVideoParams | V21MasterTextToVideoParams | V3TurboTextToVideoParams | V3OmniTextToVideoParams;
213
+ type ImageToVideoParams = V2ImageToVideoParams | KlingV26ImageToVideoParams | V3TurboImageToVideoParams | V3OmniImageToVideoParams;
214
+ /** Continue a completed Kling V2.5 Turbo video task. */
215
+ interface KlingExtendVideoParams {
216
+ source_task_id: string;
217
+ mode?: 'std' | 'pro';
218
+ prompt?: string;
219
+ callback_url?: string;
220
+ }
161
221
  interface AsyncTaskResponse {
162
222
  id: string;
163
223
  status: AsyncTaskStatus;
@@ -182,7 +242,7 @@ interface ImageToVideoResponse extends AsyncTaskResponse {
182
242
  * AI avatar quality tier. Pro models produce the most natural lip movements;
183
243
  * Standard models are faster with slightly less refined lip sync.
184
244
  */
185
- type AiAvatarModel = 'kling-ai-avatar-pro' | 'kling-ai-avatar-standard' | 'kling-ai-avatar-v1-pro' | 'kling-v1-avatar-standard';
245
+ type AiAvatarModel = (typeof modelValues.avatar)[keyof typeof modelValues.avatar];
186
246
  /** Lip-sync a face image to an audio track, producing a talking-head video. */
187
247
  interface AiAvatarParams {
188
248
  model: AiAvatarModel;
@@ -199,25 +259,33 @@ interface AiAvatarResponse extends AsyncTaskResponse {
199
259
  error?: string;
200
260
  [key: string]: unknown;
201
261
  }
202
- /**
203
- * Transfer motion from a reference video onto a subject image. The subject adopts
204
- * the movement patterns from the reference while preserving its own appearance.
205
- */
206
- interface MotionControlParams {
207
- model: 'kling-3.0';
262
+ type MotionControlModel = (typeof modelValues.motionControl)[keyof typeof modelValues.motionControl];
263
+ interface MotionControlCommonParams {
208
264
  /** Subject image URL whose appearance is preserved. */
209
265
  source_image_url: string;
210
- /** Reference video URL whose motion patterns are transferred. */
266
+ /** Reference video URL whose motion patterns are transferred (Kling 2.6: 3-10 seconds with image orientation or 3-30 seconds with video orientation). */
211
267
  reference_video_url: string;
212
268
  /** Optional description prompt. */
213
269
  prompt?: string;
270
+ callback_url?: string;
271
+ }
272
+ /** Kling 3.0 motion transfer with optional orientation and background controls. */
273
+ interface Kling3MotionControlParams extends MotionControlCommonParams {
274
+ model: (typeof modelValues.motionControl.KLING_3_0);
214
275
  output_resolution?: '720p' | '1080p';
215
276
  /** Whether the character faces the direction from the video or the image. */
216
277
  character_orientation?: 'video' | 'image';
217
278
  /** Whether the background comes from the video or the image. */
218
279
  background_source?: 'video' | 'image';
219
- callback_url?: string;
220
280
  }
281
+ /** Kling 2.6 motion transfer with explicit resolution and character orientation. */
282
+ interface KlingV26MotionControlParams extends MotionControlCommonParams {
283
+ model: (typeof modelValues.motionControl.KLING_V2_6);
284
+ output_resolution: '720p' | '1080p';
285
+ character_orientation: 'video' | 'image';
286
+ background_source?: never;
287
+ }
288
+ type MotionControlParams = Kling3MotionControlParams | KlingV26MotionControlParams;
221
289
  interface MotionControlResponse extends AsyncTaskResponse {
222
290
  videos?: VideoMetadata[];
223
291
  error?: string;
@@ -348,6 +416,14 @@ declare class MotionControl {
348
416
  get(id: string, options?: RequestOptions): Promise<MotionControlResponse>;
349
417
  }
350
418
 
419
+ declare class ExtendVideo {
420
+ private readonly http;
421
+ constructor(http: HttpClient);
422
+ run(params: KlingExtendVideoParams, options?: RequestOptions & PollingOptions): Promise<TextToVideoResponse>;
423
+ create(params: KlingExtendVideoParams, options?: RequestOptions): Promise<TaskCreateResponse>;
424
+ get(id: string, options?: RequestOptions): Promise<TextToVideoResponse>;
425
+ }
426
+
351
427
  /**
352
428
  * Kling video generation, AI avatar lip-sync, and motion control API client.
353
429
  *
@@ -370,7 +446,8 @@ declare class KlingClient extends BaseClient {
370
446
  readonly aiAvatar: AiAvatar;
371
447
  /** Transfer motion from a reference video onto a subject image. */
372
448
  readonly motionControl: MotionControl;
449
+ readonly extendVideo: ExtendVideo;
373
450
  constructor(options?: ClientOptions);
374
451
  }
375
452
 
376
- 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 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 V3TurboImageToVideoParams, type V3TurboTextToVideoParams, type VideoMetadata };
453
+ export { type AiAvatarModel, type AiAvatarParams, type AiAvatarResponse, type AsyncTaskResponse, type CompletedAiAvatarResponse, type CompletedImageToVideoResponse, type CompletedMotionControlResponse, type CompletedTextToVideoResponse, type ImageToVideoParams, type ImageToVideoResponse, type Kling3MotionControlParams, type Kling3TextToVideoMultiShotParams, type Kling3TextToVideoSingleShotParams, type KlingAspectRatio, KlingClient, type KlingDuration, type KlingElement, type KlingExtendVideoParams, type KlingImageToVideoModel, type KlingTextToVideoModel, type KlingTextToVideoOutputResolution, type KlingV26ImageToVideoParams, type KlingV26Mode, type KlingV26MotionControlParams, type KlingV26TextToVideoParams, type KlingV2ImageToVideoModel, type KlingV3TurboOutputResolution, type MotionControlModel, 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,14 +1,44 @@
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
+ readonly motionControl: {
29
+ readonly KLING_3_0: "kling-3.0";
30
+ readonly KLING_V2_6: "kling-v2.6";
31
+ };
32
+ };
33
+
4
34
  /**
5
35
  * Text-to-video model variants. kling-3.0 supports multi-shot, sound, first/last frame images,
6
36
  * and Kling elements. V2.x models support negative prompts and cfg_scale instead.
7
37
  */
8
- type KlingTextToVideoModel = 'kling-3.0' | 'kling-v2.6' | 'kling-v3-turbo-text-to-video' | 'kling-v2.5-turbo-text-to-video-pro' | 'kling-v2.1-master-text-to-video';
38
+ type KlingTextToVideoModel = (typeof modelValues.textToVideo)[keyof typeof modelValues.textToVideo];
9
39
  /** Earlier V2 image-to-video variants. V2.5 turbo and V2.1 pro support last-frame image control. */
10
- 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';
11
- type KlingImageToVideoModel = KlingV2ImageToVideoModel | 'kling-v2.6' | 'kling-v3-turbo-image-to-video';
40
+ 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);
41
+ type KlingImageToVideoModel = (typeof modelValues.imageToVideo)[keyof typeof modelValues.imageToVideo];
12
42
  /** Output resolution for text-to-video. 4k is highest quality but slowest. */
13
43
  type KlingTextToVideoOutputResolution = '720p' | '1080p' | '4k';
14
44
  type KlingV3TurboOutputResolution = '720p' | '1080p';
@@ -39,7 +69,7 @@ interface KlingElement {
39
69
  end_time?: number;
40
70
  }
41
71
  interface Kling3TextToVideoCommonParams {
42
- model: 'kling-3.0';
72
+ model: (typeof modelValues.textToVideo.KLING_3_0);
43
73
  /** Duration in seconds (3-15). */
44
74
  duration_seconds?: KlingDuration;
45
75
  aspect_ratio?: KlingAspectRatio;
@@ -73,7 +103,7 @@ interface Kling3TextToVideoMultiShotParams extends Kling3TextToVideoCommonParams
73
103
  }
74
104
  /** V2.5 Turbo text-to-video: fast, high-quality generation with negative prompt and cfg_scale control. */
75
105
  interface V25TurboTextToVideoParams {
76
- model: 'kling-v2.5-turbo-text-to-video-pro';
106
+ model: (typeof modelValues.textToVideo.KLING_V2_5_TURBO_TEXT_TO_VIDEO_PRO);
77
107
  prompt: string;
78
108
  /** Duration: 5 or 10 seconds. */
79
109
  duration_seconds?: 5 | 10;
@@ -86,7 +116,7 @@ interface V25TurboTextToVideoParams {
86
116
  }
87
117
  /** V2.1 Master text-to-video: highest V2.1 quality with negative prompt and cfg_scale control. */
88
118
  interface V21MasterTextToVideoParams {
89
- model: 'kling-v2.1-master-text-to-video';
119
+ model: (typeof modelValues.textToVideo.KLING_V2_1_MASTER_TEXT_TO_VIDEO);
90
120
  prompt: string;
91
121
  duration_seconds?: 5 | 10;
92
122
  aspect_ratio?: KlingAspectRatio;
@@ -96,7 +126,7 @@ interface V21MasterTextToVideoParams {
96
126
  }
97
127
  /** V3 Turbo text-to-video: prompt-driven 3-15 second clips at 720p or 1080p. */
98
128
  interface V3TurboTextToVideoParams {
99
- model: 'kling-v3-turbo-text-to-video';
129
+ model: (typeof modelValues.textToVideo.KLING_V3_TURBO_TEXT_TO_VIDEO);
100
130
  prompt: string;
101
131
  /** Duration in seconds (3-15). */
102
132
  duration_seconds?: KlingDuration;
@@ -115,6 +145,16 @@ interface KlingV26TextToVideoParams {
115
145
  aspect_ratio?: KlingAspectRatio;
116
146
  callback_url?: string;
117
147
  }
148
+ /** Kling v3 Omni text-to-video with native 4K, synchronized sound, and flexible duration. */
149
+ interface V3OmniTextToVideoParams {
150
+ model: (typeof modelValues.textToVideo.KLING_V3_OMNI);
151
+ prompt: string;
152
+ output_resolution?: KlingTextToVideoOutputResolution;
153
+ duration_seconds?: KlingDuration;
154
+ enable_sound?: boolean;
155
+ aspect_ratio?: KlingAspectRatio;
156
+ callback_url?: string;
157
+ }
118
158
  /**
119
159
  * Earlier V2 image-to-video parameters. A first-frame image is required; the model
120
160
  * animates it into video guided by the text prompt. last_frame_image_url is supported
@@ -135,7 +175,7 @@ interface V2ImageToVideoParams {
135
175
  }
136
176
  /** V3 Turbo image-to-video: animate one first-frame image at 720p or 1080p. */
137
177
  interface V3TurboImageToVideoParams {
138
- model: 'kling-v3-turbo-image-to-video';
178
+ model: (typeof modelValues.imageToVideo.KLING_V3_TURBO_IMAGE_TO_VIDEO);
139
179
  prompt: string;
140
180
  first_frame_image_url: string;
141
181
  duration_seconds?: KlingDuration;
@@ -156,8 +196,28 @@ interface KlingV26ImageToVideoParams {
156
196
  aspect_ratio?: KlingAspectRatio;
157
197
  callback_url?: string;
158
198
  }
159
- type TextToVideoParams = Kling3TextToVideoSingleShotParams | Kling3TextToVideoMultiShotParams | KlingV26TextToVideoParams | V25TurboTextToVideoParams | V21MasterTextToVideoParams | V3TurboTextToVideoParams;
160
- type ImageToVideoParams = V2ImageToVideoParams | KlingV26ImageToVideoParams | V3TurboImageToVideoParams;
199
+ /** Kling v3 Omni image-to-video from caller-owned first and optional final frames. */
200
+ interface V3OmniImageToVideoParams {
201
+ model: (typeof modelValues.imageToVideo.KLING_V3_OMNI);
202
+ prompt: string;
203
+ first_frame_image_url: string;
204
+ /** Final frame image URL; requires duration_seconds 5. */
205
+ last_frame_image_url?: string;
206
+ output_resolution?: KlingTextToVideoOutputResolution;
207
+ duration_seconds?: KlingDuration;
208
+ enable_sound?: boolean;
209
+ aspect_ratio?: KlingAspectRatio;
210
+ callback_url?: string;
211
+ }
212
+ type TextToVideoParams = Kling3TextToVideoSingleShotParams | Kling3TextToVideoMultiShotParams | KlingV26TextToVideoParams | V25TurboTextToVideoParams | V21MasterTextToVideoParams | V3TurboTextToVideoParams | V3OmniTextToVideoParams;
213
+ type ImageToVideoParams = V2ImageToVideoParams | KlingV26ImageToVideoParams | V3TurboImageToVideoParams | V3OmniImageToVideoParams;
214
+ /** Continue a completed Kling V2.5 Turbo video task. */
215
+ interface KlingExtendVideoParams {
216
+ source_task_id: string;
217
+ mode?: 'std' | 'pro';
218
+ prompt?: string;
219
+ callback_url?: string;
220
+ }
161
221
  interface AsyncTaskResponse {
162
222
  id: string;
163
223
  status: AsyncTaskStatus;
@@ -182,7 +242,7 @@ interface ImageToVideoResponse extends AsyncTaskResponse {
182
242
  * AI avatar quality tier. Pro models produce the most natural lip movements;
183
243
  * Standard models are faster with slightly less refined lip sync.
184
244
  */
185
- type AiAvatarModel = 'kling-ai-avatar-pro' | 'kling-ai-avatar-standard' | 'kling-ai-avatar-v1-pro' | 'kling-v1-avatar-standard';
245
+ type AiAvatarModel = (typeof modelValues.avatar)[keyof typeof modelValues.avatar];
186
246
  /** Lip-sync a face image to an audio track, producing a talking-head video. */
187
247
  interface AiAvatarParams {
188
248
  model: AiAvatarModel;
@@ -199,25 +259,33 @@ interface AiAvatarResponse extends AsyncTaskResponse {
199
259
  error?: string;
200
260
  [key: string]: unknown;
201
261
  }
202
- /**
203
- * Transfer motion from a reference video onto a subject image. The subject adopts
204
- * the movement patterns from the reference while preserving its own appearance.
205
- */
206
- interface MotionControlParams {
207
- model: 'kling-3.0';
262
+ type MotionControlModel = (typeof modelValues.motionControl)[keyof typeof modelValues.motionControl];
263
+ interface MotionControlCommonParams {
208
264
  /** Subject image URL whose appearance is preserved. */
209
265
  source_image_url: string;
210
- /** Reference video URL whose motion patterns are transferred. */
266
+ /** Reference video URL whose motion patterns are transferred (Kling 2.6: 3-10 seconds with image orientation or 3-30 seconds with video orientation). */
211
267
  reference_video_url: string;
212
268
  /** Optional description prompt. */
213
269
  prompt?: string;
270
+ callback_url?: string;
271
+ }
272
+ /** Kling 3.0 motion transfer with optional orientation and background controls. */
273
+ interface Kling3MotionControlParams extends MotionControlCommonParams {
274
+ model: (typeof modelValues.motionControl.KLING_3_0);
214
275
  output_resolution?: '720p' | '1080p';
215
276
  /** Whether the character faces the direction from the video or the image. */
216
277
  character_orientation?: 'video' | 'image';
217
278
  /** Whether the background comes from the video or the image. */
218
279
  background_source?: 'video' | 'image';
219
- callback_url?: string;
220
280
  }
281
+ /** Kling 2.6 motion transfer with explicit resolution and character orientation. */
282
+ interface KlingV26MotionControlParams extends MotionControlCommonParams {
283
+ model: (typeof modelValues.motionControl.KLING_V2_6);
284
+ output_resolution: '720p' | '1080p';
285
+ character_orientation: 'video' | 'image';
286
+ background_source?: never;
287
+ }
288
+ type MotionControlParams = Kling3MotionControlParams | KlingV26MotionControlParams;
221
289
  interface MotionControlResponse extends AsyncTaskResponse {
222
290
  videos?: VideoMetadata[];
223
291
  error?: string;
@@ -348,6 +416,14 @@ declare class MotionControl {
348
416
  get(id: string, options?: RequestOptions): Promise<MotionControlResponse>;
349
417
  }
350
418
 
419
+ declare class ExtendVideo {
420
+ private readonly http;
421
+ constructor(http: HttpClient);
422
+ run(params: KlingExtendVideoParams, options?: RequestOptions & PollingOptions): Promise<TextToVideoResponse>;
423
+ create(params: KlingExtendVideoParams, options?: RequestOptions): Promise<TaskCreateResponse>;
424
+ get(id: string, options?: RequestOptions): Promise<TextToVideoResponse>;
425
+ }
426
+
351
427
  /**
352
428
  * Kling video generation, AI avatar lip-sync, and motion control API client.
353
429
  *
@@ -370,7 +446,8 @@ declare class KlingClient extends BaseClient {
370
446
  readonly aiAvatar: AiAvatar;
371
447
  /** Transfer motion from a reference video onto a subject image. */
372
448
  readonly motionControl: MotionControl;
449
+ readonly extendVideo: ExtendVideo;
373
450
  constructor(options?: ClientOptions);
374
451
  }
375
452
 
376
- 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 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 V3TurboImageToVideoParams, type V3TurboTextToVideoParams, type VideoMetadata };
453
+ export { type AiAvatarModel, type AiAvatarParams, type AiAvatarResponse, type AsyncTaskResponse, type CompletedAiAvatarResponse, type CompletedImageToVideoResponse, type CompletedMotionControlResponse, type CompletedTextToVideoResponse, type ImageToVideoParams, type ImageToVideoResponse, type Kling3MotionControlParams, type Kling3TextToVideoMultiShotParams, type Kling3TextToVideoSingleShotParams, type KlingAspectRatio, KlingClient, type KlingDuration, type KlingElement, type KlingExtendVideoParams, type KlingImageToVideoModel, type KlingTextToVideoModel, type KlingTextToVideoOutputResolution, type KlingV26ImageToVideoParams, type KlingV26Mode, type KlingV26MotionControlParams, type KlingV26TextToVideoParams, type KlingV2ImageToVideoModel, type KlingV3TurboOutputResolution, type MotionControlModel, 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 };