@runapi.ai/kling 0.2.13 → 0.3.1
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 +9 -5
- package/dist/index.d.mts +52 -2
- package/dist/index.d.ts +52 -2
- package/dist/index.js +457 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +443 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/skills/kling/README.md +3 -2
- package/skills/kling/SKILL.md +78 -49
package/dist/index.js
CHANGED
|
@@ -20,23 +20,23 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
-
AuthenticationError: () =>
|
|
24
|
-
InsufficientCreditsError: () =>
|
|
23
|
+
AuthenticationError: () => import_core9.AuthenticationError,
|
|
24
|
+
InsufficientCreditsError: () => import_core9.InsufficientCreditsError,
|
|
25
25
|
KlingClient: () => KlingClient,
|
|
26
|
-
NetworkError: () =>
|
|
27
|
-
NotFoundError: () =>
|
|
28
|
-
RateLimitError: () =>
|
|
29
|
-
RunApiError: () =>
|
|
30
|
-
ServiceUnavailableError: () =>
|
|
31
|
-
TaskFailedError: () =>
|
|
32
|
-
TaskTimeoutError: () =>
|
|
33
|
-
TimeoutError: () =>
|
|
34
|
-
ValidationError: () =>
|
|
26
|
+
NetworkError: () => import_core9.NetworkError,
|
|
27
|
+
NotFoundError: () => import_core9.NotFoundError,
|
|
28
|
+
RateLimitError: () => import_core9.RateLimitError,
|
|
29
|
+
RunApiError: () => import_core9.RunApiError,
|
|
30
|
+
ServiceUnavailableError: () => import_core9.ServiceUnavailableError,
|
|
31
|
+
TaskFailedError: () => import_core9.TaskFailedError,
|
|
32
|
+
TaskTimeoutError: () => import_core9.TaskTimeoutError,
|
|
33
|
+
TimeoutError: () => import_core9.TimeoutError,
|
|
34
|
+
ValidationError: () => import_core9.ValidationError
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(index_exports);
|
|
37
37
|
|
|
38
38
|
// src/client.ts
|
|
39
|
-
var
|
|
39
|
+
var import_core8 = require("@runapi.ai/core");
|
|
40
40
|
|
|
41
41
|
// src/resources/text-to-video.ts
|
|
42
42
|
var import_core2 = require("@runapi.ai/core");
|
|
@@ -110,6 +110,370 @@ var contract = {
|
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
},
|
|
113
|
+
"edit-video": {
|
|
114
|
+
"models": [
|
|
115
|
+
"kling-v3-omni-edit",
|
|
116
|
+
"kling-v3-omni-reference"
|
|
117
|
+
],
|
|
118
|
+
"fields_by_model": {
|
|
119
|
+
"kling-v3-omni-edit": {
|
|
120
|
+
"aspect_ratio": {
|
|
121
|
+
"enum": [
|
|
122
|
+
"auto",
|
|
123
|
+
"16:9",
|
|
124
|
+
"9:16",
|
|
125
|
+
"1:1"
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
"duration_seconds": {
|
|
129
|
+
"enum": [
|
|
130
|
+
3,
|
|
131
|
+
4,
|
|
132
|
+
5,
|
|
133
|
+
6,
|
|
134
|
+
7,
|
|
135
|
+
8,
|
|
136
|
+
9,
|
|
137
|
+
10,
|
|
138
|
+
11,
|
|
139
|
+
12,
|
|
140
|
+
13,
|
|
141
|
+
14,
|
|
142
|
+
15
|
|
143
|
+
],
|
|
144
|
+
"type": "integer"
|
|
145
|
+
},
|
|
146
|
+
"model": {
|
|
147
|
+
"required": true
|
|
148
|
+
},
|
|
149
|
+
"output_resolution": {
|
|
150
|
+
"enum": [
|
|
151
|
+
"720p",
|
|
152
|
+
"1080p",
|
|
153
|
+
"4k"
|
|
154
|
+
]
|
|
155
|
+
},
|
|
156
|
+
"prompt": {
|
|
157
|
+
"required": true,
|
|
158
|
+
"min": 1,
|
|
159
|
+
"max": 2500,
|
|
160
|
+
"length": true
|
|
161
|
+
},
|
|
162
|
+
"reference_image_urls": {
|
|
163
|
+
"min_items": 1,
|
|
164
|
+
"max_items": 4
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
"kling-v3-omni-reference": {
|
|
168
|
+
"aspect_ratio": {
|
|
169
|
+
"enum": [
|
|
170
|
+
"auto",
|
|
171
|
+
"16:9",
|
|
172
|
+
"9:16",
|
|
173
|
+
"1:1"
|
|
174
|
+
]
|
|
175
|
+
},
|
|
176
|
+
"duration_seconds": {
|
|
177
|
+
"enum": [
|
|
178
|
+
3,
|
|
179
|
+
4,
|
|
180
|
+
5,
|
|
181
|
+
6,
|
|
182
|
+
7,
|
|
183
|
+
8,
|
|
184
|
+
9,
|
|
185
|
+
10,
|
|
186
|
+
11,
|
|
187
|
+
12,
|
|
188
|
+
13,
|
|
189
|
+
14,
|
|
190
|
+
15
|
|
191
|
+
],
|
|
192
|
+
"type": "integer"
|
|
193
|
+
},
|
|
194
|
+
"model": {
|
|
195
|
+
"required": true
|
|
196
|
+
},
|
|
197
|
+
"output_resolution": {
|
|
198
|
+
"enum": [
|
|
199
|
+
"720p",
|
|
200
|
+
"1080p",
|
|
201
|
+
"4k"
|
|
202
|
+
]
|
|
203
|
+
},
|
|
204
|
+
"prompt": {
|
|
205
|
+
"required": true,
|
|
206
|
+
"min": 1,
|
|
207
|
+
"max": 2500,
|
|
208
|
+
"length": true
|
|
209
|
+
},
|
|
210
|
+
"reference_image_urls": {
|
|
211
|
+
"min_items": 1,
|
|
212
|
+
"max_items": 4
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
"rules": [
|
|
217
|
+
{
|
|
218
|
+
"when": {
|
|
219
|
+
"model": "kling-v3-omni-edit",
|
|
220
|
+
"source_video_url": {
|
|
221
|
+
"present": true
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
"forbidden": [
|
|
225
|
+
"source_task_id"
|
|
226
|
+
]
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"when": {
|
|
230
|
+
"model": "kling-v3-omni-edit",
|
|
231
|
+
"source_task_id": {
|
|
232
|
+
"present": true
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
"forbidden": [
|
|
236
|
+
"source_video_url"
|
|
237
|
+
]
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
"enum": {
|
|
241
|
+
"aspect_ratio": [
|
|
242
|
+
"auto"
|
|
243
|
+
],
|
|
244
|
+
"duration_seconds": [
|
|
245
|
+
5
|
|
246
|
+
]
|
|
247
|
+
},
|
|
248
|
+
"when": {
|
|
249
|
+
"model": "kling-v3-omni-edit",
|
|
250
|
+
"source_video_url": {
|
|
251
|
+
"present": true
|
|
252
|
+
},
|
|
253
|
+
"reference_image_urls": {
|
|
254
|
+
"present": false
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
"required": [
|
|
258
|
+
"aspect_ratio"
|
|
259
|
+
]
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
"enum": {
|
|
263
|
+
"aspect_ratio": [
|
|
264
|
+
"auto"
|
|
265
|
+
],
|
|
266
|
+
"duration_seconds": [
|
|
267
|
+
5
|
|
268
|
+
]
|
|
269
|
+
},
|
|
270
|
+
"when": {
|
|
271
|
+
"model": "kling-v3-omni-edit",
|
|
272
|
+
"source_task_id": {
|
|
273
|
+
"present": true
|
|
274
|
+
},
|
|
275
|
+
"reference_image_urls": {
|
|
276
|
+
"present": false
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
"required": [
|
|
280
|
+
"aspect_ratio"
|
|
281
|
+
]
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
"enum": {
|
|
285
|
+
"aspect_ratio": [
|
|
286
|
+
"16:9",
|
|
287
|
+
"9:16",
|
|
288
|
+
"1:1"
|
|
289
|
+
]
|
|
290
|
+
},
|
|
291
|
+
"when": {
|
|
292
|
+
"model": "kling-v3-omni-edit",
|
|
293
|
+
"source_video_url": {
|
|
294
|
+
"present": true
|
|
295
|
+
},
|
|
296
|
+
"reference_image_urls": {
|
|
297
|
+
"present": true
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
"required": [
|
|
301
|
+
"aspect_ratio"
|
|
302
|
+
]
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
"enum": {
|
|
306
|
+
"aspect_ratio": [
|
|
307
|
+
"16:9",
|
|
308
|
+
"9:16",
|
|
309
|
+
"1:1"
|
|
310
|
+
]
|
|
311
|
+
},
|
|
312
|
+
"when": {
|
|
313
|
+
"model": "kling-v3-omni-edit",
|
|
314
|
+
"source_task_id": {
|
|
315
|
+
"present": true
|
|
316
|
+
},
|
|
317
|
+
"reference_image_urls": {
|
|
318
|
+
"present": true
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
"required": [
|
|
322
|
+
"aspect_ratio"
|
|
323
|
+
]
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
"when": {
|
|
327
|
+
"model": "kling-v3-omni-edit",
|
|
328
|
+
"source_task_id": {
|
|
329
|
+
"present": false
|
|
330
|
+
},
|
|
331
|
+
"source_video_url": {
|
|
332
|
+
"present": false
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
"required_any": [
|
|
336
|
+
"source_video_url",
|
|
337
|
+
"source_task_id"
|
|
338
|
+
]
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
"enum": {
|
|
342
|
+
"aspect_ratio": [
|
|
343
|
+
"16:9",
|
|
344
|
+
"9:16",
|
|
345
|
+
"1:1"
|
|
346
|
+
],
|
|
347
|
+
"enable_sound": [
|
|
348
|
+
false
|
|
349
|
+
]
|
|
350
|
+
},
|
|
351
|
+
"when": {
|
|
352
|
+
"model": "kling-v3-omni-reference",
|
|
353
|
+
"source_task_id": {
|
|
354
|
+
"present": true
|
|
355
|
+
},
|
|
356
|
+
"reference_image_urls": {
|
|
357
|
+
"present": true
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
"required": [
|
|
361
|
+
"aspect_ratio"
|
|
362
|
+
]
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
"when": {
|
|
366
|
+
"model": "kling-v3-omni-reference",
|
|
367
|
+
"source_task_id": {
|
|
368
|
+
"present": false
|
|
369
|
+
},
|
|
370
|
+
"source_video_url": {
|
|
371
|
+
"present": false
|
|
372
|
+
}
|
|
373
|
+
},
|
|
374
|
+
"required_any": [
|
|
375
|
+
"source_video_url",
|
|
376
|
+
"source_task_id"
|
|
377
|
+
]
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
"when": {
|
|
381
|
+
"model": "kling-v3-omni-reference",
|
|
382
|
+
"source_video_url": {
|
|
383
|
+
"present": true
|
|
384
|
+
}
|
|
385
|
+
},
|
|
386
|
+
"forbidden": [
|
|
387
|
+
"source_task_id"
|
|
388
|
+
]
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
"when": {
|
|
392
|
+
"model": "kling-v3-omni-reference",
|
|
393
|
+
"source_task_id": {
|
|
394
|
+
"present": true
|
|
395
|
+
}
|
|
396
|
+
},
|
|
397
|
+
"forbidden": [
|
|
398
|
+
"source_video_url"
|
|
399
|
+
]
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
"enum": {
|
|
403
|
+
"aspect_ratio": [
|
|
404
|
+
"auto"
|
|
405
|
+
],
|
|
406
|
+
"enable_sound": [
|
|
407
|
+
false
|
|
408
|
+
],
|
|
409
|
+
"duration_seconds": [
|
|
410
|
+
5
|
|
411
|
+
]
|
|
412
|
+
},
|
|
413
|
+
"when": {
|
|
414
|
+
"model": "kling-v3-omni-reference",
|
|
415
|
+
"source_video_url": {
|
|
416
|
+
"present": true
|
|
417
|
+
},
|
|
418
|
+
"reference_image_urls": {
|
|
419
|
+
"present": false
|
|
420
|
+
}
|
|
421
|
+
},
|
|
422
|
+
"required": [
|
|
423
|
+
"aspect_ratio"
|
|
424
|
+
]
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
"enum": {
|
|
428
|
+
"aspect_ratio": [
|
|
429
|
+
"auto"
|
|
430
|
+
],
|
|
431
|
+
"enable_sound": [
|
|
432
|
+
false
|
|
433
|
+
],
|
|
434
|
+
"duration_seconds": [
|
|
435
|
+
5
|
|
436
|
+
]
|
|
437
|
+
},
|
|
438
|
+
"when": {
|
|
439
|
+
"model": "kling-v3-omni-reference",
|
|
440
|
+
"source_task_id": {
|
|
441
|
+
"present": true
|
|
442
|
+
},
|
|
443
|
+
"reference_image_urls": {
|
|
444
|
+
"present": false
|
|
445
|
+
}
|
|
446
|
+
},
|
|
447
|
+
"required": [
|
|
448
|
+
"aspect_ratio"
|
|
449
|
+
]
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
"enum": {
|
|
453
|
+
"aspect_ratio": [
|
|
454
|
+
"16:9",
|
|
455
|
+
"9:16",
|
|
456
|
+
"1:1"
|
|
457
|
+
],
|
|
458
|
+
"enable_sound": [
|
|
459
|
+
false
|
|
460
|
+
]
|
|
461
|
+
},
|
|
462
|
+
"when": {
|
|
463
|
+
"model": "kling-v3-omni-reference",
|
|
464
|
+
"source_video_url": {
|
|
465
|
+
"present": true
|
|
466
|
+
},
|
|
467
|
+
"reference_image_urls": {
|
|
468
|
+
"present": true
|
|
469
|
+
}
|
|
470
|
+
},
|
|
471
|
+
"required": [
|
|
472
|
+
"aspect_ratio"
|
|
473
|
+
]
|
|
474
|
+
}
|
|
475
|
+
]
|
|
476
|
+
},
|
|
113
477
|
"extend-video": {
|
|
114
478
|
"models": [
|
|
115
479
|
"kling-v2.5-turbo-image-to-video-pro",
|
|
@@ -578,6 +942,7 @@ var contract = {
|
|
|
578
942
|
"kling-v2.5-turbo-text-to-video-pro",
|
|
579
943
|
"kling-v2.6",
|
|
580
944
|
"kling-v3-omni",
|
|
945
|
+
"kling-v3-omni-reference",
|
|
581
946
|
"kling-v3-turbo-text-to-video"
|
|
582
947
|
],
|
|
583
948
|
"fields_by_model": {
|
|
@@ -770,6 +1135,55 @@ var contract = {
|
|
|
770
1135
|
"length": true
|
|
771
1136
|
}
|
|
772
1137
|
},
|
|
1138
|
+
"kling-v3-omni-reference": {
|
|
1139
|
+
"aspect_ratio": {
|
|
1140
|
+
"enum": [
|
|
1141
|
+
"16:9",
|
|
1142
|
+
"9:16",
|
|
1143
|
+
"1:1"
|
|
1144
|
+
],
|
|
1145
|
+
"required": true
|
|
1146
|
+
},
|
|
1147
|
+
"duration_seconds": {
|
|
1148
|
+
"enum": [
|
|
1149
|
+
3,
|
|
1150
|
+
4,
|
|
1151
|
+
5,
|
|
1152
|
+
6,
|
|
1153
|
+
7,
|
|
1154
|
+
8,
|
|
1155
|
+
9,
|
|
1156
|
+
10,
|
|
1157
|
+
11,
|
|
1158
|
+
12,
|
|
1159
|
+
13,
|
|
1160
|
+
14,
|
|
1161
|
+
15
|
|
1162
|
+
],
|
|
1163
|
+
"type": "integer"
|
|
1164
|
+
},
|
|
1165
|
+
"model": {
|
|
1166
|
+
"required": true
|
|
1167
|
+
},
|
|
1168
|
+
"output_resolution": {
|
|
1169
|
+
"enum": [
|
|
1170
|
+
"720p",
|
|
1171
|
+
"1080p",
|
|
1172
|
+
"4k"
|
|
1173
|
+
]
|
|
1174
|
+
},
|
|
1175
|
+
"prompt": {
|
|
1176
|
+
"required": true,
|
|
1177
|
+
"min": 1,
|
|
1178
|
+
"max": 2500,
|
|
1179
|
+
"length": true
|
|
1180
|
+
},
|
|
1181
|
+
"reference_image_urls": {
|
|
1182
|
+
"required": true,
|
|
1183
|
+
"min_items": 1,
|
|
1184
|
+
"max_items": 7
|
|
1185
|
+
}
|
|
1186
|
+
},
|
|
773
1187
|
"kling-v3-turbo-text-to-video": {
|
|
774
1188
|
"aspect_ratio": {
|
|
775
1189
|
"enum": [
|
|
@@ -1455,8 +1869,34 @@ var ExtendVideo = class {
|
|
|
1455
1869
|
}
|
|
1456
1870
|
};
|
|
1457
1871
|
|
|
1872
|
+
// src/resources/edit-video.ts
|
|
1873
|
+
var import_core7 = require("@runapi.ai/core");
|
|
1874
|
+
var import_internal6 = require("@runapi.ai/core/internal");
|
|
1875
|
+
var ENDPOINT6 = "/api/v1/kling/edit_video";
|
|
1876
|
+
var EditVideo = class {
|
|
1877
|
+
constructor(http) {
|
|
1878
|
+
this.http = http;
|
|
1879
|
+
}
|
|
1880
|
+
http;
|
|
1881
|
+
async run(params, options) {
|
|
1882
|
+
const { id } = await this.create(params, options);
|
|
1883
|
+
return (0, import_internal6.pollUntilComplete)(() => this.get(id, options), {
|
|
1884
|
+
maxWaitMs: options?.maxWaitMs,
|
|
1885
|
+
pollIntervalMs: options?.pollIntervalMs
|
|
1886
|
+
});
|
|
1887
|
+
}
|
|
1888
|
+
async create(params, options) {
|
|
1889
|
+
const body = (0, import_core7.compactParams)(params);
|
|
1890
|
+
(0, import_core7.validateParams)(contract["edit-video"], body);
|
|
1891
|
+
return this.http.request("POST", ENDPOINT6, { body, ...options });
|
|
1892
|
+
}
|
|
1893
|
+
async get(id, options) {
|
|
1894
|
+
return this.http.request("GET", `${ENDPOINT6}/${id}`, { ...options });
|
|
1895
|
+
}
|
|
1896
|
+
};
|
|
1897
|
+
|
|
1458
1898
|
// src/client.ts
|
|
1459
|
-
var KlingClient = class extends
|
|
1899
|
+
var KlingClient = class extends import_core8.BaseClient {
|
|
1460
1900
|
/** Text-to-video generation with multi-shot, sound, and Kling elements support on kling-3.0. */
|
|
1461
1901
|
textToVideo;
|
|
1462
1902
|
/** Image-to-video animation from a first-frame image guided by a text prompt. */
|
|
@@ -1466,6 +1906,8 @@ var KlingClient = class extends import_core7.BaseClient {
|
|
|
1466
1906
|
/** Transfer motion from a reference video onto a subject image. */
|
|
1467
1907
|
motionControl;
|
|
1468
1908
|
extendVideo;
|
|
1909
|
+
/** Edit a source video with the selected Kling v3 Omni model. */
|
|
1910
|
+
editVideo;
|
|
1469
1911
|
constructor(options = {}) {
|
|
1470
1912
|
super(options);
|
|
1471
1913
|
this.textToVideo = new TextToVideo(this.http);
|
|
@@ -1473,11 +1915,12 @@ var KlingClient = class extends import_core7.BaseClient {
|
|
|
1473
1915
|
this.aiAvatar = new AiAvatar(this.http);
|
|
1474
1916
|
this.motionControl = new MotionControl(this.http);
|
|
1475
1917
|
this.extendVideo = new ExtendVideo(this.http);
|
|
1918
|
+
this.editVideo = new EditVideo(this.http);
|
|
1476
1919
|
}
|
|
1477
1920
|
};
|
|
1478
1921
|
|
|
1479
1922
|
// src/index.ts
|
|
1480
|
-
var
|
|
1923
|
+
var import_core9 = require("@runapi.ai/core");
|
|
1481
1924
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1482
1925
|
0 && (module.exports = {
|
|
1483
1926
|
AuthenticationError,
|