@runapi.ai/kling 0.2.12 → 0.3.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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  The Kling JavaScript SDK is the language-specific package for Kling on RunAPI. Use this package for video generation, animation, and video editing workflows when your application needs request bodies, task status lookup, and consistent RunAPI errors in JavaScript.
4
4
 
5
- This README is the JavaScript package guide inside the public `kling-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/kling; for API reference, use https://runapi.ai/docs#kling; for SDK docs, use https://runapi.ai/docs#sdk-kling.
5
+ This README is the JavaScript package guide inside the public `kling-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/kling; for API reference, use https://runapi.ai/docs/api/kling/text-to-video; for SDK docs, use https://runapi.ai/docs/resources/sdks.
6
6
 
7
7
  ## Install
8
8
 
@@ -17,24 +17,45 @@ import { KlingClient } from '@runapi.ai/kling';
17
17
 
18
18
  const client = new KlingClient();
19
19
  const task = await client.textToVideo.create({
20
- // Pass the Kling JSON request body from https://runapi.ai/docs#kling.
20
+ // Pass the Kling JSON request body from https://runapi.ai/docs/api/kling/text-to-video.
21
21
  });
22
22
  const status = await client.textToVideo.get(task.id);
23
23
  ```
24
24
 
25
+ ## Kling O1 reference media
26
+
27
+ ```typescript
28
+ const result = await client.textToVideo.run({
29
+ model: 'kling-o1',
30
+ prompt: 'Keep <<<image_1>>> beside the performer from <<<video_1>>>',
31
+ reference_image_urls: ['https://cdn.runapi.ai/public/samples/portrait.jpg'],
32
+ reference_video_url: 'https://cdn.runapi.ai/public/samples/video.mp4',
33
+ reference_video_type: 'feature',
34
+ preserve_reference_video_audio: true,
35
+ mode: 'pro',
36
+ duration_seconds: 5,
37
+ });
38
+ ```
39
+
40
+ Number reference images in prompt order as `<<<image_1>>>`, `<<<image_2>>>`, and so on; the optional video is `<<<video_1>>>`. With a video, send at most four images. Do not combine `last_frame_image_url` with reference images or a reference video. A `feature` reference video may be used with the required first frame; `base` cannot be combined with frame inputs. O1 requests are five seconds and keep sound disabled. Pricing and limits: https://runapi.ai/models/kling/o1.
41
+
42
+ ## Kling V3 Omni source-video editing
43
+
44
+ Use `kling-v3-omni-reference` with `textToVideo` for image-only reference inputs. For a source video, use `editVideo` with either `kling-v3-omni-reference` or `kling-v3-omni-edit`. The reference model keeps sound disabled for source-video requests.
45
+
25
46
  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.
26
47
 
27
48
  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.
28
49
 
29
50
  ## Language notes
30
51
 
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`, `imageToVideo`, `aiAvatar`, and `motionControl`. Keep `RUNAPI_API_KEY` in the environment or your secret manager; never commit API keys or callback secrets.
52
+ Use the TypeScript types in `src/types.ts` and the resource classes under `src/resources` when building video applications. The available resources are `textToVideo`, `editVideo`, `imageToVideo`, `aiAvatar`, and `motionControl`. Keep `RUNAPI_API_KEY` in the environment or your secret manager; never commit API keys or callback secrets.
32
53
 
33
54
  ## Links
34
55
 
35
56
  - Model page: https://runapi.ai/models/kling
36
- - SDK docs: https://runapi.ai/docs#sdk-kling
37
- - Product docs: https://runapi.ai/docs#kling
57
+ - SDK docs: https://runapi.ai/docs/resources/sdks
58
+ - Product docs: https://runapi.ai/docs/api/kling/text-to-video
38
59
  - Pricing and rate limits: https://runapi.ai/models/kling/3.0
39
60
  - Provider comparison: https://runapi.ai/providers/kuaishou
40
61
  - Full catalog: https://runapi.ai/models
package/dist/index.d.mts CHANGED
@@ -1,16 +1,19 @@
1
- import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, BaseClient, ClientOptions } from '@runapi.ai/core';
1
+ import { TaskResponse, AsyncTaskStatus, TaskBillingResponse, HttpClient, RequestOptions, PollingOptions, BaseClient, ClientOptions } from '@runapi.ai/core';
2
2
  export { AuthenticationError, InsufficientCreditsError, NetworkError, NotFoundError, RateLimitError, RunApiError, ServiceUnavailableError, TaskFailedError, TaskTimeoutError, TimeoutError, ValidationError } from '@runapi.ai/core';
