@picsart/ai-sdk 6.44.0 → 6.45.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/index.d.ts +25 -0
- package/index.js +131 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1034,6 +1034,29 @@ type ModelInputById = {
|
|
|
1034
1034
|
resolution?: "720p" | "1080p";
|
|
1035
1035
|
startFrame?: string;
|
|
1036
1036
|
};
|
|
1037
|
+
"kling-v4": {
|
|
1038
|
+
prompt: string;
|
|
1039
|
+
aspectRatio?: "16:9" | "9:16" | "1:1" | "21:9";
|
|
1040
|
+
duration?: number;
|
|
1041
|
+
resolution?: "720p" | "1080p";
|
|
1042
|
+
startFrame?: string;
|
|
1043
|
+
imageUrls?: string[];
|
|
1044
|
+
endFrame?: string;
|
|
1045
|
+
};
|
|
1046
|
+
"kling-v4-omni": {
|
|
1047
|
+
prompt: string;
|
|
1048
|
+
aspectRatio?: "16:9" | "9:16" | "1:1" | "21:9" | "adaptive";
|
|
1049
|
+
duration?: number;
|
|
1050
|
+
resolution?: "720p" | "1080p";
|
|
1051
|
+
startFrame?: string;
|
|
1052
|
+
endFrame?: string;
|
|
1053
|
+
imageUrls?: string[];
|
|
1054
|
+
videoUrl?: string;
|
|
1055
|
+
referType?: "feature" | "base";
|
|
1056
|
+
elementList?: Array<{
|
|
1057
|
+
element_id: string;
|
|
1058
|
+
}>;
|
|
1059
|
+
};
|
|
1037
1060
|
"kling-video-effects": {
|
|
1038
1061
|
templateId?: string;
|
|
1039
1062
|
imageUrls: [string, ...string[]];
|
|
@@ -3661,6 +3684,8 @@ declare const Models: {
|
|
|
3661
3684
|
readonly KlingV3: "kling-v3";
|
|
3662
3685
|
readonly KlingV3Omni: "kling-v3-omni";
|
|
3663
3686
|
readonly KlingV3Turbo: "kling-v3-turbo";
|
|
3687
|
+
readonly KlingV4: "kling-v4";
|
|
3688
|
+
readonly KlingV4Omni: "kling-v4-omni";
|
|
3664
3689
|
readonly KlingVideoEffects: "kling-video-effects";
|
|
3665
3690
|
readonly KlingVideoO1: "kling-video-o1";
|
|
3666
3691
|
readonly Ltx23A2v: "ltx-2.3-a2v";
|
package/index.js
CHANGED
|
@@ -1425,10 +1425,25 @@ var klingOmniAdvancedParams = {
|
|
|
1425
1425
|
}
|
|
1426
1426
|
}
|
|
1427
1427
|
};
|
|
1428
|
+
var klingV4OmniElementList = {
|
|
1429
|
+
elementList: {
|
|
1430
|
+
label: "Element References",
|
|
1431
|
+
descriptor: {
|
|
1432
|
+
kind: "object",
|
|
1433
|
+
array: { max: 7 },
|
|
1434
|
+
fields: {
|
|
1435
|
+
element_id: { kind: "text" }
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
};
|
|
1428
1440
|
|
|
1429
1441
|
// src/vendors/catalog/kling/index.ts
|
|
1430
1442
|
var V3_DURATION = { min: 3, max: 15 };
|
|
1431
1443
|
var V26_DURATIONS = [5, 10];
|
|
1444
|
+
var V4_DURATION = { min: 3, max: 30 };
|
|
1445
|
+
var V4_PROMPT_MAX = 26e3;
|
|
1446
|
+
var V4_MAX_MIDDLE_FRAMES = 8;
|
|
1432
1447
|
var KLING_IMAGE_AR = ["16:9", "9:16", "1:1", "21:9", "4:3", "3:2", "2:3", "3:4"];
|
|
1433
1448
|
var klingV3ProVideoBase = {
|
|
1434
1449
|
workflow: "kling-text-to-video",
|
|
@@ -1470,6 +1485,27 @@ var klingV3TurboVideoBase = {
|
|
|
1470
1485
|
...params.startFrame("Start Frame")
|
|
1471
1486
|
}
|
|
1472
1487
|
};
|
|
1488
|
+
var klingV4VideoBase = {
|
|
1489
|
+
workflow: "kling-text-to-video",
|
|
1490
|
+
editWorkflow: "kling-image-to-video",
|
|
1491
|
+
mode: "video",
|
|
1492
|
+
inputType: "t2v",
|
|
1493
|
+
features: [
|
|
1494
|
+
feat("Image Input", "input"),
|
|
1495
|
+
feat("Start/Middle/End Frames", "frame"),
|
|
1496
|
+
feat("1080p", "resolution"),
|
|
1497
|
+
feat("30 sec", "duration")
|
|
1498
|
+
],
|
|
1499
|
+
paramConfig: {
|
|
1500
|
+
...params.prompt({ maxLength: V4_PROMPT_MAX }),
|
|
1501
|
+
...params.aspectRatio(["16:9", "9:16", "1:1", "21:9"]),
|
|
1502
|
+
...params.durationRange(V4_DURATION.min, V4_DURATION.max, 5),
|
|
1503
|
+
...params.resolution(["720p", "1080p"], "720p"),
|
|
1504
|
+
...params.startFrame("Start Frame"),
|
|
1505
|
+
...params.imageInput(V4_MAX_MIDDLE_FRAMES, "Middle Frames", false, "asset"),
|
|
1506
|
+
...params.endFrame("End Frame")
|
|
1507
|
+
}
|
|
1508
|
+
};
|
|
1473
1509
|
var klingV26VideoBase = {
|
|
1474
1510
|
...klingV3ProVideoBase,
|
|
1475
1511
|
features: [
|
|
@@ -1523,6 +1559,28 @@ var { MODELS } = defineModels("kling", [
|
|
|
1523
1559
|
badge: ["new"],
|
|
1524
1560
|
description: "Faster V3 variant \u2014 long-form video up to 15s with native audio, start/end frame control, and 720p/1080p output."
|
|
1525
1561
|
},
|
|
1562
|
+
// ── Video: Kling 4.0 (resolution-tiered T2V + keyframe I2V) ───────
|
|
1563
|
+
{
|
|
1564
|
+
...klingV4VideoBase,
|
|
1565
|
+
id: "kling-v4",
|
|
1566
|
+
name: "Kling 4.0",
|
|
1567
|
+
modelId: "kling-v4",
|
|
1568
|
+
addedAt: "2026-10-16",
|
|
1569
|
+
// Observed on the vendor (2026-10-16): ~3-5 min for 5s, ~7 min for 30s.
|
|
1570
|
+
estimatedTime: 240,
|
|
1571
|
+
editEstimatedTime: 240,
|
|
1572
|
+
badge: ["new"],
|
|
1573
|
+
description: "Kling 4.0 \u2014 video up to 30s at 720p or 1080p, with start, middle and end keyframes.",
|
|
1574
|
+
constraints: [
|
|
1575
|
+
// Worker: image-to-video needs the start frame (`image`); middle and
|
|
1576
|
+
// end frames are added around it. (Raw API callers may instead pass the
|
|
1577
|
+
// start frame as imageUrls[0] — the builder handles that.)
|
|
1578
|
+
{ when: { startFrame: { exists: false } }, then: {
|
|
1579
|
+
imageUrls: { disabled: true, reason: "Middle frames require a start frame." },
|
|
1580
|
+
endFrame: { disabled: true, reason: "End frame requires a start frame." }
|
|
1581
|
+
} }
|
|
1582
|
+
]
|
|
1583
|
+
},
|
|
1526
1584
|
// ── Video: Kling V2.6 (consolidated: std/pro via renderingSpeed) ──
|
|
1527
1585
|
{
|
|
1528
1586
|
...klingV26VideoBase,
|
|
@@ -1585,6 +1643,37 @@ var { MODELS } = defineModels("kling", [
|
|
|
1585
1643
|
} }
|
|
1586
1644
|
]
|
|
1587
1645
|
},
|
|
1646
|
+
// ── Video: Kling 4.0 Omni (dedicated /omni-video/kling-4.0 tasks API) ──
|
|
1647
|
+
{
|
|
1648
|
+
id: "kling-v4-omni",
|
|
1649
|
+
name: "Kling 4.0 Omni",
|
|
1650
|
+
modelId: "kling-v4-omni",
|
|
1651
|
+
addedAt: "2026-10-16",
|
|
1652
|
+
workflow: "kling-omni-video",
|
|
1653
|
+
// Observed on the vendor (2026-10-16): ~2.5-5.5 min for 5s.
|
|
1654
|
+
estimatedTime: 240,
|
|
1655
|
+
mode: "video",
|
|
1656
|
+
inputType: "t2v",
|
|
1657
|
+
badge: ["new"],
|
|
1658
|
+
description: "Kling 4.0 Omni \u2014 up to 30s at 720p or 1080p from text, frames, reference images, a reference or base video, and elements.",
|
|
1659
|
+
features: [feat("Image + Video Input", "input"), feat("1080p", "resolution"), feat("30 sec", "duration")],
|
|
1660
|
+
// Same slot layout as kling-v3-omni (payloads.ts folds them into
|
|
1661
|
+
// image_list / video_list), minus what the 4.0 API dropped: no audio,
|
|
1662
|
+
// mode tiers, multi-shot or keep_original_sound.
|
|
1663
|
+
paramConfig: {
|
|
1664
|
+
...params.prompt({ maxLength: V4_PROMPT_MAX }),
|
|
1665
|
+
...params.aspectRatio(["16:9", "9:16", "1:1", "21:9", "adaptive"]),
|
|
1666
|
+
...params.durationRange(V4_DURATION.min, V4_DURATION.max, 5),
|
|
1667
|
+
...params.resolution(["720p", "1080p"], "720p"),
|
|
1668
|
+
...params.startFrame("First Frame"),
|
|
1669
|
+
...params.endFrame("End Frame"),
|
|
1670
|
+
// Vendor cap: 10 images in total — 2 frame slots + 8 reference images.
|
|
1671
|
+
...params.imageInput(8, "Reference Images"),
|
|
1672
|
+
...params.videoInput("Reference Video", "reference", false),
|
|
1673
|
+
...klingOmniReferType,
|
|
1674
|
+
...klingV4OmniElementList
|
|
1675
|
+
}
|
|
1676
|
+
},
|
|
1588
1677
|
{
|
|
1589
1678
|
id: "kling-video-o1",
|
|
1590
1679
|
name: "Kling Video O1",
|
|
@@ -1990,6 +2079,23 @@ var buildKlingV3TurboPayload = (input) => ({
|
|
|
1990
2079
|
resolution: input.resolution ?? "720p",
|
|
1991
2080
|
...input.startFrame ? { image: input.startFrame } : {}
|
|
1992
2081
|
});
|
|
2082
|
+
var buildKlingV4Payload = (input) => {
|
|
2083
|
+
const startFrame = input.startFrame || input.imageUrls?.[0];
|
|
2084
|
+
const middleFrames = (input.startFrame ? input.imageUrls : input.imageUrls?.slice(1)) ?? [];
|
|
2085
|
+
if (input.endFrame && !startFrame) {
|
|
2086
|
+
throw new ApiError("Kling 4.0: an end frame requires a start frame.", { status: 400, code: "validation_error" });
|
|
2087
|
+
}
|
|
2088
|
+
return {
|
|
2089
|
+
prompt: input.prompt,
|
|
2090
|
+
aspect_ratio: input.aspectRatio ?? "16:9",
|
|
2091
|
+
duration: String(input.duration ?? 5),
|
|
2092
|
+
model_name: "kling-v4",
|
|
2093
|
+
resolution: input.resolution ?? "720p",
|
|
2094
|
+
...startFrame ? { image: startFrame } : {},
|
|
2095
|
+
...middleFrames.length > 0 ? { image_middle: middleFrames } : {},
|
|
2096
|
+
...input.endFrame ? { image_tail: input.endFrame } : {}
|
|
2097
|
+
};
|
|
2098
|
+
};
|
|
1993
2099
|
var buildKlingV26Payload = (input) => {
|
|
1994
2100
|
const hasEndFrame = !!(input.startFrame && input.endFrame);
|
|
1995
2101
|
const hasSound = (input.generateAudio ?? true) && !hasEndFrame;
|
|
@@ -2041,6 +2147,24 @@ var buildOmniV3 = (input) => {
|
|
|
2041
2147
|
...hasSound ? { sound: "on" } : {}
|
|
2042
2148
|
};
|
|
2043
2149
|
};
|
|
2150
|
+
var buildOmniV4 = (input) => {
|
|
2151
|
+
const imageList = [
|
|
2152
|
+
...input.startFrame ? [{ image_url: input.startFrame, type: "first_frame" }] : [],
|
|
2153
|
+
...input.endFrame ? [{ image_url: input.endFrame, type: "end_frame" }] : [],
|
|
2154
|
+
...(input.imageUrls ?? []).map((image_url) => ({ image_url }))
|
|
2155
|
+
];
|
|
2156
|
+
const videoList = input.videoUrl ? [{ video_url: input.videoUrl, refer_type: input.referType ?? "feature" }] : [];
|
|
2157
|
+
return {
|
|
2158
|
+
prompt: input.prompt,
|
|
2159
|
+
model_name: "kling-v4-omni",
|
|
2160
|
+
aspect_ratio: input.aspectRatio ?? "16:9",
|
|
2161
|
+
duration: String(input.duration ?? 5),
|
|
2162
|
+
resolution: input.resolution ?? "720p",
|
|
2163
|
+
...imageList.length ? { image_list: imageList } : {},
|
|
2164
|
+
...videoList.length ? { video_list: videoList } : {},
|
|
2165
|
+
...stringElementList(input.elementList)
|
|
2166
|
+
};
|
|
2167
|
+
};
|
|
2044
2168
|
var buildVideoO1 = (input) => {
|
|
2045
2169
|
const hasSound = input.generateAudio ?? true;
|
|
2046
2170
|
return {
|
|
@@ -2160,9 +2284,11 @@ registerPayloads(MODELS, {
|
|
|
2160
2284
|
// Combined-entry video — primary slot
|
|
2161
2285
|
"kling-v3": klingV3Builder,
|
|
2162
2286
|
"kling-v3-turbo": buildKlingV3TurboPayload,
|
|
2287
|
+
"kling-v4": buildKlingV4Payload,
|
|
2163
2288
|
"kling-v2-6": buildKlingV26Payload,
|
|
2164
2289
|
// Omni video
|
|
2165
2290
|
"kling-v3-omni": buildOmniV3,
|
|
2291
|
+
"kling-v4-omni": buildOmniV4,
|
|
2166
2292
|
"kling-video-o1": buildVideoO1,
|
|
2167
2293
|
// Motion control
|
|
2168
2294
|
"kling-motion-control-v3": buildMotionControl("kling-v3"),
|
|
@@ -2187,6 +2313,7 @@ registerPayloads(MODELS, {
|
|
|
2187
2313
|
registerEditPayloads(MODELS, {
|
|
2188
2314
|
"kling-v3": klingV3Builder,
|
|
2189
2315
|
"kling-v3-turbo": buildKlingV3TurboPayload,
|
|
2316
|
+
"kling-v4": buildKlingV4Payload,
|
|
2190
2317
|
"kling-v2-6": buildKlingV26Payload
|
|
2191
2318
|
});
|
|
2192
2319
|
|
|
@@ -15221,6 +15348,8 @@ var KlingV2a = "kling-v2a";
|
|
|
15221
15348
|
var KlingV3 = "kling-v3";
|
|
15222
15349
|
var KlingV3Omni = "kling-v3-omni";
|
|
15223
15350
|
var KlingV3Turbo = "kling-v3-turbo";
|
|
15351
|
+
var KlingV4 = "kling-v4";
|
|
15352
|
+
var KlingV4Omni = "kling-v4-omni";
|
|
15224
15353
|
var KlingVideoEffects = "kling-video-effects";
|
|
15225
15354
|
var KlingVideoO1 = "kling-video-o1";
|
|
15226
15355
|
var Ltx23A2v = "ltx-2.3-a2v";
|
|
@@ -15492,6 +15621,8 @@ var Models = {
|
|
|
15492
15621
|
KlingV3,
|
|
15493
15622
|
KlingV3Omni,
|
|
15494
15623
|
KlingV3Turbo,
|
|
15624
|
+
KlingV4,
|
|
15625
|
+
KlingV4Omni,
|
|
15495
15626
|
KlingVideoEffects,
|
|
15496
15627
|
KlingVideoO1,
|
|
15497
15628
|
Ltx23A2v,
|