@runapi.ai/kling 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -29,8 +29,6 @@ declare const modelValues: {
29
29
  readonly avatar: {
30
30
  readonly KLING_AI_AVATAR_PRO: "kling-ai-avatar-pro";
31
31
  readonly KLING_AI_AVATAR_STANDARD: "kling-ai-avatar-standard";
32
- readonly KLING_AI_AVATAR_V1_PRO: "kling-ai-avatar-v1-pro";
33
- readonly KLING_V1_AVATAR_STANDARD: "kling-v1-avatar-standard";
34
32
  };
35
33
  readonly motionControl: {
36
34
  readonly KLING_3_0: "kling-3.0";
@@ -56,7 +54,7 @@ type KlingAspectRatio = '16:9' | '9:16' | '1:1';
56
54
  type KlingDuration = number;
57
55
  type KlingV26Mode = 'std' | 'pro';
58
56
  type KlingO1ReferenceVideoType = 'base' | 'feature';
59
- /** A single shot in a multi-shot text-to-video sequence. */
57
+ /** A custom shot: 1-12 seconds; all shots sum to the total video duration. */
60
58
  interface MultiPromptItem {
61
59
  prompt: string;
62
60
  duration_seconds: number;
@@ -78,9 +76,20 @@ interface KlingElement {
78
76
  /** End time in milliseconds for video element capture; must be 3000-8000 ms after start_time. */
79
77
  end_time?: number;
80
78
  }
79
+ interface KlingO1ReferenceParams {
80
+ /** Ordered public HTTP(S) image references; use matching `<<<image_N>>>` markers in prompt. */
81
+ reference_image_urls?: string[];
82
+ /** Public HTTP(S) MP4 or MOV reference video; use `<<<video_1>>>` in prompt. */
83
+ reference_video_url?: string;
84
+ /** Base edit or feature reference; defaults to base. */
85
+ reference_video_type?: KlingO1ReferenceVideoType;
86
+ /** Preserve audio from the reference video. */
87
+ preserve_reference_video_audio?: boolean;
88
+ }
89
+
81
90
  interface Kling3TextToVideoCommonParams {
82
91
  model: (typeof modelValues.textToVideo.KLING_3_0);
83
- /** Duration in seconds (3-15). */
92
+ /** Duration in seconds (3-15), default 5. */
84
93
  duration_seconds?: KlingDuration;
85
94
  aspect_ratio?: KlingAspectRatio;
86
95
  output_resolution?: KlingTextToVideoOutputResolution;
@@ -100,17 +109,28 @@ interface Kling3TextToVideoSingleShotParams extends Kling3TextToVideoCommonParam
100
109
  /** Closing frame image URL; only available in single-shot mode. */
101
110
  last_frame_image_url?: string;
102
111
  }
103
- /** Kling 3.0 multi-shot mode: stitch multiple prompted segments into one video with sound. */
112
+ /** Kling 3.0 custom multi-shot mode with optional sound. */
104
113
  interface Kling3TextToVideoMultiShotParams extends Kling3TextToVideoCommonParams {
105
114
  /** Must be true to activate multi-shot generation. */
106
115
  multi_shots: true;
107
- /** Must be true; sound is always generated in multi-shot mode. */
108
- enable_sound: true;
109
- /** Ordered shot segments, each with its own prompt and duration. */
116
+ /** Generate synchronized audio for the video. */
117
+ enable_sound?: boolean;
118
+ /** Custom storyboard; defaults to custom only when multi_shots is true. */
119
+ shot_type?: 'custom';
120
+ /** 1-6 ordered shots. Each prompt allows 500 effective characters; each @element reference counts as 37. */
110
121
  multi_prompt: MultiPromptItem[];
111
122
  /** Opening frame image URL for the first shot. */
112
123
  first_frame_image_url?: string;
113
124
  }
125
+ /** Kling 3.0 automatic storyboard from one prompt with optional sound. */
126
+ interface Kling3TextToVideoAutomaticShotParams extends Kling3TextToVideoCommonParams {
127
+ multi_shots: true;
128
+ shot_type: 'automatic';
129
+ prompt: string;
130
+ enable_sound?: boolean;
131
+ multi_prompt?: never;
132
+ first_frame_image_url?: string;
133
+ }
114
134
  /** V2.5 Turbo text-to-video: fast, high-quality generation with negative prompt and cfg_scale control. */
115
135
  interface V25TurboTextToVideoParams {
116
136
  model: (typeof modelValues.textToVideo.KLING_V2_5_TURBO_TEXT_TO_VIDEO_PRO);
@@ -155,16 +175,6 @@ interface KlingV26TextToVideoParams {
155
175
  aspect_ratio?: KlingAspectRatio;
156
176
  callback_url?: string;
157
177
  }
158
- interface KlingO1ReferenceParams {
159
- /** Ordered public HTTP(S) image references; use matching `<<<image_N>>>` markers in prompt. */
160
- reference_image_urls?: string[];
161
- /** Public HTTP(S) MP4 or MOV reference video; use `<<<video_1>>>` in prompt. */
162
- reference_video_url?: string;
163
- /** Base edit or feature reference; defaults to base. */
164
- reference_video_type?: KlingO1ReferenceVideoType;
165
- /** Preserve audio from the reference video. */
166
- preserve_reference_video_audio?: boolean;
167
- }
168
178
  /** Kling O1 text-to-video with image and video references. */
169
179
  interface KlingO1TextToVideoParams extends KlingO1ReferenceParams {
170
180
  model: (typeof modelValues.textToVideo.KLING_O1);
@@ -196,6 +206,8 @@ interface V3OmniReferenceTextToVideoParams {
196
206
  enable_sound?: boolean;
197
207
  callback_url?: string;
198
208
  }
209
+ type TextToVideoParams = Kling3TextToVideoSingleShotParams | Kling3TextToVideoMultiShotParams | Kling3TextToVideoAutomaticShotParams | KlingV26TextToVideoParams | KlingO1TextToVideoParams | V25TurboTextToVideoParams | V21MasterTextToVideoParams | V3TurboTextToVideoParams | V3OmniTextToVideoParams | V3OmniReferenceTextToVideoParams;
210
+
199
211
  /**
200
212
  * Earlier V2 image-to-video parameters. A first-frame image is required; the model
201
213
  * animates it into video guided by the text prompt. last_frame_image_url is supported
@@ -263,8 +275,8 @@ interface V3OmniImageToVideoParams {
263
275
  aspect_ratio?: KlingAspectRatio;
264
276
  callback_url?: string;
265
277
  }
266
- type TextToVideoParams = Kling3TextToVideoSingleShotParams | Kling3TextToVideoMultiShotParams | KlingV26TextToVideoParams | KlingO1TextToVideoParams | V25TurboTextToVideoParams | V21MasterTextToVideoParams | V3TurboTextToVideoParams | V3OmniTextToVideoParams | V3OmniReferenceTextToVideoParams;
267
278
  type ImageToVideoParams = V2ImageToVideoParams | KlingV26ImageToVideoParams | KlingO1ImageToVideoParams | V3TurboImageToVideoParams | V3OmniImageToVideoParams;
279
+
268
280
  /** Continue a completed Kling V2.5 Turbo video task. */
269
281
  interface KlingExtendVideoParams {
270
282
  source_task_id: string;
@@ -345,21 +357,18 @@ interface MotionControlCommonParams {
345
357
  prompt?: string;
346
358
  callback_url?: string;
347
359
  }
348
- /** Kling 3.0 motion transfer with explicit resolution and optional orientation and background controls. */
360
+ /** Kling 3.0 motion transfer with explicit resolution and optional character orientation. */
349
361
  interface Kling3MotionControlParams extends MotionControlCommonParams {
350
362
  model: (typeof modelValues.motionControl.KLING_3_0);
351
363
  output_resolution: '720p' | '1080p';
352
364
  /** Whether the character faces the direction from the video or the image. */
353
365
  character_orientation?: 'video' | 'image';
354
- /** Whether the background comes from the video or the image. */
355
- background_source?: 'video' | 'image';
356
366
  }
357
367
  /** Kling 2.6 motion transfer with explicit resolution and character orientation. */
358
368
  interface KlingV26MotionControlParams extends MotionControlCommonParams {
359
369
  model: (typeof modelValues.motionControl.KLING_V2_6);
360
370
  output_resolution: '720p' | '1080p';
361
371
  character_orientation: 'video' | 'image';
362
- background_source?: never;
363
372
  }
364
373
  type MotionControlParams = Kling3MotionControlParams | KlingV26MotionControlParams;
365
374
  interface MotionControlResponse extends AsyncTaskResponse {
@@ -536,4 +545,4 @@ declare class KlingClient extends BaseClient {
536
545
  constructor(options?: ClientOptions);
537
546
  }
538
547
 
539
- export { type AiAvatarModel, type AiAvatarParams, type AiAvatarResponse, type AsyncTaskResponse, type CompletedAiAvatarResponse, type CompletedImageToVideoResponse, type CompletedMotionControlResponse, type CompletedTextToVideoResponse, type EditVideoParams, type ImageToVideoParams, type ImageToVideoResponse, type Kling3MotionControlParams, type Kling3TextToVideoMultiShotParams, type Kling3TextToVideoSingleShotParams, type KlingAspectRatio, KlingClient, type KlingDuration, type KlingEditVideoModel, type KlingElement, type KlingExtendVideoParams, type KlingImageToVideoModel, type KlingO1ImageToVideoParams, type KlingO1ReferenceVideoType, type KlingO1TextToVideoParams, 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 V3OmniReferenceTextToVideoParams, type V3OmniTextToVideoParams, type V3TurboImageToVideoParams, type V3TurboTextToVideoParams, type VideoMetadata };
548
+ export { type AiAvatarModel, type AiAvatarParams, type AiAvatarResponse, type AsyncTaskResponse, type CompletedAiAvatarResponse, type CompletedImageToVideoResponse, type CompletedMotionControlResponse, type CompletedTextToVideoResponse, type EditVideoParams, type ImageToVideoParams, type ImageToVideoResponse, type Kling3MotionControlParams, type Kling3TextToVideoAutomaticShotParams, type Kling3TextToVideoMultiShotParams, type Kling3TextToVideoSingleShotParams, type KlingAspectRatio, KlingClient, type KlingDuration, type KlingEditVideoModel, type KlingElement, type KlingExtendVideoParams, type KlingImageToVideoModel, type KlingO1ImageToVideoParams, type KlingO1ReferenceVideoType, type KlingO1TextToVideoParams, 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 V3OmniReferenceTextToVideoParams, type V3OmniTextToVideoParams, type V3TurboImageToVideoParams, type V3TurboTextToVideoParams, type VideoMetadata };
package/dist/index.d.ts CHANGED
@@ -29,8 +29,6 @@ declare const modelValues: {
29
29
  readonly avatar: {
30
30
  readonly KLING_AI_AVATAR_PRO: "kling-ai-avatar-pro";
31
31
  readonly KLING_AI_AVATAR_STANDARD: "kling-ai-avatar-standard";
32
- readonly KLING_AI_AVATAR_V1_PRO: "kling-ai-avatar-v1-pro";
33
- readonly KLING_V1_AVATAR_STANDARD: "kling-v1-avatar-standard";
34
32
  };
35
33
  readonly motionControl: {
36
34
  readonly KLING_3_0: "kling-3.0";
@@ -56,7 +54,7 @@ type KlingAspectRatio = '16:9' | '9:16' | '1:1';
56
54
  type KlingDuration = number;
57
55
  type KlingV26Mode = 'std' | 'pro';
58
56
  type KlingO1ReferenceVideoType = 'base' | 'feature';
59
- /** A single shot in a multi-shot text-to-video sequence. */
57
+ /** A custom shot: 1-12 seconds; all shots sum to the total video duration. */
60
58
  interface MultiPromptItem {
61
59
  prompt: string;
62
60
  duration_seconds: number;
@@ -78,9 +76,20 @@ interface KlingElement {
78
76
  /** End time in milliseconds for video element capture; must be 3000-8000 ms after start_time. */
79
77
  end_time?: number;
80
78
  }
79
+ interface KlingO1ReferenceParams {
80
+ /** Ordered public HTTP(S) image references; use matching `<<<image_N>>>` markers in prompt. */
81
+ reference_image_urls?: string[];
82
+ /** Public HTTP(S) MP4 or MOV reference video; use `<<<video_1>>>` in prompt. */
83
+ reference_video_url?: string;
84
+ /** Base edit or feature reference; defaults to base. */
85
+ reference_video_type?: KlingO1ReferenceVideoType;
86
+ /** Preserve audio from the reference video. */
87
+ preserve_reference_video_audio?: boolean;
88
+ }
89
+
81
90
  interface Kling3TextToVideoCommonParams {
82
91
  model: (typeof modelValues.textToVideo.KLING_3_0);
83
- /** Duration in seconds (3-15). */
92
+ /** Duration in seconds (3-15), default 5. */
84
93
  duration_seconds?: KlingDuration;
85
94
  aspect_ratio?: KlingAspectRatio;
86
95
  output_resolution?: KlingTextToVideoOutputResolution;
@@ -100,17 +109,28 @@ interface Kling3TextToVideoSingleShotParams extends Kling3TextToVideoCommonParam
100
109
  /** Closing frame image URL; only available in single-shot mode. */
101
110
  last_frame_image_url?: string;
102
111
  }
103
- /** Kling 3.0 multi-shot mode: stitch multiple prompted segments into one video with sound. */
112
+ /** Kling 3.0 custom multi-shot mode with optional sound. */
104
113
  interface Kling3TextToVideoMultiShotParams extends Kling3TextToVideoCommonParams {
105
114
  /** Must be true to activate multi-shot generation. */
106
115
  multi_shots: true;
107
- /** Must be true; sound is always generated in multi-shot mode. */
108
- enable_sound: true;
109
- /** Ordered shot segments, each with its own prompt and duration. */
116
+ /** Generate synchronized audio for the video. */
117
+ enable_sound?: boolean;
118
+ /** Custom storyboard; defaults to custom only when multi_shots is true. */
119
+ shot_type?: 'custom';
120
+ /** 1-6 ordered shots. Each prompt allows 500 effective characters; each @element reference counts as 37. */
110
121
  multi_prompt: MultiPromptItem[];
111
122
  /** Opening frame image URL for the first shot. */
112
123
  first_frame_image_url?: string;
113
124
  }
125
+ /** Kling 3.0 automatic storyboard from one prompt with optional sound. */
126
+ interface Kling3TextToVideoAutomaticShotParams extends Kling3TextToVideoCommonParams {
127
+ multi_shots: true;
128
+ shot_type: 'automatic';
129
+ prompt: string;
130
+ enable_sound?: boolean;
131
+ multi_prompt?: never;
132
+ first_frame_image_url?: string;
133
+ }
114
134
  /** V2.5 Turbo text-to-video: fast, high-quality generation with negative prompt and cfg_scale control. */
115
135
  interface V25TurboTextToVideoParams {
116
136
  model: (typeof modelValues.textToVideo.KLING_V2_5_TURBO_TEXT_TO_VIDEO_PRO);
@@ -155,16 +175,6 @@ interface KlingV26TextToVideoParams {
155
175
  aspect_ratio?: KlingAspectRatio;
156
176
  callback_url?: string;
157
177
  }
158
- interface KlingO1ReferenceParams {
159
- /** Ordered public HTTP(S) image references; use matching `<<<image_N>>>` markers in prompt. */
160
- reference_image_urls?: string[];
161
- /** Public HTTP(S) MP4 or MOV reference video; use `<<<video_1>>>` in prompt. */
162
- reference_video_url?: string;
163
- /** Base edit or feature reference; defaults to base. */
164
- reference_video_type?: KlingO1ReferenceVideoType;
165
- /** Preserve audio from the reference video. */
166
- preserve_reference_video_audio?: boolean;
167
- }
168
178
  /** Kling O1 text-to-video with image and video references. */
169
179
  interface KlingO1TextToVideoParams extends KlingO1ReferenceParams {
170
180
  model: (typeof modelValues.textToVideo.KLING_O1);
@@ -196,6 +206,8 @@ interface V3OmniReferenceTextToVideoParams {
196
206
  enable_sound?: boolean;
197
207
  callback_url?: string;
198
208
  }
209
+ type TextToVideoParams = Kling3TextToVideoSingleShotParams | Kling3TextToVideoMultiShotParams | Kling3TextToVideoAutomaticShotParams | KlingV26TextToVideoParams | KlingO1TextToVideoParams | V25TurboTextToVideoParams | V21MasterTextToVideoParams | V3TurboTextToVideoParams | V3OmniTextToVideoParams | V3OmniReferenceTextToVideoParams;
210
+
199
211
  /**
200
212
  * Earlier V2 image-to-video parameters. A first-frame image is required; the model
201
213
  * animates it into video guided by the text prompt. last_frame_image_url is supported
@@ -263,8 +275,8 @@ interface V3OmniImageToVideoParams {
263
275
  aspect_ratio?: KlingAspectRatio;
264
276
  callback_url?: string;
265
277
  }
266
- type TextToVideoParams = Kling3TextToVideoSingleShotParams | Kling3TextToVideoMultiShotParams | KlingV26TextToVideoParams | KlingO1TextToVideoParams | V25TurboTextToVideoParams | V21MasterTextToVideoParams | V3TurboTextToVideoParams | V3OmniTextToVideoParams | V3OmniReferenceTextToVideoParams;
267
278
  type ImageToVideoParams = V2ImageToVideoParams | KlingV26ImageToVideoParams | KlingO1ImageToVideoParams | V3TurboImageToVideoParams | V3OmniImageToVideoParams;
279
+
268
280
  /** Continue a completed Kling V2.5 Turbo video task. */
269
281
  interface KlingExtendVideoParams {
270
282
  source_task_id: string;
@@ -345,21 +357,18 @@ interface MotionControlCommonParams {
345
357
  prompt?: string;
346
358
  callback_url?: string;
347
359
  }
348
- /** Kling 3.0 motion transfer with explicit resolution and optional orientation and background controls. */
360
+ /** Kling 3.0 motion transfer with explicit resolution and optional character orientation. */
349
361
  interface Kling3MotionControlParams extends MotionControlCommonParams {
350
362
  model: (typeof modelValues.motionControl.KLING_3_0);
351
363
  output_resolution: '720p' | '1080p';
352
364
  /** Whether the character faces the direction from the video or the image. */
353
365
  character_orientation?: 'video' | 'image';
354
- /** Whether the background comes from the video or the image. */
355
- background_source?: 'video' | 'image';
356
366
  }
357
367
  /** Kling 2.6 motion transfer with explicit resolution and character orientation. */
358
368
  interface KlingV26MotionControlParams extends MotionControlCommonParams {
359
369
  model: (typeof modelValues.motionControl.KLING_V2_6);
360
370
  output_resolution: '720p' | '1080p';
361
371
  character_orientation: 'video' | 'image';
362
- background_source?: never;
363
372
  }
364
373
  type MotionControlParams = Kling3MotionControlParams | KlingV26MotionControlParams;
365
374
  interface MotionControlResponse extends AsyncTaskResponse {
@@ -536,4 +545,4 @@ declare class KlingClient extends BaseClient {
536
545
  constructor(options?: ClientOptions);
537
546
  }
538
547
 
539
- export { type AiAvatarModel, type AiAvatarParams, type AiAvatarResponse, type AsyncTaskResponse, type CompletedAiAvatarResponse, type CompletedImageToVideoResponse, type CompletedMotionControlResponse, type CompletedTextToVideoResponse, type EditVideoParams, type ImageToVideoParams, type ImageToVideoResponse, type Kling3MotionControlParams, type Kling3TextToVideoMultiShotParams, type Kling3TextToVideoSingleShotParams, type KlingAspectRatio, KlingClient, type KlingDuration, type KlingEditVideoModel, type KlingElement, type KlingExtendVideoParams, type KlingImageToVideoModel, type KlingO1ImageToVideoParams, type KlingO1ReferenceVideoType, type KlingO1TextToVideoParams, 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 V3OmniReferenceTextToVideoParams, type V3OmniTextToVideoParams, type V3TurboImageToVideoParams, type V3TurboTextToVideoParams, type VideoMetadata };
548
+ export { type AiAvatarModel, type AiAvatarParams, type AiAvatarResponse, type AsyncTaskResponse, type CompletedAiAvatarResponse, type CompletedImageToVideoResponse, type CompletedMotionControlResponse, type CompletedTextToVideoResponse, type EditVideoParams, type ImageToVideoParams, type ImageToVideoResponse, type Kling3MotionControlParams, type Kling3TextToVideoAutomaticShotParams, type Kling3TextToVideoMultiShotParams, type Kling3TextToVideoSingleShotParams, type KlingAspectRatio, KlingClient, type KlingDuration, type KlingEditVideoModel, type KlingElement, type KlingExtendVideoParams, type KlingImageToVideoModel, type KlingO1ImageToVideoParams, type KlingO1ReferenceVideoType, type KlingO1TextToVideoParams, 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 V3OmniReferenceTextToVideoParams, type V3OmniTextToVideoParams, type V3TurboImageToVideoParams, type V3TurboTextToVideoParams, type VideoMetadata };