3
3
 
4
4
  declare const modelValues: {
5
5
  readonly textToVideo: {
6
6
  readonly KLING_3_0: "kling-3.0";
7
+ readonly KLING_O1: "kling-o1";
7
8
  readonly KLING_V2_1_MASTER_TEXT_TO_VIDEO: "kling-v2.1-master-text-to-video";
8
9
  readonly KLING_V2_5_TURBO_TEXT_TO_VIDEO_PRO: "kling-v2.5-turbo-text-to-video-pro";
9
10
  readonly KLING_V2_6: "kling-v2.6";
10
11
  readonly KLING_V3_OMNI: "kling-v3-omni";
12
+ readonly KLING_V3_OMNI_REFERENCE: "kling-v3-omni-reference";
11
13
  readonly KLING_V3_TURBO_TEXT_TO_VIDEO: "kling-v3-turbo-text-to-video";
12
14
  };
13
15
  readonly imageToVideo: {
16
+ readonly KLING_O1: "kling-o1";
14
17
  readonly KLING_V2_1_MASTER_IMAGE_TO_VIDEO: "kling-v2.1-master-image-to-video";
15
18
  readonly KLING_V2_1_PRO: "kling-v2.1-pro";
16
19
  readonly KLING_V2_1_STANDARD: "kling-v2.1-standard";
@@ -19,6 +22,10 @@ declare const modelValues: {
19
22
  readonly KLING_V3_OMNI: "kling-v3-omni";
20
23
  readonly KLING_V3_TURBO_IMAGE_TO_VIDEO: "kling-v3-turbo-image-to-video";
21
24
  };
25
+ readonly editVideo: {
26
+ readonly KLING_V3_OMNI_EDIT: "kling-v3-omni-edit";
27
+ readonly KLING_V3_OMNI_REFERENCE: "kling-v3-omni-reference";
28
+ };
22
29
  readonly avatar: {
23
30
  readonly KLING_AI_AVATAR_PRO: "kling-ai-avatar-pro";
24
31
  readonly KLING_AI_AVATAR_STANDARD: "kling-ai-avatar-standard";
@@ -39,6 +46,8 @@ type KlingTextToVideoModel = (typeof modelValues.textToVideo)[keyof typeof model
39
46
  /** Earlier V2 image-to-video variants. V2.5 turbo and V2.1 pro support last-frame image control. */
40
47
  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
48
  type KlingImageToVideoModel = (typeof modelValues.imageToVideo)[keyof typeof modelValues.imageToVideo];
49
+ /** Model variants for source-video editing. */
50
+ type KlingEditVideoModel = (typeof modelValues.editVideo)[keyof typeof modelValues.editVideo];
42
51
  /** Output resolution for text-to-video. 4k is highest quality but slowest. */
43
52
  type KlingTextToVideoOutputResolution = '720p' | '1080p' | '4k';
44
53
  type KlingV3TurboOutputResolution = '720p' | '1080p';
@@ -46,6 +55,7 @@ type KlingAspectRatio = '16:9' | '9:16' | '1:1';
46
55
  /** Duration in seconds. Range varies by model: 3-15 for kling-3.0, 5 or 10 for V2.x. */
47
56
  type KlingDuration = number;
48
57
  type KlingV26Mode = 'std' | 'pro';
58
+ type KlingO1ReferenceVideoType = 'base' | 'feature';
49
59
  /** A single shot in a multi-shot text-to-video sequence. */
50
60
  interface MultiPromptItem {
51
61
  prompt: string;
@@ -145,6 +155,26 @@ interface KlingV26TextToVideoParams {
145
155
  aspect_ratio?: KlingAspectRatio;
146
156
  callback_url?: string;
147
157
  }
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
+ /** Kling O1 text-to-video with image and video references. */
169
+ interface KlingO1TextToVideoParams extends KlingO1ReferenceParams {
170
+ model: (typeof modelValues.textToVideo.KLING_O1);
171
+ prompt: string;
172
+ mode?: KlingV26Mode;
173
+ duration_seconds?: 5;
174
+ enable_sound?: false;
175
+ aspect_ratio?: KlingAspectRatio;
176
+ callback_url?: string;
177
+ }
148
178
  /** Kling v3 Omni text-to-video with native 4K, synchronized sound, and flexible duration. */
149
179
  interface V3OmniTextToVideoParams {
150
180
  model: (typeof modelValues.textToVideo.KLING_V3_OMNI);
@@ -155,6 +185,17 @@ interface V3OmniTextToVideoParams {
155
185
  aspect_ratio?: KlingAspectRatio;
156
186
  callback_url?: string;
157
187
  }
188
+ /** Kling v3 Omni reference generation from one to seven reference images. */
189
+ interface V3OmniReferenceTextToVideoParams {
190
+ model: (typeof modelValues.textToVideo.KLING_V3_OMNI_REFERENCE);
191
+ prompt: string;
192
+ reference_image_urls: string[];
193
+ duration_seconds?: KlingDuration;
194
+ output_resolution?: KlingTextToVideoOutputResolution;
195
+ aspect_ratio: KlingAspectRatio;
196
+ enable_sound?: boolean;
197
+ callback_url?: string;
198
+ }
158
199
  /**
159
200
  * Earlier V2 image-to-video parameters. A first-frame image is required; the model
160
201
  * animates it into video guided by the text prompt. last_frame_image_url is supported
@@ -196,6 +237,19 @@ interface KlingV26ImageToVideoParams {
196
237
  aspect_ratio?: KlingAspectRatio;
197
238
  callback_url?: string;
198
239
  }
240
+ /** Kling O1 image-to-video with a first frame plus either a final frame or reference media. */
241
+ interface KlingO1ImageToVideoParams extends KlingO1ReferenceParams {
242
+ model: (typeof modelValues.imageToVideo.KLING_O1);
243
+ prompt: string;
244
+ first_frame_image_url: string;
245
+ /** Final frame URL; cannot be combined with reference_image_urls or reference_video_url. */
246
+ last_frame_image_url?: string;
247
+ mode?: KlingV26Mode;
248
+ duration_seconds?: 5;
249
+ enable_sound?: false;
250
+ aspect_ratio?: KlingAspectRatio;
251
+ callback_url?: string;
252
+ }
199
253
  /** Kling v3 Omni image-to-video from caller-owned first and optional final frames. */
200
254
  interface V3OmniImageToVideoParams {
201
255
  model: (typeof modelValues.imageToVideo.KLING_V3_OMNI);
@@ -209,8 +263,8 @@ interface V3OmniImageToVideoParams {
209
263
  aspect_ratio?: KlingAspectRatio;
210
264
  callback_url?: string;
211
265
  }
212
- type TextToVideoParams = Kling3TextToVideoSingleShotParams | Kling3TextToVideoMultiShotParams | KlingV26TextToVideoParams | V25TurboTextToVideoParams | V21MasterTextToVideoParams | V3TurboTextToVideoParams | V3OmniTextToVideoParams;
213
- type ImageToVideoParams = V2ImageToVideoParams | KlingV26ImageToVideoParams | V3TurboImageToVideoParams | V3OmniImageToVideoParams;
266
+ type TextToVideoParams = Kling3TextToVideoSingleShotParams | Kling3TextToVideoMultiShotParams | KlingV26TextToVideoParams | KlingO1TextToVideoParams | V25TurboTextToVideoParams | V21MasterTextToVideoParams | V3TurboTextToVideoParams | V3OmniTextToVideoParams | V3OmniReferenceTextToVideoParams;
267
+ type ImageToVideoParams = V2ImageToVideoParams | KlingV26ImageToVideoParams | KlingO1ImageToVideoParams | V3TurboImageToVideoParams | V3OmniImageToVideoParams;
214
268
  /** Continue a completed Kling V2.5 Turbo video task. */
215
269
  interface KlingExtendVideoParams {
216
270
  source_task_id: string;
@@ -218,11 +272,33 @@ interface KlingExtendVideoParams {
218
272
  prompt?: string;
219
273
  callback_url?: string;
220
274
  }
221
- interface AsyncTaskResponse {
275
+ /** Parameters for Kling v3 Omni source-video editing. */
276
+ interface EditVideoParams {
277
+ model: KlingEditVideoModel;
278
+ /** Video description prompt. */
279
+ prompt: string;
280
+ /** Caller-owned source video URL. Mutually exclusive with source_task_id. */
281
+ source_video_url?: string;
282
+ /** Completed compatible RunAPI task ID. Mutually exclusive with source_video_url. */
283
+ source_task_id?: string;
284
+ /** Ordered reference image URLs. */
285
+ reference_image_urls?: string[];
286
+ /** Output duration in seconds. Source-only requests use five seconds. */
287
+ duration_seconds?: KlingDuration;
288
+ /** Output resolution. */
289
+ output_resolution?: KlingTextToVideoOutputResolution;
290
+ /** Output aspect ratio. Source-only requests use auto. */
291
+ aspect_ratio?: KlingAspectRatio | 'auto';
292
+ /** Enable synchronized sound generation. */
293
+ enable_sound?: boolean;
294
+ /** URL for completion callback notifications. */
295
+ callback_url?: string;
296
+ }
297
+ interface AsyncTaskResponse extends TaskResponse {
222
298
  id: string;
223
299
  status: AsyncTaskStatus;
224
300
  }
225
- interface TaskCreateResponse {
301
+ interface TaskCreateResponse extends TaskBillingResponse {
226
302
  id: string;
227
303
  }
228
304
  interface VideoMetadata {
@@ -424,6 +500,14 @@ declare class ExtendVideo {
424
500
  get(id: string, options?: RequestOptions): Promise<TextToVideoResponse>;
425
501
  }
426
502
 
503
+ declare class EditVideo {
504
+ private readonly http;
505
+ constructor(http: HttpClient);
506
+ run(params: EditVideoParams, options?: RequestOptions & PollingOptions): Promise<TextToVideoResponse>;
507
+ create(params: EditVideoParams, options?: RequestOptions): Promise<TaskCreateResponse>;
508
+ get(id: string, options?: RequestOptions): Promise<TextToVideoResponse>;
509
+ }
510
+
427
511
  /**
428
512
  * Kling video generation, AI avatar lip-sync, and motion control API client.
429
513
  *
@@ -447,7 +531,9 @@ declare class KlingClient extends BaseClient {
447
531
  /** Transfer motion from a reference video onto a subject image. */
448
532
  readonly motionControl: MotionControl;
449
533
  readonly extendVideo: ExtendVideo;
534
+ /** Edit a source video with the selected Kling v3 Omni model. */
535
+ readonly editVideo: EditVideo;
450
536
  constructor(options?: ClientOptions);
451
537
  }
452
538
 
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 };
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 };
package/dist/index.d.ts CHANGED
@@ -1,16 +1,19 @@
1
- import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, BaseClient, ClientOptions } from '@runapi.ai/core';
1
+ import { TaskResponse, AsyncTaskStatus, TaskBillingResponse, HttpClient, RequestOptions, PollingOptions, BaseClient, ClientOptions } from '@runapi.ai/core';
2
2
  export { AuthenticationError, InsufficientCreditsError, NetworkError, NotFoundError, RateLimitError, RunApiError, ServiceUnavailableError, TaskFailedError, TaskTimeoutError, TimeoutError, ValidationError } from '@runapi.ai/core';
3
3
 
4
4
  declare const modelValues: {
5
5
  readonly textToVideo: {
6
6
  readonly KLING_3_0: "kling-3.0";
7
+ readonly KLING_O1: "kling-o1";
7
8
  readonly KLING_V2_1_MASTER_TEXT_TO_VIDEO: "kling-v2.1-master-text-to-video";
8
9
  readonly KLING_V2_5_TURBO_TEXT_TO_VIDEO_PRO: "kling-v2.5-turbo-text-to-video-pro";
9
10
  readonly KLING_V2_6: "kling-v2.6";
10
11
  readonly KLING_V3_OMNI: "kling-v3-omni";
12
+ readonly KLING_V3_OMNI_REFERENCE: "kling-v3-omni-reference";
11
13
  readonly KLING_V3_TURBO_TEXT_TO_VIDEO: "kling-v3-turbo-text-to-video";
12
14
  };
13
15
  readonly imageToVideo: {
16
+ readonly KLING_O1: "kling-o1";
14
17
  readonly KLING_V2_1_MASTER_IMAGE_TO_VIDEO: "kling-v2.1-master-image-to-video";
15
18
  readonly KLING_V2_1_PRO: "kling-v2.1-pro";
16
19
  readonly KLING_V2_1_STANDARD: "kling-v2.1-standard";
@@ -19,6 +22,10 @@ declare const modelValues: {
19
22
  readonly KLING_V3_OMNI: "kling-v3-omni";
20
23
  readonly KLING_V3_TURBO_IMAGE_TO_VIDEO: "kling-v3-turbo-image-to-video";
21
24
  };
25
+ readonly editVideo: {
26
+ readonly KLING_V3_OMNI_EDIT: "kling-v3-omni-edit";
27
+ readonly KLING_V3_OMNI_REFERENCE: "kling-v3-omni-reference";
28
+ };
22
29
  readonly avatar: {
23
30
  readonly KLING_AI_AVATAR_PRO: "kling-ai-avatar-pro";
24
31
  readonly KLING_AI_AVATAR_STANDARD: "kling-ai-avatar-standard";
@@ -39,6 +46,8 @@ type KlingTextToVideoModel = (typeof modelValues.textToVideo)[keyof typeof model
39
46
  /** Earlier V2 image-to-video variants. V2.5 turbo and V2.1 pro support last-frame image control. */
40
47
  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
48
  type KlingImageToVideoModel = (typeof modelValues.imageToVideo)[keyof typeof modelValues.imageToVideo];
49
+ /** Model variants for source-video editing. */
50
+ type KlingEditVideoModel = (typeof modelValues.editVideo)[keyof typeof modelValues.editVideo];
42
51
  /** Output resolution for text-to-video. 4k is highest quality but slowest. */
43
52
  type KlingTextToVideoOutputResolution = '720p' | '1080p' | '4k';
44
53
  type KlingV3TurboOutputResolution = '720p' | '1080p';
@@ -46,6 +55,7 @@ type KlingAspectRatio = '16:9' | '9:16' | '1:1';
46
55
  /** Duration in seconds. Range varies by model: 3-15 for kling-3.0, 5 or 10 for V2.x. */
47
56
  type KlingDuration = number;
48
57
  type KlingV26Mode = 'std' | 'pro';
58
+ type KlingO1ReferenceVideoType = 'base' | 'feature';
49
59
  /** A single shot in a multi-shot text-to-video sequence. */
50
60
  interface MultiPromptItem {
51
61
  prompt: string;
@@ -145,6 +155,26 @@ interface KlingV26TextToVideoParams {
145
155
  aspect_ratio?: KlingAspectRatio;
146
156
  callback_url?: string;
147
157
  }
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
+ /** Kling O1 text-to-video with image and video references. */
169
+ interface KlingO1TextToVideoParams extends KlingO1ReferenceParams {
170
+ model: (typeof modelValues.textToVideo.KLING_O1);
171
+ prompt: string;
172
+ mode?: KlingV26Mode;
173
+ duration_seconds?: 5;
174
+ enable_sound?: false;
175
+ aspect_ratio?: KlingAspectRatio;
176
+ callback_url?: string;
177
+ }
148
178
  /** Kling v3 Omni text-to-video with native 4K, synchronized sound, and flexible duration. */
149
179
  interface V3OmniTextToVideoParams {
150
180
  model: (typeof modelValues.textToVideo.KLING_V3_OMNI);
@@ -155,6 +185,17 @@ interface V3OmniTextToVideoParams {
155
185
  aspect_ratio?: KlingAspectRatio;
156
186
  callback_url?: string;
157
187
  }
188
+ /** Kling v3 Omni reference generation from one to seven reference images. */
189
+ interface V3OmniReferenceTextToVideoParams {
190
+ model: (typeof modelValues.textToVideo.KLING_V3_OMNI_REFERENCE);
191
+ prompt: string;
192
+ reference_image_urls: string[];
193
+ duration_seconds?: KlingDuration;
194
+ output_resolution?: KlingTextToVideoOutputResolution;
195
+ aspect_ratio: KlingAspectRatio;
196
+ enable_sound?: boolean;
197
+ callback_url?: string;
198
+ }
158
199
  /**
159
200
  * Earlier V2 image-to-video parameters. A first-frame image is required; the model
160
201
  * animates it into video guided by the text prompt. last_frame_image_url is supported
@@ -196,6 +237,19 @@ interface KlingV26ImageToVideoParams {
196
237
  aspect_ratio?: KlingAspectRatio;
197
238
  callback_url?: string;
198
239
  }
240
+ /** Kling O1 image-to-video with a first frame plus either a final frame or reference media. */
241
+ interface KlingO1ImageToVideoParams extends KlingO1ReferenceParams {
242
+ model: (typeof modelValues.imageToVideo.KLING_O1);
243
+ prompt: string;
244
+ first_frame_image_url: string;
245
+ /** Final frame URL; cannot be combined with reference_image_urls or reference_video_url. */
246
+ last_frame_image_url?: string;
247
+ mode?: KlingV26Mode;
248
+ duration_seconds?: 5;
249
+ enable_sound?: false;
250
+ aspect_ratio?: KlingAspectRatio;
251
+ callback_url?: string;
252
+ }
199
253
  /** Kling v3 Omni image-to-video from caller-owned first and optional final frames. */
200
254
  interface V3OmniImageToVideoParams {
201
255
  model: (typeof modelValues.imageToVideo.KLING_V3_OMNI);
@@ -209,8 +263,8 @@ interface V3OmniImageToVideoParams {
209
263
  aspect_ratio?: KlingAspectRatio;
210
264
  callback_url?: string;
211
265
  }
212
- type TextToVideoParams = Kling3TextToVideoSingleShotParams | Kling3TextToVideoMultiShotParams | KlingV26TextToVideoParams | V25TurboTextToVideoParams | V21MasterTextToVideoParams | V3TurboTextToVideoParams | V3OmniTextToVideoParams;
213
- type ImageToVideoParams = V2ImageToVideoParams | KlingV26ImageToVideoParams | V3TurboImageToVideoParams | V3OmniImageToVideoParams;
266
+ type TextToVideoParams = Kling3TextToVideoSingleShotParams | Kling3TextToVideoMultiShotParams | KlingV26TextToVideoParams | KlingO1TextToVideoParams | V25TurboTextToVideoParams | V21MasterTextToVideoParams | V3TurboTextToVideoParams | V3OmniTextToVideoParams | V3OmniReferenceTextToVideoParams;
267
+ type ImageToVideoParams = V2ImageToVideoParams | KlingV26ImageToVideoParams | KlingO1ImageToVideoParams | V3TurboImageToVideoParams | V3OmniImageToVideoParams;
214
268
  /** Continue a completed Kling V2.5 Turbo video task. */
215
269
  interface KlingExtendVideoParams {
216
270
  source_task_id: string;
@@ -218,11 +272,33 @@ interface KlingExtendVideoParams {
218
272
  prompt?: string;
219
273
  callback_url?: string;
220
274
  }
221
- interface AsyncTaskResponse {
275
+ /** Parameters for Kling v3 Omni source-video editing. */
276
+ interface EditVideoParams {
277
+ model: KlingEditVideoModel;
278
+ /** Video description prompt. */
279
+ prompt: string;
280
+ /** Caller-owned source video URL. Mutually exclusive with source_task_id. */
281
+ source_video_url?: string;
282
+ /** Completed compatible RunAPI task ID. Mutually exclusive with source_video_url. */
283
+ source_task_id?: string;
284
+ /** Ordered reference image URLs. */
285
+ reference_image_urls?: string[];
286
+ /** Output duration in seconds. Source-only requests use five seconds. */
287
+ duration_seconds?: KlingDuration;
288
+ /** Output resolution. */
289
+ output_resolution?: KlingTextToVideoOutputResolution;
290
+ /** Output aspect ratio. Source-only requests use auto. */
291
+ aspect_ratio?: KlingAspectRatio | 'auto';
292
+ /** Enable synchronized sound generation. */
293
+ enable_sound?: boolean;
294
+ /** URL for completion callback notifications. */
295
+ callback_url?: string;
296
+ }
297
+ interface AsyncTaskResponse extends TaskResponse {
222
298
  id: string;
223
299
  status: AsyncTaskStatus;
224
300
  }
225
- interface TaskCreateResponse {
301
+ interface TaskCreateResponse extends TaskBillingResponse {
226
302
  id: string;
227
303
  }
228
304
  interface VideoMetadata {
@@ -424,6 +500,14 @@ declare class ExtendVideo {
424
500
  get(id: string, options?: RequestOptions): Promise<TextToVideoResponse>;
425
501
  }
426
502
 
503
+ declare class EditVideo {
504
+ private readonly http;
505
+ constructor(http: HttpClient);
506
+ run(params: EditVideoParams, options?: RequestOptions & PollingOptions): Promise<TextToVideoResponse>;
507
+ create(params: EditVideoParams, options?: RequestOptions): Promise<TaskCreateResponse>;
508
+ get(id: string, options?: RequestOptions): Promise<TextToVideoResponse>;
509
+ }
510
+
427
511
  /**
428
512
  * Kling video generation, AI avatar lip-sync, and motion control API client.
429
513
  *
@@ -447,7 +531,9 @@ declare class KlingClient extends BaseClient {
447
531
  /** Transfer motion from a reference video onto a subject image. */
448
532
  readonly motionControl: MotionControl;
449
533
  readonly extendVideo: ExtendVideo;
534
+ /** Edit a source video with the selected Kling v3 Omni model. */
535
+ readonly editVideo: EditVideo;
450
536
  constructor(options?: ClientOptions);
451
537
  }
452
538
 
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 };
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 };