@runapi.ai/kling 0.6.1 → 0.7.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.mjs CHANGED
@@ -1,10 +1,59 @@
1
1
  // src/client.ts
2
2
  import { BaseClient } from "@runapi.ai/core";
3
3
 
4
- // src/resources/text-to-video.ts
4
+ // src/resources/text-to-image.ts
5
5
  import { compactParams } from "@runapi.ai/core";
6
6
  import { pollUntilComplete } from "@runapi.ai/core/internal";
7
- var ENDPOINT = "/api/v1/kling/text_to_video";
7
+ var ENDPOINT = "/api/v1/kling/text_to_image";
8
+ var TextToImage = class {
9
+ constructor(http) {
10
+ this.http = http;
11
+ }
12
+ http;
13
+ /**
14
+ * Generate an image from a text prompt and wait until complete.
15
+ * @param params Text-to-image parameters.
16
+ * @param options Per-request and polling overrides.
17
+ * @returns The completed task with images.
18
+ */
19
+ async run(params, options) {
20
+ const { id } = await this.create(params, options);
21
+ const response = await pollUntilComplete(() => this.get(id, options), {
22
+ maxWaitMs: options?.maxWaitMs,
23
+ pollIntervalMs: options?.pollIntervalMs
24
+ });
25
+ return response;
26
+ }
27
+ /**
28
+ * Create a text-to-image task; returns immediately with a task id.
29
+ * @param params Text-to-image parameters.
30
+ * @param options Per-request overrides.
31
+ * @returns The task creation result with id.
32
+ */
33
+ async create(params, options) {
34
+ const body = compactParams(params);
35
+ return this.http.request("POST", ENDPOINT, {
36
+ body,
37
+ ...options
38
+ });
39
+ }
40
+ /**
41
+ * Fetch the current status of a text-to-image task.
42
+ * @param id The task id.
43
+ * @param options Per-request overrides.
44
+ * @returns The current text-to-image task status.
45
+ */
46
+ async get(id, options) {
47
+ return this.http.request("GET", `${ENDPOINT}/${id}`, {
48
+ ...options
49
+ });
50
+ }
51
+ };
52
+
53
+ // src/resources/text-to-video.ts
54
+ import { compactParams as compactParams2 } from "@runapi.ai/core";
55
+ import { pollUntilComplete as pollUntilComplete2 } from "@runapi.ai/core/internal";
56
+ var ENDPOINT2 = "/api/v1/kling/text_to_video";
8
57
  var TextToVideo = class {
9
58
  constructor(http) {
10
59
  this.http = http;
@@ -18,7 +67,7 @@ var TextToVideo = class {
18
67
  */
19
68
  async run(params, options) {
20
69
  const { id } = await this.create(params, options);
21
- const response = await pollUntilComplete(() => this.get(id, options), {
70
+ const response = await pollUntilComplete2(() => this.get(id, options), {
22
71
  maxWaitMs: options?.maxWaitMs,
23
72
  pollIntervalMs: options?.pollIntervalMs
24
73
  });
@@ -31,8 +80,8 @@ var TextToVideo = class {
31
80
  * @returns The task creation result with id.
32
81
  */
33
82
  async create(params, options) {
34
- const body = compactParams(params);
35
- return this.http.request("POST", ENDPOINT, {
83
+ const body = compactParams2(params);
84
+ return this.http.request("POST", ENDPOINT2, {
36
85
  body,
37
86
  ...options
38
87
  });
@@ -44,16 +93,16 @@ var TextToVideo = class {
44
93
  * @returns The current text-to-video task status.
45
94
  */
46
95
  async get(id, options) {
47
- return this.http.request("GET", `${ENDPOINT}/${id}`, {
96
+ return this.http.request("GET", `${ENDPOINT2}/${id}`, {
48
97
  ...options
49
98
  });
50
99
  }
51
100
  };
52
101
 
53
102
  // src/resources/image-to-video.ts
54
- import { compactParams as compactParams2 } from "@runapi.ai/core";
55
- import { pollUntilComplete as pollUntilComplete2 } from "@runapi.ai/core/internal";
56
- var ENDPOINT2 = "/api/v1/kling/image_to_video";
103
+ import { compactParams as compactParams3 } from "@runapi.ai/core";
104
+ import { pollUntilComplete as pollUntilComplete3 } from "@runapi.ai/core/internal";
105
+ var ENDPOINT3 = "/api/v1/kling/image_to_video";
57
106
  var ImageToVideo = class {
58
107
  constructor(http) {
59
108
  this.http = http;
@@ -67,7 +116,7 @@ var ImageToVideo = class {
67
116
  */
68
117
  async run(params, options) {
69
118
  const { id } = await this.create(params, options);
70
- const response = await pollUntilComplete2(() => this.get(id, options), {
119
+ const response = await pollUntilComplete3(() => this.get(id, options), {
71
120
  maxWaitMs: options?.maxWaitMs,
72
121
  pollIntervalMs: options?.pollIntervalMs
73
122
  });
@@ -80,8 +129,8 @@ var ImageToVideo = class {
80
129
  * @returns The task creation result with id.
81
130
  */
82
131
  async create(params, options) {
83
- const body = compactParams2(params);
84
- return this.http.request("POST", ENDPOINT2, {
132
+ const body = compactParams3(params);
133
+ return this.http.request("POST", ENDPOINT3, {
85
134
  body,
86
135
  ...options
87
136
  });
@@ -93,16 +142,16 @@ var ImageToVideo = class {
93
142
  * @returns The current image-to-video task status.
94
143
  */
95
144
  async get(id, options) {
96
- return this.http.request("GET", `${ENDPOINT2}/${id}`, {
145
+ return this.http.request("GET", `${ENDPOINT3}/${id}`, {
97
146
  ...options
98
147
  });
99
148
  }
100
149
  };
101
150
 
102
151
  // src/resources/ai-avatar.ts
103
- import { compactParams as compactParams3 } from "@runapi.ai/core";
104
- import { pollUntilComplete as pollUntilComplete3 } from "@runapi.ai/core/internal";
105
- var ENDPOINT3 = "/api/v1/kling/ai_avatar";
152
+ import { compactParams as compactParams4 } from "@runapi.ai/core";
153
+ import { pollUntilComplete as pollUntilComplete4 } from "@runapi.ai/core/internal";
154
+ var ENDPOINT4 = "/api/v1/kling/ai_avatar";
106
155
  var AiAvatar = class {
107
156
  constructor(http) {
108
157
  this.http = http;
@@ -116,7 +165,7 @@ var AiAvatar = class {
116
165
  */
117
166
  async run(params, options) {
118
167
  const { id } = await this.create(params, options);
119
- const response = await pollUntilComplete3(() => this.get(id, options), {
168
+ const response = await pollUntilComplete4(() => this.get(id, options), {
120
169
  maxWaitMs: options?.maxWaitMs,
121
170
  pollIntervalMs: options?.pollIntervalMs
122
171
  });
@@ -129,8 +178,8 @@ var AiAvatar = class {
129
178
  * @returns The task creation result with id.
130
179
  */
131
180
  async create(params, options) {
132
- const body = compactParams3(params);
133
- return this.http.request("POST", ENDPOINT3, {
181
+ const body = compactParams4(params);
182
+ return this.http.request("POST", ENDPOINT4, {
134
183
  body,
135
184
  ...options
136
185
  });
@@ -142,16 +191,16 @@ var AiAvatar = class {
142
191
  * @returns The current AI avatar task status.
143
192
  */
144
193
  async get(id, options) {
145
- return this.http.request("GET", `${ENDPOINT3}/${id}`, {
194
+ return this.http.request("GET", `${ENDPOINT4}/${id}`, {
146
195
  ...options
147
196
  });
148
197
  }
149
198
  };
150
199
 
151
200
  // src/resources/motion-control.ts
152
- import { compactParams as compactParams4 } from "@runapi.ai/core";
153
- import { pollUntilComplete as pollUntilComplete4 } from "@runapi.ai/core/internal";
154
- var ENDPOINT4 = "/api/v1/kling/motion_control";
201
+ import { compactParams as compactParams5 } from "@runapi.ai/core";
202
+ import { pollUntilComplete as pollUntilComplete5 } from "@runapi.ai/core/internal";
203
+ var ENDPOINT5 = "/api/v1/kling/motion_control";
155
204
  var MotionControl = class {
156
205
  constructor(http) {
157
206
  this.http = http;
@@ -165,7 +214,7 @@ var MotionControl = class {
165
214
  */
166
215
  async run(params, options) {
167
216
  const { id } = await this.create(params, options);
168
- const response = await pollUntilComplete4(() => this.get(id, options), {
217
+ const response = await pollUntilComplete5(() => this.get(id, options), {
169
218
  maxWaitMs: options?.maxWaitMs,
170
219
  pollIntervalMs: options?.pollIntervalMs
171
220
  });
@@ -178,8 +227,8 @@ var MotionControl = class {
178
227
  * @returns The task creation result with id.
179
228
  */
180
229
  async create(params, options) {
181
- const body = compactParams4(params);
182
- return this.http.request("POST", ENDPOINT4, {
230
+ const body = compactParams5(params);
231
+ return this.http.request("POST", ENDPOINT5, {
183
232
  body,
184
233
  ...options
185
234
  });
@@ -191,16 +240,16 @@ var MotionControl = class {
191
240
  * @returns The current motion control task status.
192
241
  */
193
242
  async get(id, options) {
194
- return this.http.request("GET", `${ENDPOINT4}/${id}`, {
243
+ return this.http.request("GET", `${ENDPOINT5}/${id}`, {
195
244
  ...options
196
245
  });
197
246
  }
198
247
  };
199
248
 
200
249
  // src/resources/extend-video.ts
201
- import { compactParams as compactParams5 } from "@runapi.ai/core";
202
- import { pollUntilComplete as pollUntilComplete5 } from "@runapi.ai/core/internal";
203
- var ENDPOINT5 = "/api/v1/kling/extend_video";
250
+ import { compactParams as compactParams6 } from "@runapi.ai/core";
251
+ import { pollUntilComplete as pollUntilComplete6 } from "@runapi.ai/core/internal";
252
+ var ENDPOINT6 = "/api/v1/kling/extend_video";
204
253
  var ExtendVideo = class {
205
254
  constructor(http) {
206
255
  this.http = http;
@@ -208,24 +257,24 @@ var ExtendVideo = class {
208
257
  http;
209
258
  async run(params, options) {
210
259
  const { id } = await this.create(params, options);
211
- return pollUntilComplete5(() => this.get(id, options), {
260
+ return pollUntilComplete6(() => this.get(id, options), {
212
261
  maxWaitMs: options?.maxWaitMs,
213
262
  pollIntervalMs: options?.pollIntervalMs
214
263
  });
215
264
  }
216
265
  async create(params, options) {
217
- const body = compactParams5(params);
218
- return this.http.request("POST", ENDPOINT5, { body, ...options });
266
+ const body = compactParams6(params);
267
+ return this.http.request("POST", ENDPOINT6, { body, ...options });
219
268
  }
220
269
  async get(id, options) {
221
- return this.http.request("GET", `${ENDPOINT5}/${id}`, { ...options });
270
+ return this.http.request("GET", `${ENDPOINT6}/${id}`, { ...options });
222
271
  }
223
272
  };
224
273
 
225
274
  // src/resources/edit-video.ts
226
- import { compactParams as compactParams6 } from "@runapi.ai/core";
227
- import { pollUntilComplete as pollUntilComplete6 } from "@runapi.ai/core/internal";
228
- var ENDPOINT6 = "/api/v1/kling/edit_video";
275
+ import { compactParams as compactParams7 } from "@runapi.ai/core";
276
+ import { pollUntilComplete as pollUntilComplete7 } from "@runapi.ai/core/internal";
277
+ var ENDPOINT7 = "/api/v1/kling/edit_video";
229
278
  var EditVideo = class {
230
279
  constructor(http) {
231
280
  this.http = http;
@@ -233,17 +282,65 @@ var EditVideo = class {
233
282
  http;
234
283
  async run(params, options) {
235
284
  const { id } = await this.create(params, options);
236
- return pollUntilComplete6(() => this.get(id, options), {
285
+ return pollUntilComplete7(() => this.get(id, options), {
237
286
  maxWaitMs: options?.maxWaitMs,
238
287
  pollIntervalMs: options?.pollIntervalMs
239
288
  });
240
289
  }
241
290
  async create(params, options) {
242
- const body = compactParams6(params);
243
- return this.http.request("POST", ENDPOINT6, { body, ...options });
291
+ const body = compactParams7(params);
292
+ return this.http.request("POST", ENDPOINT7, { body, ...options });
244
293
  }
245
294
  async get(id, options) {
246
- return this.http.request("GET", `${ENDPOINT6}/${id}`, { ...options });
295
+ return this.http.request("GET", `${ENDPOINT7}/${id}`, { ...options });
296
+ }
297
+ };
298
+
299
+ // src/resources/keyframe-to-video.ts
300
+ import { compactParams as compactParams8 } from "@runapi.ai/core";
301
+ import { pollUntilComplete as pollUntilComplete8 } from "@runapi.ai/core/internal";
302
+ var ENDPOINT8 = "/api/v1/kling/keyframe_to_video";
303
+ var KeyframeToVideo = class {
304
+ constructor(http) {
305
+ this.http = http;
306
+ }
307
+ http;
308
+ async run(params, options) {
309
+ const { id } = await this.create(params, options);
310
+ return pollUntilComplete8(() => this.get(id, options), {
311
+ maxWaitMs: options?.maxWaitMs,
312
+ pollIntervalMs: options?.pollIntervalMs
313
+ });
314
+ }
315
+ async create(params, options) {
316
+ return this.http.request("POST", ENDPOINT8, { body: compactParams8(params), ...options });
317
+ }
318
+ async get(id, options) {
319
+ return this.http.request("GET", `${ENDPOINT8}/${id}`, { ...options });
320
+ }
321
+ };
322
+
323
+ // src/resources/reference-to-video.ts
324
+ import { compactParams as compactParams9 } from "@runapi.ai/core";
325
+ import { pollUntilComplete as pollUntilComplete9 } from "@runapi.ai/core/internal";
326
+ var ENDPOINT9 = "/api/v1/kling/reference_to_video";
327
+ var ReferenceToVideo = class {
328
+ constructor(http) {
329
+ this.http = http;
330
+ }
331
+ http;
332
+ async run(params, options) {
333
+ const { id } = await this.create(params, options);
334
+ return pollUntilComplete9(() => this.get(id, options), {
335
+ maxWaitMs: options?.maxWaitMs,
336
+ pollIntervalMs: options?.pollIntervalMs
337
+ });
338
+ }
339
+ async create(params, options) {
340
+ return this.http.request("POST", ENDPOINT9, { body: compactParams9(params), ...options });
341
+ }
342
+ async get(id, options) {
343
+ return this.http.request("GET", `${ENDPOINT9}/${id}`, { ...options });
247
344
  }
248
345
  };
249
346
 
@@ -251,6 +348,7 @@ var EditVideo = class {
251
348
  var KlingClient = class extends BaseClient {
252
349
  /** Text-to-video generation with multi-shot, sound, and Kling elements support on kling-3.0. */
253
350
  textToVideo;
351
+ textToImage;
254
352
  /** Image-to-video animation from a first-frame image guided by a text prompt. */
255
353
  imageToVideo;
256
354
  /** AI avatar lip-sync: animate a face image to match an audio track. */
@@ -260,14 +358,19 @@ var KlingClient = class extends BaseClient {
260
358
  extendVideo;
261
359
  /** Edit a source video with the selected Kling v3 Omni model. */
262
360
  editVideo;
361
+ keyframeToVideo;
362
+ referenceToVideo;
263
363
  constructor(options = {}) {
264
364
  super(options);
365
+ this.textToImage = new TextToImage(this.http);
265
366
  this.textToVideo = new TextToVideo(this.http);
266
367
  this.imageToVideo = new ImageToVideo(this.http);
267
368
  this.aiAvatar = new AiAvatar(this.http);
268
369
  this.motionControl = new MotionControl(this.http);
269
370
  this.extendVideo = new ExtendVideo(this.http);
270
371
  this.editVideo = new EditVideo(this.http);
372
+ this.keyframeToVideo = new KeyframeToVideo(this.http);
373
+ this.referenceToVideo = new ReferenceToVideo(this.http);
271
374
  }
272
375
  };
273
376
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/client.ts","../src/resources/text-to-video.ts","../src/resources/image-to-video.ts","../src/resources/ai-avatar.ts","../src/resources/motion-control.ts","../src/resources/extend-video.ts","../src/resources/edit-video.ts","../src/index.ts"],"sourcesContent":["import { BaseClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToVideo } from './resources/text-to-video';\nimport { ImageToVideo } from './resources/image-to-video';\nimport { AiAvatar } from './resources/ai-avatar';\nimport { MotionControl } from './resources/motion-control';\nimport { ExtendVideo } from './resources/extend-video';\nimport { EditVideo } from './resources/edit-video';\n\n/**\n * Kling video generation, AI avatar lip-sync, and motion control API client.\n *\n * @example\n * ```typescript\n * const client = new KlingClient({ apiKey: 'your-api-key' });\n *\n * const result = await client.textToVideo.run({\n * model: 'kling-3.0',\n * prompt: 'A cat walking through a garden',\n * });\n * ```\n */\nexport class KlingClient extends BaseClient {\n /** Text-to-video generation with multi-shot, sound, and Kling elements support on kling-3.0. */\n public readonly textToVideo: TextToVideo;\n /** Image-to-video animation from a first-frame image guided by a text prompt. */\n public readonly imageToVideo: ImageToVideo;\n /** AI avatar lip-sync: animate a face image to match an audio track. */\n public readonly aiAvatar: AiAvatar;\n /** Transfer motion from a reference video onto a subject image. */\n public readonly motionControl: MotionControl;\n public readonly extendVideo: ExtendVideo;\n /** Edit a source video with the selected Kling v3 Omni model. */\n public readonly editVideo: EditVideo;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.textToVideo = new TextToVideo(this.http);\n this.imageToVideo = new ImageToVideo(this.http);\n this.aiAvatar = new AiAvatar(this.http);\n this.motionControl = new MotionControl(this.http);\n this.extendVideo = new ExtendVideo(this.http);\n this.editVideo = new EditVideo(this.http);\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedTextToVideoResponse,\n TextToVideoParams,\n TextToVideoResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/kling/text_to_video';\n\n/** Generate video from text prompts. Supports multi-shot, sound, first/last frame images, and Kling elements on kling-3.0; negative prompts and cfg_scale on V2.x models. */\nexport class TextToVideo {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Generate a video from a text prompt and wait until complete.\n * @param params Text-to-video parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed task with videos.\n */\n async run(params: TextToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<TextToVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedTextToVideoResponse;\n }\n\n /**\n * Create a text-to-video task; returns immediately with a task id.\n * @param params Text-to-video parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: TextToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of a text-to-video task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current text-to-video task status.\n */\n async get(id: string, options?: RequestOptions): Promise<TextToVideoResponse> {\n return this.http.request<TextToVideoResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedImageToVideoResponse,\n ImageToVideoParams,\n ImageToVideoResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/kling/image_to_video';\n\n/** Animate a still image into video, guided by a text prompt and first-frame image. */\nexport class ImageToVideo {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Generate a video from an input image and wait until complete.\n * @param params Image-to-video parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed task with videos.\n */\n async run(params: ImageToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedImageToVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<ImageToVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedImageToVideoResponse;\n }\n\n /**\n * Create an image-to-video task; returns immediately with a task id.\n * @param params Image-to-video parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: ImageToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of an image-to-video task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current image-to-video task status.\n */\n async get(id: string, options?: RequestOptions): Promise<ImageToVideoResponse> {\n return this.http.request<ImageToVideoResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedAiAvatarResponse,\n AiAvatarParams,\n AiAvatarResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/kling/ai_avatar';\n\n/** Lip-sync a face image to an audio track, producing a talking-head video. */\nexport class AiAvatar {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Generate an AI avatar video and wait until complete.\n * @param params AI avatar parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed task with videos.\n */\n async run(params: AiAvatarParams, options?: RequestOptions & PollingOptions): Promise<CompletedAiAvatarResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<AiAvatarResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedAiAvatarResponse;\n }\n\n /**\n * Create an AI avatar generation task; returns immediately with a task id.\n * @param params AI avatar parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: AiAvatarParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of an AI avatar task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current AI avatar task status.\n */\n async get(id: string, options?: RequestOptions): Promise<AiAvatarResponse> {\n return this.http.request<AiAvatarResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedMotionControlResponse,\n MotionControlParams,\n MotionControlResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/kling/motion_control';\n\n/** Transfer motion from a reference video onto a subject image, preserving the subject's appearance. */\nexport class MotionControl {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Generate a video with motion transfer from a reference video and wait until complete.\n * @param params Motion control parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed task with videos.\n */\n async run(params: MotionControlParams, options?: RequestOptions & PollingOptions): Promise<CompletedMotionControlResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<MotionControlResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedMotionControlResponse;\n }\n\n /**\n * Create a motion control generation task; returns immediately with a task id.\n * @param params Motion control parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: MotionControlParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of a motion control task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current motion control task status.\n */\n async get(id: string, options?: RequestOptions): Promise<MotionControlResponse> {\n return this.http.request<MotionControlResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type { KlingExtendVideoParams, TextToVideoResponse, TaskCreateResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/kling/extend_video';\n\nexport class ExtendVideo {\n constructor(private readonly http: HttpClient) {}\n\n async run(params: KlingExtendVideoParams, options?: RequestOptions & PollingOptions): Promise<TextToVideoResponse> {\n const { id } = await this.create(params, options);\n return pollUntilComplete<TextToVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n }\n\n async create(params: KlingExtendVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, { body, ...options });\n }\n\n async get(id: string, options?: RequestOptions): Promise<TextToVideoResponse> {\n return this.http.request<TextToVideoResponse>('GET', `${ENDPOINT}/${id}`, { ...options });\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type { EditVideoParams, TaskCreateResponse, TextToVideoResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/kling/edit_video';\n\nexport class EditVideo {\n constructor(private readonly http: HttpClient) {}\n\n async run(params: EditVideoParams, options?: RequestOptions & PollingOptions): Promise<TextToVideoResponse> {\n const { id } = await this.create(params, options);\n return pollUntilComplete<TextToVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n }\n\n async create(params: EditVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, { body, ...options });\n }\n\n async get(id: string, options?: RequestOptions): Promise<TextToVideoResponse> {\n return this.http.request<TextToVideoResponse>('GET', `${ENDPOINT}/${id}`, { ...options });\n }\n}\n","export { KlingClient } from './client';\nexport * from './types';\n\nexport {\n RunApiError,\n AuthenticationError,\n InsufficientCreditsError,\n NotFoundError,\n ValidationError,\n RateLimitError,\n ServiceUnavailableError,\n NetworkError,\n TimeoutError,\n TaskTimeoutError,\n TaskFailedError,\n} from '@runapi.ai/core';\n"],"mappings":";AAAA,SAAS,kBAAsC;;;ACC/C,SAAS,qBAAqB;AAC9B,SAAS,y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AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO;AACb,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAC5C,SAAK,eAAe,IAAI,aAAa,KAAK,IAAI;AAC9C,SAAK,WAAW,IAAI,SAAS,KAAK,IAAI;AACtC,SAAK,gBAAgB,IAAI,cAAc,KAAK,IAAI;AAChD,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAC5C,SAAK,YAAY,IAAI,UAAU,KAAK,IAAI;AAAA,EAC1C;AACF;;;AOxCA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":["compactParams","pollUntilComplete","ENDPOINT","compactParams","pollUntilComplete","ENDPOINT","compactParams","pollUntilComplete","ENDPOINT","compactParams","pollUntilComplete","ENDPOINT","compactParams","pollUntilComplete","ENDPOINT"]}
1
+ {"version":3,"sources":["../src/client.ts","../src/resources/text-to-image.ts","../src/resources/text-to-video.ts","../src/resources/image-to-video.ts","../src/resources/ai-avatar.ts","../src/resources/motion-control.ts","../src/resources/extend-video.ts","../src/resources/edit-video.ts","../src/resources/keyframe-to-video.ts","../src/resources/reference-to-video.ts","../src/index.ts"],"sourcesContent":["import { BaseClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToImage } from './resources/text-to-image';\nimport { TextToVideo } from './resources/text-to-video';\nimport { ImageToVideo } from './resources/image-to-video';\nimport { AiAvatar } from './resources/ai-avatar';\nimport { MotionControl } from './resources/motion-control';\nimport { ExtendVideo } from './resources/extend-video';\nimport { EditVideo } from './resources/edit-video';\nimport { KeyframeToVideo } from './resources/keyframe-to-video';\nimport { ReferenceToVideo } from './resources/reference-to-video';\n\n/**\n * Kling video generation, AI avatar lip-sync, and motion control API client.\n *\n * @example\n * ```typescript\n * const client = new KlingClient({ apiKey: 'your-api-key' });\n *\n * const result = await client.textToVideo.run({\n * model: 'kling-3.0',\n * prompt: 'A cat walking through a garden',\n * });\n * ```\n */\nexport class KlingClient extends BaseClient {\n /** Text-to-video generation with multi-shot, sound, and Kling elements support on kling-3.0. */\n public readonly textToVideo: TextToVideo;\n public readonly textToImage: TextToImage;\n /** Image-to-video animation from a first-frame image guided by a text prompt. */\n public readonly imageToVideo: ImageToVideo;\n /** AI avatar lip-sync: animate a face image to match an audio track. */\n public readonly aiAvatar: AiAvatar;\n /** Transfer motion from a reference video onto a subject image. */\n public readonly motionControl: MotionControl;\n public readonly extendVideo: ExtendVideo;\n /** Edit a source video with the selected Kling v3 Omni model. */\n public readonly editVideo: EditVideo;\n public readonly keyframeToVideo: KeyframeToVideo;\n public readonly referenceToVideo: ReferenceToVideo;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.textToImage = new TextToImage(this.http);\n this.textToVideo = new TextToVideo(this.http);\n this.imageToVideo = new ImageToVideo(this.http);\n this.aiAvatar = new AiAvatar(this.http);\n this.motionControl = new MotionControl(this.http);\n this.extendVideo = new ExtendVideo(this.http);\n this.editVideo = new EditVideo(this.http);\n this.keyframeToVideo = new KeyframeToVideo(this.http);\n this.referenceToVideo = new ReferenceToVideo(this.http);\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedTextToImageResponse,\n TextToImageParams,\n TextToImageResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/kling/text_to_image';\n\n/** Generate ordered standard, series, ecommerce, or webpage images. */\nexport class TextToImage {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Generate an image from a text prompt and wait until complete.\n * @param params Text-to-image parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed task with images.\n */\n async run(params: TextToImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToImageResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<TextToImageResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedTextToImageResponse;\n }\n\n /**\n * Create a text-to-image task; returns immediately with a task id.\n * @param params Text-to-image parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: TextToImageParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of a text-to-image task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current text-to-image task status.\n */\n async get(id: string, options?: RequestOptions): Promise<TextToImageResponse> {\n return this.http.request<TextToImageResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedTextToVideoResponse,\n TextToVideoParams,\n TextToVideoResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/kling/text_to_video';\n\n/** Generate video from text prompts. Supports multi-shot, sound, first/last frame images, and Kling elements on kling-3.0; negative prompts and cfg_scale on V2.x models. */\nexport class TextToVideo {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Generate a video from a text prompt and wait until complete.\n * @param params Text-to-video parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed task with videos.\n */\n async run(params: TextToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<TextToVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedTextToVideoResponse;\n }\n\n /**\n * Create a text-to-video task; returns immediately with a task id.\n * @param params Text-to-video parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: TextToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of a text-to-video task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current text-to-video task status.\n */\n async get(id: string, options?: RequestOptions): Promise<TextToVideoResponse> {\n return this.http.request<TextToVideoResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedImageToVideoResponse,\n ImageToVideoParams,\n ImageToVideoResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/kling/image_to_video';\n\n/** Animate a still image into video, guided by a text prompt and first-frame image. */\nexport class ImageToVideo {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Generate a video from an input image and wait until complete.\n * @param params Image-to-video parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed task with videos.\n */\n async run(params: ImageToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedImageToVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<ImageToVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedImageToVideoResponse;\n }\n\n /**\n * Create an image-to-video task; returns immediately with a task id.\n * @param params Image-to-video parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: ImageToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of an image-to-video task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current image-to-video task status.\n */\n async get(id: string, options?: RequestOptions): Promise<ImageToVideoResponse> {\n return this.http.request<ImageToVideoResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedAiAvatarResponse,\n AiAvatarParams,\n AiAvatarResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/kling/ai_avatar';\n\n/** Lip-sync a face image to an audio track, producing a talking-head video. */\nexport class AiAvatar {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Generate an AI avatar video and wait until complete.\n * @param params AI avatar parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed task with videos.\n */\n async run(params: AiAvatarParams, options?: RequestOptions & PollingOptions): Promise<CompletedAiAvatarResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<AiAvatarResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedAiAvatarResponse;\n }\n\n /**\n * Create an AI avatar generation task; returns immediately with a task id.\n * @param params AI avatar parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: AiAvatarParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of an AI avatar task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current AI avatar task status.\n */\n async get(id: string, options?: RequestOptions): Promise<AiAvatarResponse> {\n return this.http.request<AiAvatarResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedMotionControlResponse,\n MotionControlParams,\n MotionControlResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/kling/motion_control';\n\n/** Transfer motion from a reference video onto a subject image, preserving the subject's appearance. */\nexport class MotionControl {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Generate a video with motion transfer from a reference video and wait until complete.\n * @param params Motion control parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed task with videos.\n */\n async run(params: MotionControlParams, options?: RequestOptions & PollingOptions): Promise<CompletedMotionControlResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<MotionControlResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedMotionControlResponse;\n }\n\n /**\n * Create a motion control generation task; returns immediately with a task id.\n * @param params Motion control parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: MotionControlParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of a motion control task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current motion control task status.\n */\n async get(id: string, options?: RequestOptions): Promise<MotionControlResponse> {\n return this.http.request<MotionControlResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type { KlingExtendVideoParams, TextToVideoResponse, TaskCreateResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/kling/extend_video';\n\nexport class ExtendVideo {\n constructor(private readonly http: HttpClient) {}\n\n async run(params: KlingExtendVideoParams, options?: RequestOptions & PollingOptions): Promise<TextToVideoResponse> {\n const { id } = await this.create(params, options);\n return pollUntilComplete<TextToVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n }\n\n async create(params: KlingExtendVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, { body, ...options });\n }\n\n async get(id: string, options?: RequestOptions): Promise<TextToVideoResponse> {\n return this.http.request<TextToVideoResponse>('GET', `${ENDPOINT}/${id}`, { ...options });\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type { EditVideoParams, TaskCreateResponse, TextToVideoResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/kling/edit_video';\n\nexport class EditVideo {\n constructor(private readonly http: HttpClient) {}\n\n async run(params: EditVideoParams, options?: RequestOptions & PollingOptions): Promise<TextToVideoResponse> {\n const { id } = await this.create(params, options);\n return pollUntilComplete<TextToVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n }\n\n async create(params: EditVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, { body, ...options });\n }\n\n async get(id: string, options?: RequestOptions): Promise<TextToVideoResponse> {\n return this.http.request<TextToVideoResponse>('GET', `${ENDPOINT}/${id}`, { ...options });\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type { KeyframeToVideoParams, KeyframeToVideoResponse, TaskCreateResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/kling/keyframe_to_video';\n\n/** Generate video from ordered Kling 4.0 keyframes. */\nexport class KeyframeToVideo {\n constructor(private readonly http: HttpClient) {}\n\n async run(params: KeyframeToVideoParams, options?: RequestOptions & PollingOptions): Promise<KeyframeToVideoResponse> {\n const { id } = await this.create(params, options);\n return pollUntilComplete<KeyframeToVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n }\n\n async create(params: KeyframeToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, { body: compactParams(params), ...options });\n }\n\n async get(id: string, options?: RequestOptions): Promise<KeyframeToVideoResponse> {\n return this.http.request<KeyframeToVideoResponse>('GET', `${ENDPOINT}/${id}`, { ...options });\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type { ReferenceToVideoParams, ReferenceToVideoResponse, TaskCreateResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/kling/reference_to_video';\n\n/** Generate video from Kling 4.0 image, video, subject, and voice references. */\nexport class ReferenceToVideo {\n constructor(private readonly http: HttpClient) {}\n\n async run(params: ReferenceToVideoParams, options?: RequestOptions & PollingOptions): Promise<ReferenceToVideoResponse> {\n const { id } = await this.create(params, options);\n return pollUntilComplete<ReferenceToVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n }\n\n async create(params: ReferenceToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, { body: compactParams(params), ...options });\n }\n\n async get(id: string, options?: RequestOptions): Promise<ReferenceToVideoResponse> {\n return this.http.request<ReferenceToVideoResponse>('GET', `${ENDPOINT}/${id}`, { ...options });\n }\n}\n","export { KlingClient } from './client';\nexport * from './types';\n\nexport {\n RunApiError,\n AuthenticationError,\n InsufficientCreditsError,\n NotFoundError,\n ValidationError,\n RateLim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EA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO;AACb,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAC5C,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAC5C,SAAK,eAAe,IAAI,aAAa,KAAK,IAAI;AAC9C,SAAK,WAAW,IAAI,SAAS,KAAK,IAAI;AACtC,SAAK,gBAAgB,IAAI,cAAc,KAAK,IAAI;AAChD,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAC5C,SAAK,YAAY,IAAI,UAAU,KAAK,IAAI;AACxC,SAAK,kBAAkB,IAAI,gBAAgB,KAAK,IAAI;AACpD,SAAK,mBAAmB,IAAI,iBAAiB,KAAK,IAAI;AAAA,EACxD;AACF;;;AUjDA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":["compactParams","pollUntilComplete","ENDPOINT","compactParams","pollUntilComplete","ENDPOINT","compactParams","pollUntilComplete","ENDPOINT","compactParams","pollUntilComplete","ENDPOINT","compactParams","pollUntilComplete","ENDPOINT","compactParams","pollUntilComplete","ENDPOINT","compactParams","pollUntilComplete","ENDPOINT","compactParams","pollUntilComplete","ENDPOINT"]}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "runapi": {
4
4
  "slug": "kling"
5
5
  },
6
- "version": "0.6.1",
6
+ "version": "0.7.0",
7
7
  "description": "RunAPI Kling SDK for text-to-video, image-to-video, source-video editing, avatar, and motion-control workflows in JavaScript, Python, Ruby, Go, Java, and PHP",
8
8
  "main": "./dist/index.js",
9
9
  "module": "./dist/index.mjs",
@@ -103,3 +103,7 @@ Use `kling-v3-omni-reference` with text-to-video for image-only reference inputs
103
103
  ## License
104
104
 
105
105
  Licensed under the Apache License, Version 2.0.
106
+
107
+ ## Kling 4.0 images
108
+
109
+ Use the `text_to_image` resource, named `textToImage` in JavaScript, PHP, and Java and `TextToImage` in Go. It supports `kling-v4-image` and `kling-v4-long-image` through create, get, and run. Completed tasks return ordered `images` with download URLs; 8k output is JPEG. Standard image references use `source_image_urls` and named `elements` with `name`, `image_urls`, optional `description`, and optional `tag`. Long images require `skill`: ecommerce uses product `source_image_urls` and optional `length`, while webpage uses optional `style_image_url` and `subject_image_url`. See the [image guide](https://runapi.ai/docs/guides/task-api/kling-images) for constraints and the [model catalog](https://runapi.ai/models/kling) for current pricing.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: kling
3
- description: "Generate and edit video with Kling through RunAPI. Use when the user asks an agent to create, edit, or transform video with Kling. Default to the RunAPI CLI for one-off generation; use SDKs only when the user is integrating RunAPI into an app or backend."
3
+ description: "Generate images and video with Kling through RunAPI. Use when the user asks an agent for Kling standard images, image series, ecommerce or webpage long images, video generation, or video editing. Default to the RunAPI CLI for one-off generation; use SDKs only when the user is integrating RunAPI into an app or backend."
4
4
  documentation: https://runapi.ai/models/kling.md
5
5
  provider_page: https://runapi.ai/providers/kuaishou.md
6
6
  catalog: https://runapi.ai/models.md
@@ -53,6 +53,9 @@ Traverse nested objects and arrays before execution. Close every relationship st
53
53
  For a discovered local media input, including file-typed fields and top-level media URL fields, put an agent-readable local file path directly in `request.json`. The CLI consumes file fields as declared and uploads local paths in top-level media URL fields. Use `runapi files create` only when the user needs a reusable URL, provides Base64, or the discovered contract explicitly requires a separate upload.
54
54
 
55
55
  Semantic invariants:
56
+ - Kling 4.0 image tasks return ordered `images`, including a complete series in one task. 8k output is JPEG. Use `text_to_image` for both `kling-v4-image` and `kling-v4-long-image`.
57
+ - Standard image references use ordered `source_image_urls` as `@image_N` and named `elements` as `@name`. Names are case-insensitively unique, reserve `image_N` and `object_N`, and match the longest supplied name. Letters, digits, or underscores immediately after an English name do not terminate its reference.
58
+ - Long image prompts treat `@` followed by letters, digits, underscores, or Chinese characters as a reference, including emails and handles. Use a full-width `@` or a space after `@` for literal text. Supply the referenced image before using `@style`, `@subject`, or `@image_N`.
56
59
  - For Kling 3.0 multi-shot, use `multi_shots: true`. `shot_type` accepts `custom` or `automatic` and defaults to `custom` only in multi-shot mode. Omit `shot_type` for single-shot requests.
57
60
  - Custom storyboards require 1-6 `multi_prompt` shots with integer durations from 1-12 seconds. Their sum must equal the total `duration_seconds` from 3-15, default 5. Each shot prompt allows 500 effective characters, with each named `@element` reference counting as 37.
58
61
  - Automatic storyboarding requires `prompt` and omits `multi_prompt`. `enable_sound` is optional for multi-shot requests.
@@ -84,7 +87,7 @@ Only when the user explicitly asks for background execution, polling, or webhook
84
87
 
85
88
  A success status is not the deliverable. Read and validate the complete response according to the discovered result contract. Preserve the complete non-media result in the exact requested format, including JSON, text, SRT, or VTT.
86
89
 
87
- For every requested media deliverable listed anywhere in the response, download all of them rather than returning only the first URL. Before downloading, derive its expected MIME type or family from response metadata when present, then the selected output format, then an unambiguous result field such as `videos`, `images`, or `audios` in the API Reference. The Catalog-declared fallback families for this skill are `video/*`. Stop only when no single expected type or family can be established from those sources.
90
+ For every requested media deliverable listed anywhere in the response, download all of them rather than returning only the first URL. Before downloading, derive its expected MIME type or family from response metadata when present, then the selected output format, then an unambiguous result field such as `videos`, `images`, or `audios` in the API Reference. The Catalog-declared fallback families for this skill are `image/*` or `video/*`. Stop only when no single expected type or family can be established from those sources.
88
91
 
89
92
  For every downloaded file, require both a non-empty file and the expected MIME type or family:
90
93
 
@@ -135,6 +138,12 @@ Use this route only for application or production-code integration. Open the cur
135
138
  - `kling-v3-omni-reference`: https://runapi.ai/models/kling/v3-omni-reference.md
136
139
  - `kling-v3-turbo-image-to-video`: https://runapi.ai/models/kling/v3-turbo-image-to-video.md
137
140
  - `kling-v3-turbo-text-to-video`: https://runapi.ai/models/kling/v3-turbo-text-to-video.md
141
+ - `kling-v4-flash-keyframe-to-video`: https://runapi.ai/models/kling/v4-flash-keyframe-to-video.md
142
+ - `kling-v4-flash-reference-to-video`: https://runapi.ai/models/kling/v4-flash-reference-to-video.md
143
+ - `kling-v4-image`: https://runapi.ai/models/kling/v4-image.md
144
+ - `kling-v4-keyframe-to-video`: https://runapi.ai/models/kling/v4-keyframe-to-video.md
145
+ - `kling-v4-long-image`: https://runapi.ai/models/kling/v4-long-image.md
146
+ - `kling-v4-reference-to-video`: https://runapi.ai/models/kling/v4-reference-to-video.md
138
147
 
139
148
  ## Retired references
140
149
  - `kling-ai-avatar-v1-pro` (retired 2026-10-14): https://runapi.ai/models/kling/ai-avatar-v1-pro.md