@runapi.ai/kling 0.3.5 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +95 -57
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +95 -57
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -177,21 +177,6 @@ var contract = {
|
|
|
177
177
|
}
|
|
178
178
|
},
|
|
179
179
|
"rules": [
|
|
180
|
-
{
|
|
181
|
-
"when": {
|
|
182
|
-
"model": "kling-v3-omni-edit",
|
|
183
|
-
"source_task_id": {
|
|
184
|
-
"present": false
|
|
185
|
-
},
|
|
186
|
-
"source_video_url": {
|
|
187
|
-
"present": false
|
|
188
|
-
}
|
|
189
|
-
},
|
|
190
|
-
"required_any": [
|
|
191
|
-
"source_video_url",
|
|
192
|
-
"source_task_id"
|
|
193
|
-
]
|
|
194
|
-
},
|
|
195
180
|
{
|
|
196
181
|
"when": {
|
|
197
182
|
"model": "kling-v3-omni-edit",
|
|
@@ -300,6 +285,45 @@ var contract = {
|
|
|
300
285
|
"aspect_ratio"
|
|
301
286
|
]
|
|
302
287
|
},
|
|
288
|
+
{
|
|
289
|
+
"when": {
|
|
290
|
+
"model": "kling-v3-omni-edit",
|
|
291
|
+
"source_task_id": {
|
|
292
|
+
"present": false
|
|
293
|
+
},
|
|
294
|
+
"source_video_url": {
|
|
295
|
+
"present": false
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
"required_any": [
|
|
299
|
+
"source_video_url",
|
|
300
|
+
"source_task_id"
|
|
301
|
+
]
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
"enum": {
|
|
305
|
+
"aspect_ratio": [
|
|
306
|
+
"16:9",
|
|
307
|
+
"9:16",
|
|
308
|
+
"1:1"
|
|
309
|
+
],
|
|
310
|
+
"enable_sound": [
|
|
311
|
+
false
|
|
312
|
+
]
|
|
313
|
+
},
|
|
314
|
+
"when": {
|
|
315
|
+
"model": "kling-v3-omni-reference",
|
|
316
|
+
"source_task_id": {
|
|
317
|
+
"present": true
|
|
318
|
+
},
|
|
319
|
+
"reference_image_urls": {
|
|
320
|
+
"present": true
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
"required": [
|
|
324
|
+
"aspect_ratio"
|
|
325
|
+
]
|
|
326
|
+
},
|
|
303
327
|
{
|
|
304
328
|
"when": {
|
|
305
329
|
"model": "kling-v3-omni-reference",
|
|
@@ -410,30 +434,6 @@ var contract = {
|
|
|
410
434
|
"required": [
|
|
411
435
|
"aspect_ratio"
|
|
412
436
|
]
|
|
413
|
-
},
|
|
414
|
-
{
|
|
415
|
-
"enum": {
|
|
416
|
-
"aspect_ratio": [
|
|
417
|
-
"16:9",
|
|
418
|
-
"9:16",
|
|
419
|
-
"1:1"
|
|
420
|
-
],
|
|
421
|
-
"enable_sound": [
|
|
422
|
-
false
|
|
423
|
-
]
|
|
424
|
-
},
|
|
425
|
-
"when": {
|
|
426
|
-
"model": "kling-v3-omni-reference",
|
|
427
|
-
"source_task_id": {
|
|
428
|
-
"present": true
|
|
429
|
-
},
|
|
430
|
-
"reference_image_urls": {
|
|
431
|
-
"present": true
|
|
432
|
-
}
|
|
433
|
-
},
|
|
434
|
-
"required": [
|
|
435
|
-
"aspect_ratio"
|
|
436
|
-
]
|
|
437
437
|
}
|
|
438
438
|
]
|
|
439
439
|
},
|
|
@@ -776,6 +776,17 @@ var contract = {
|
|
|
776
776
|
"preserve_reference_video_audio"
|
|
777
777
|
]
|
|
778
778
|
},
|
|
779
|
+
{
|
|
780
|
+
"enum": {
|
|
781
|
+
"enable_sound": [
|
|
782
|
+
false
|
|
783
|
+
]
|
|
784
|
+
},
|
|
785
|
+
"when": {
|
|
786
|
+
"mode": "std",
|
|
787
|
+
"model": "kling-v2.6"
|
|
788
|
+
}
|
|
789
|
+
},
|
|
779
790
|
{
|
|
780
791
|
"when": {
|
|
781
792
|
"model": "kling-v2.6"
|
|
@@ -790,6 +801,19 @@ var contract = {
|
|
|
790
801
|
"preserve_reference_video_audio"
|
|
791
802
|
]
|
|
792
803
|
},
|
|
804
|
+
{
|
|
805
|
+
"enum": {
|
|
806
|
+
"enable_sound": [
|
|
807
|
+
false
|
|
808
|
+
]
|
|
809
|
+
},
|
|
810
|
+
"when": {
|
|
811
|
+
"mode": {
|
|
812
|
+
"present": false
|
|
813
|
+
},
|
|
814
|
+
"model": "kling-v2.6"
|
|
815
|
+
}
|
|
816
|
+
},
|
|
793
817
|
{
|
|
794
818
|
"when": {
|
|
795
819
|
"model": "kling-v3-omni"
|
|
@@ -847,7 +871,8 @@ var contract = {
|
|
|
847
871
|
"enum": [
|
|
848
872
|
"720p",
|
|
849
873
|
"1080p"
|
|
850
|
-
]
|
|
874
|
+
],
|
|
875
|
+
"required": true
|
|
851
876
|
},
|
|
852
877
|
"reference_video_url": {
|
|
853
878
|
"required": true
|
|
@@ -1260,6 +1285,30 @@ var contract = {
|
|
|
1260
1285
|
"preserve_reference_video_audio"
|
|
1261
1286
|
]
|
|
1262
1287
|
},
|
|
1288
|
+
{
|
|
1289
|
+
"enum": {
|
|
1290
|
+
"enable_sound": [
|
|
1291
|
+
false
|
|
1292
|
+
]
|
|
1293
|
+
},
|
|
1294
|
+
"when": {
|
|
1295
|
+
"mode": "std",
|
|
1296
|
+
"model": "kling-v2.6"
|
|
1297
|
+
}
|
|
1298
|
+
},
|
|
1299
|
+
{
|
|
1300
|
+
"enum": {
|
|
1301
|
+
"enable_sound": [
|
|
1302
|
+
false
|
|
1303
|
+
]
|
|
1304
|
+
},
|
|
1305
|
+
"when": {
|
|
1306
|
+
"mode": {
|
|
1307
|
+
"present": false
|
|
1308
|
+
},
|
|
1309
|
+
"model": "kling-v2.6"
|
|
1310
|
+
}
|
|
1311
|
+
},
|
|
1263
1312
|
{
|
|
1264
1313
|
"when": {
|
|
1265
1314
|
"model": "kling-v3-omni"
|
|
@@ -1513,7 +1562,6 @@ function parseIpv6Half(value) {
|
|
|
1513
1562
|
|
|
1514
1563
|
// src/resources/text-to-video.ts
|
|
1515
1564
|
var ENDPOINT = "/api/v1/kling/text_to_video";
|
|
1516
|
-
var V26_MODEL = "kling-v2.6";
|
|
1517
1565
|
var V3_TURBO_MODEL = "kling-v3-turbo-text-to-video";
|
|
1518
1566
|
var V3_TURBO_UNSUPPORTED_FIELDS = [
|
|
1519
1567
|
"enable_sound",
|
|
@@ -1554,7 +1602,6 @@ var TextToVideo = class {
|
|
|
1554
1602
|
const body = compactParams(params);
|
|
1555
1603
|
rejectUnsupportedV3TurboFields(body);
|
|
1556
1604
|
validateParams(contract["text-to-video"], body);
|
|
1557
|
-
validateV26Params(body);
|
|
1558
1605
|
validateKlingO1References(body);
|
|
1559
1606
|
return this.http.request("POST", ENDPOINT, {
|
|
1560
1607
|
body,
|
|
@@ -1573,12 +1620,6 @@ var TextToVideo = class {
|
|
|
1573
1620
|
});
|
|
1574
1621
|
}
|
|
1575
1622
|
};
|
|
1576
|
-
function validateV26Params(body) {
|
|
1577
|
-
if (body.model !== V26_MODEL) return;
|
|
1578
|
-
if (body.enable_sound === true && body.mode !== "pro") {
|
|
1579
|
-
throw new ValidationError2(`enable_sound requires mode pro for ${V26_MODEL}`);
|
|
1580
|
-
}
|
|
1581
|
-
}
|
|
1582
1623
|
function rejectUnsupportedV3TurboFields(body) {
|
|
1583
1624
|
if (body.model !== V3_TURBO_MODEL) return;
|
|
1584
1625
|
const field = V3_TURBO_UNSUPPORTED_FIELDS.find((candidate) => fieldPresent(body, candidate));
|
|
@@ -1606,7 +1647,7 @@ function presentValue(value) {
|
|
|
1606
1647
|
import { ValidationError as ValidationError3, compactParams as compactParams2, validateParams as validateParams2 } from "@runapi.ai/core";
|
|
1607
1648
|
import { pollUntilComplete as pollUntilComplete2 } from "@runapi.ai/core/internal";
|
|
1608
1649
|
var ENDPOINT2 = "/api/v1/kling/image_to_video";
|
|
1609
|
-
var
|
|
1650
|
+
var V26_MODEL = "kling-v2.6";
|
|
1610
1651
|
var V3_OMNI_MODEL = "kling-v3-omni";
|
|
1611
1652
|
var V3_TURBO_MODEL2 = "kling-v3-turbo-image-to-video";
|
|
1612
1653
|
var V3_TURBO_UNSUPPORTED_FIELDS2 = [
|
|
@@ -1644,7 +1685,7 @@ var ImageToVideo = class {
|
|
|
1644
1685
|
const body = compactParams2(params);
|
|
1645
1686
|
rejectUnsupportedV3TurboFields2(body);
|
|
1646
1687
|
validateParams2(contract["image-to-video"], body);
|
|
1647
|
-
|
|
1688
|
+
validateV26Params(body);
|
|
1648
1689
|
validateV3OmniFields(body);
|
|
1649
1690
|
validateKlingO1References(body);
|
|
1650
1691
|
return this.http.request("POST", ENDPOINT2, {
|
|
@@ -1664,17 +1705,14 @@ var ImageToVideo = class {
|
|
|
1664
1705
|
});
|
|
1665
1706
|
}
|
|
1666
1707
|
};
|
|
1667
|
-
function
|
|
1668
|
-
if (body.model !==
|
|
1669
|
-
if (body.enable_sound === true && body.mode !== "pro") {
|
|
1670
|
-
throw new ValidationError3(`enable_sound requires mode pro for ${V26_MODEL2}`);
|
|
1671
|
-
}
|
|
1708
|
+
function validateV26Params(body) {
|
|
1709
|
+
if (body.model !== V26_MODEL) return;
|
|
1672
1710
|
if (!fieldPresent2(body, "last_frame_image_url")) return;
|
|
1673
1711
|
if (body.mode !== "pro") {
|
|
1674
|
-
throw new ValidationError3(`last_frame_image_url requires mode pro for ${
|
|
1712
|
+
throw new ValidationError3(`last_frame_image_url requires mode pro for ${V26_MODEL}`);
|
|
1675
1713
|
}
|
|
1676
1714
|
if (body.duration_seconds !== void 0 && body.duration_seconds !== 5) {
|
|
1677
|
-
throw new ValidationError3(`last_frame_image_url requires duration_seconds 5 for ${
|
|
1715
|
+
throw new ValidationError3(`last_frame_image_url requires duration_seconds 5 for ${V26_MODEL}`);
|
|
1678
1716
|
}
|
|
1679
1717
|
}
|
|
1680
1718
|
function validateV3OmniFields(body) {
|