@picsart/ai-sdk 5.11.0 → 5.13.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 +9 -9
- package/index.js +94 -73
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -68,6 +68,9 @@ type ModelInputById = {
|
|
|
68
68
|
prompt?: string;
|
|
69
69
|
imageUrls: [string, ...string[]];
|
|
70
70
|
audioUrl: string;
|
|
71
|
+
resolution?: "720p" | "1080p";
|
|
72
|
+
turboMode?: boolean;
|
|
73
|
+
seed?: number;
|
|
71
74
|
};
|
|
72
75
|
"bytedance-video-enhance": {
|
|
73
76
|
videoUrl: string;
|
|
@@ -612,6 +615,12 @@ type ModelInputById = {
|
|
|
612
615
|
resolution?: "720p" | "1080p" | "4k";
|
|
613
616
|
renderingSpeed?: "std" | "pro";
|
|
614
617
|
generateAudio?: boolean;
|
|
618
|
+
startFrame?: string;
|
|
619
|
+
endFrame?: string;
|
|
620
|
+
imageUrls?: string[];
|
|
621
|
+
videoUrl?: string;
|
|
622
|
+
referType?: "feature" | "base";
|
|
623
|
+
keepOriginalSound?: "yes" | "no";
|
|
615
624
|
multiShot?: boolean;
|
|
616
625
|
shotType?: "customize";
|
|
617
626
|
multiPrompt?: Array<{
|
|
@@ -619,15 +628,6 @@ type ModelInputById = {
|
|
|
619
628
|
prompt: string;
|
|
620
629
|
duration: string;
|
|
621
630
|
}>;
|
|
622
|
-
omniImageList?: Array<{
|
|
623
|
-
image_url: string;
|
|
624
|
-
type?: "first_frame" | "end_frame";
|
|
625
|
-
}>;
|
|
626
|
-
omniVideoList?: Array<{
|
|
627
|
-
video_url: string;
|
|
628
|
-
refer_type: "feature" | "base";
|
|
629
|
-
keep_original_sound: "yes" | "no";
|
|
630
|
-
}>;
|
|
631
631
|
elementList?: Array<{
|
|
632
632
|
element_id: string;
|
|
633
633
|
}>;
|
package/index.js
CHANGED
|
@@ -1318,6 +1318,20 @@ var klingKeepOriginalSound = {
|
|
|
1318
1318
|
}
|
|
1319
1319
|
}
|
|
1320
1320
|
};
|
|
1321
|
+
var klingOmniReferType = {
|
|
1322
|
+
referType: {
|
|
1323
|
+
label: "Reference Video Mode",
|
|
1324
|
+
descriptor: {
|
|
1325
|
+
kind: "enum",
|
|
1326
|
+
valueType: "string",
|
|
1327
|
+
options: [
|
|
1328
|
+
{ id: "feature", label: "Feature Reference" },
|
|
1329
|
+
{ id: "base", label: "Base Edit" }
|
|
1330
|
+
],
|
|
1331
|
+
default: "feature"
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
};
|
|
1321
1335
|
var klingV3AdvancedParams = {
|
|
1322
1336
|
multiShot: {
|
|
1323
1337
|
label: "Multi-Shot Mode",
|
|
@@ -1405,54 +1419,6 @@ var klingOmniAdvancedParams = {
|
|
|
1405
1419
|
}
|
|
1406
1420
|
}
|
|
1407
1421
|
},
|
|
1408
|
-
omniImageList: {
|
|
1409
|
-
label: "Reference Images",
|
|
1410
|
-
descriptor: {
|
|
1411
|
-
kind: "object",
|
|
1412
|
-
array: { max: 10 },
|
|
1413
|
-
fields: {
|
|
1414
|
-
image_url: { kind: "text" },
|
|
1415
|
-
type: {
|
|
1416
|
-
kind: "enum",
|
|
1417
|
-
required: false,
|
|
1418
|
-
valueType: "string",
|
|
1419
|
-
options: [
|
|
1420
|
-
{ id: "first_frame", label: "First Frame" },
|
|
1421
|
-
{ id: "end_frame", label: "End Frame" }
|
|
1422
|
-
],
|
|
1423
|
-
default: "first_frame"
|
|
1424
|
-
}
|
|
1425
|
-
}
|
|
1426
|
-
}
|
|
1427
|
-
},
|
|
1428
|
-
omniVideoList: {
|
|
1429
|
-
label: "Reference Video",
|
|
1430
|
-
descriptor: {
|
|
1431
|
-
kind: "object",
|
|
1432
|
-
array: { max: 1 },
|
|
1433
|
-
fields: {
|
|
1434
|
-
video_url: { kind: "text" },
|
|
1435
|
-
// refer_type / keep_original_sound stay required — upstream
|
|
1436
|
-
// ReferenceVideo marks both required. Descriptor defaults are
|
|
1437
|
-
// informational only until upstream relaxes the wire contract.
|
|
1438
|
-
refer_type: {
|
|
1439
|
-
kind: "enum",
|
|
1440
|
-
valueType: "string",
|
|
1441
|
-
options: [
|
|
1442
|
-
{ id: "feature", label: "Feature Reference" },
|
|
1443
|
-
{ id: "base", label: "Base Edit" }
|
|
1444
|
-
],
|
|
1445
|
-
default: "feature"
|
|
1446
|
-
},
|
|
1447
|
-
keep_original_sound: {
|
|
1448
|
-
kind: "enum",
|
|
1449
|
-
valueType: "string",
|
|
1450
|
-
options: [{ id: "yes", label: "Yes" }, { id: "no", label: "No" }],
|
|
1451
|
-
default: "yes"
|
|
1452
|
-
}
|
|
1453
|
-
}
|
|
1454
|
-
}
|
|
1455
|
-
},
|
|
1456
1422
|
elementList: {
|
|
1457
1423
|
label: "Element References",
|
|
1458
1424
|
descriptor: {
|
|
@@ -1564,7 +1530,11 @@ var { MODELS } = defineModels("kling", [
|
|
|
1564
1530
|
badge: ["popular", "premium"],
|
|
1565
1531
|
description: "Long-form video up to 15s with native audio and start/end frame control.",
|
|
1566
1532
|
constraints: [
|
|
1567
|
-
{ when: { renderingSpeed: { is: "std" } }, then: { endFrame: { disabled: true, reason: "End frame requires Pro or 4K mode." } } }
|
|
1533
|
+
{ when: { renderingSpeed: { is: "std" } }, then: { endFrame: { disabled: true, reason: "End frame requires Pro or 4K mode." } } },
|
|
1534
|
+
// Backend: `voice_list` requires `sound=on`. Two rules because the
|
|
1535
|
+
// `is` operator does not match an unset value (see core/constraints.ts).
|
|
1536
|
+
{ when: { generateAudio: { is: false } }, then: { voiceList: { disabled: true, reason: "Voice references require generated audio." } } },
|
|
1537
|
+
{ when: { generateAudio: { exists: false } }, then: { voiceList: { disabled: true, reason: "Voice references require generated audio." } } }
|
|
1568
1538
|
]
|
|
1569
1539
|
},
|
|
1570
1540
|
// ── Video: Kling V3 Turbo (resolution-tiered T2V + I2V) ───────────
|
|
@@ -1600,7 +1570,12 @@ var { MODELS } = defineModels("kling", [
|
|
|
1600
1570
|
mode: "video",
|
|
1601
1571
|
inputType: "t2v",
|
|
1602
1572
|
description: "Flexible generation across creative styles using V3 Omni architecture, with optional 4K output.",
|
|
1603
|
-
features: [feat("4K", "resolution"), feat("15 sec", "duration")],
|
|
1573
|
+
features: [feat("Image + Video Input", "input"), feat("4K", "resolution"), feat("15 sec", "duration")],
|
|
1574
|
+
// The omni task accepts reference media on the SAME workflow (no
|
|
1575
|
+
// editWorkflow): `image_list` carries the optional first/end frames plus
|
|
1576
|
+
// plain reference images, `video_list` carries a single reference clip.
|
|
1577
|
+
// They are declared here as real file slots so `hasFileInput()` sees them
|
|
1578
|
+
// and the app renders upload targets; payloads.ts assembles the arrays.
|
|
1604
1579
|
paramConfig: {
|
|
1605
1580
|
...params.prompt({ maxLength: 2500 }),
|
|
1606
1581
|
...params.aspectRatio(["16:9", "9:16", "1:1"]),
|
|
@@ -1608,8 +1583,24 @@ var { MODELS } = defineModels("kling", [
|
|
|
1608
1583
|
...params.resolution(["720p", "1080p", "4k"], "720p"),
|
|
1609
1584
|
...params.renderingSpeed([{ id: "std", label: "Standard" }, { id: "pro", label: "Pro" }], "std"),
|
|
1610
1585
|
...params.generateAudio(false),
|
|
1586
|
+
...params.startFrame("First Frame"),
|
|
1587
|
+
...params.endFrame("End Frame"),
|
|
1588
|
+
// Backend states no explicit cap for omni `image_list`; 10 mirrors the
|
|
1589
|
+
// omni-image contract. The worker stays the authoritative gate.
|
|
1590
|
+
...params.imageInput(10, "Reference Images"),
|
|
1591
|
+
...params.videoInput("Reference Video", "reference", false),
|
|
1592
|
+
...klingOmniReferType,
|
|
1593
|
+
...klingKeepOriginalSound,
|
|
1611
1594
|
...klingOmniAdvancedParams
|
|
1612
|
-
}
|
|
1595
|
+
},
|
|
1596
|
+
constraints: [
|
|
1597
|
+
// KlingMode: `4k` is incompatible with video_list; the worker also drops
|
|
1598
|
+
// generated sound whenever a reference clip is supplied.
|
|
1599
|
+
{ when: { videoUrl: { exists: true } }, then: {
|
|
1600
|
+
resolution: { allowed: ["720p", "1080p"], reason: "4K output is unavailable with a reference video." },
|
|
1601
|
+
generateAudio: { disabled: true, reason: "Kling disables generated sound when a reference video is supplied." }
|
|
1602
|
+
} }
|
|
1603
|
+
]
|
|
1613
1604
|
},
|
|
1614
1605
|
{
|
|
1615
1606
|
id: "kling-video-o1",
|
|
@@ -2014,8 +2005,6 @@ var buildKlingV3Payload = (defaultMode = "std") => (input) => {
|
|
|
2014
2005
|
...hasEndFrame ? { image_tail: input.endFrame } : {},
|
|
2015
2006
|
...input.negativePrompt ? { negative_prompt: input.negativePrompt } : {},
|
|
2016
2007
|
...hasSound ? { sound: "on" } : {},
|
|
2017
|
-
// WorkflowTypes 1.0.5 still types mode as std/pro, but the backend accepts
|
|
2018
|
-
// the catalog's 4k mode for Kling V3.
|
|
2019
2008
|
mode,
|
|
2020
2009
|
...input.multiShot != null ? { multi_shot: input.multiShot } : {},
|
|
2021
2010
|
...input.shotType ? { shot_type: input.shotType } : {},
|
|
@@ -2056,22 +2045,32 @@ var buildKlingV26Payload = (input) => {
|
|
|
2056
2045
|
};
|
|
2057
2046
|
var stringElementList = (list) => list?.length ? { element_list: list.map((e) => ({ element_id: String(e.element_id) })) } : {};
|
|
2058
2047
|
var buildOmniV3 = (input) => {
|
|
2059
|
-
const
|
|
2060
|
-
|
|
2048
|
+
const imageList = [
|
|
2049
|
+
...input.startFrame ? [{ image_url: input.startFrame, type: "first_frame" }] : [],
|
|
2050
|
+
...input.endFrame ? [{ image_url: input.endFrame, type: "end_frame" }] : [],
|
|
2051
|
+
...(input.imageUrls ?? []).map((image_url) => ({ image_url }))
|
|
2052
|
+
];
|
|
2053
|
+
const videoList = input.videoUrl ? [{
|
|
2054
|
+
video_url: input.videoUrl,
|
|
2055
|
+
refer_type: input.referType ?? "feature",
|
|
2056
|
+
keep_original_sound: input.keepOriginalSound ?? "yes"
|
|
2057
|
+
}] : [];
|
|
2058
|
+
const hasBaseEdit = videoList[0]?.refer_type === "base";
|
|
2059
|
+
const hasReferenceVideo = videoList.length > 0;
|
|
2061
2060
|
const fourK = input.resolution === "4k" && !hasReferenceVideo;
|
|
2062
2061
|
const hasSound = !!input.generateAudio && !hasReferenceVideo;
|
|
2063
2062
|
return {
|
|
2064
2063
|
...input.multiShot ? {} : { prompt: input.prompt },
|
|
2065
2064
|
model_name: "kling-v3-omni",
|
|
2066
|
-
...hasBaseEdit || input.
|
|
2065
|
+
...hasBaseEdit || input.startFrame ? {} : { aspect_ratio: input.aspectRatio ?? "16:9" },
|
|
2067
2066
|
// String(n) is just `string`; wire expects literal union. Narrowing cast.
|
|
2068
2067
|
...hasBaseEdit ? {} : { duration: String(input.duration ?? 5) },
|
|
2069
2068
|
...fourK ? { mode: "4k" } : input.renderingSpeed ? { mode: input.renderingSpeed } : {},
|
|
2070
2069
|
...input.multiShot != null ? { multi_shot: input.multiShot } : {},
|
|
2071
2070
|
...input.shotType ? { shot_type: input.shotType } : {},
|
|
2072
2071
|
...input.multiPrompt ? { multi_prompt: input.multiPrompt } : {},
|
|
2073
|
-
...
|
|
2074
|
-
...
|
|
2072
|
+
...imageList.length ? { image_list: imageList } : {},
|
|
2073
|
+
...videoList.length ? { video_list: videoList } : {},
|
|
2075
2074
|
...stringElementList(input.elementList),
|
|
2076
2075
|
...hasSound ? { sound: "on" } : {}
|
|
2077
2076
|
};
|
|
@@ -2554,6 +2553,7 @@ var BYTEDANCE_ENHANCE_RESOLUTION_OPTIONS = [
|
|
|
2554
2553
|
"4k",
|
|
2555
2554
|
"8k"
|
|
2556
2555
|
];
|
|
2556
|
+
var BYTEDANCE_OMNIHUMAN_RESOLUTION_OPTIONS = ["720p", "1080p"];
|
|
2557
2557
|
var BYTEDANCE_ENHANCE_FPS_OPTIONS = [30, 60, 120];
|
|
2558
2558
|
var BYTEDANCE_ENHANCE_SCENE_OPTIONS = [
|
|
2559
2559
|
"common",
|
|
@@ -2566,11 +2566,6 @@ var buildBytedanceUpscalerPayload = (ctx) => ({
|
|
|
2566
2566
|
video_url: ctx.videoUrl,
|
|
2567
2567
|
target_resolution: "1080p"
|
|
2568
2568
|
});
|
|
2569
|
-
var buildBytedanceOmnihumanPayload = (ctx) => ({
|
|
2570
|
-
image_url: ctx.imageUrls?.[0],
|
|
2571
|
-
audio_url: ctx.audioUrl,
|
|
2572
|
-
...ctx.prompt ? { prompt: ctx.prompt } : {}
|
|
2573
|
-
});
|
|
2574
2569
|
var { MODELS: MODELS6 } = defineModels("bytedance", [
|
|
2575
2570
|
{
|
|
2576
2571
|
id: "bytedance-video-upscaler",
|
|
@@ -2581,6 +2576,7 @@ var { MODELS: MODELS6 } = defineModels("bytedance", [
|
|
|
2581
2576
|
estimatedTime: 88,
|
|
2582
2577
|
mode: "video",
|
|
2583
2578
|
inputType: "v2v",
|
|
2579
|
+
deprecated: true,
|
|
2584
2580
|
description: "AI upscale video resolution \u2014 enhance existing footage to 1080p.",
|
|
2585
2581
|
features: [feat("Video Input", "input"), feat("1080p", "resolution")],
|
|
2586
2582
|
// Vendor rejects sources already at/above the 1080p target: "The input
|
|
@@ -2593,16 +2589,33 @@ var { MODELS: MODELS6 } = defineModels("bytedance", [
|
|
|
2593
2589
|
name: "ByteDance OmniHuman",
|
|
2594
2590
|
addedAt: "2026-02-06",
|
|
2595
2591
|
workflow: "bytedance/omnihuman/v1.5",
|
|
2596
|
-
|
|
2597
|
-
|
|
2592
|
+
// Pricing key of the direct BytePlus Vision AI integration that now serves
|
|
2593
|
+
// this workflow (it replaced the fal.ai proxy). The catalog `id` keeps its
|
|
2594
|
+
// `v1.5` spelling for stability, so the backend key has to be spelled out.
|
|
2595
|
+
// Priced per second of output video, narrowed by `resolution`.
|
|
2596
|
+
modelId: "bytedance-omnihuman-1.5",
|
|
2597
|
+
// The vendor quotes a real-time factor of 23 (720p) / 27 (1080p), so wall
|
|
2598
|
+
// time is driven by the driving audio's length: ~230s for a 10s clip at
|
|
2599
|
+
// 720p. Measured 92-131s for a 1.84s clip — mostly queue and fixed
|
|
2600
|
+
// overhead. This is a representative mid-length figure, not a ceiling.
|
|
2601
|
+
estimatedTime: 250,
|
|
2598
2602
|
mode: "video",
|
|
2599
2603
|
inputType: "i2v",
|
|
2600
2604
|
description: "Animate a portrait with realistic body movement driven by audio.",
|
|
2601
|
-
features: [
|
|
2605
|
+
features: [
|
|
2606
|
+
feat("Image Input", "input"),
|
|
2607
|
+
feat("Audio Input", "audio"),
|
|
2608
|
+
feat("1080p", "resolution")
|
|
2609
|
+
],
|
|
2602
2610
|
paramConfig: {
|
|
2603
2611
|
...params.prompt({ required: false }),
|
|
2604
2612
|
...params.imageInput(1, "Portrait Image", true),
|
|
2605
|
-
...params.audioInput("Audio Track", true)
|
|
2613
|
+
...params.audioInput("Audio Track", true),
|
|
2614
|
+
...params.resolution([...BYTEDANCE_OMNIHUMAN_RESOLUTION_OPTIONS], "1080p"),
|
|
2615
|
+
...p.boolean("turboMode", false, "Turbo Mode"),
|
|
2616
|
+
// -1 (the vendor default) means "pick a random seed"; any positive value
|
|
2617
|
+
// reproduces the same result for identical inputs.
|
|
2618
|
+
...p.range("seed", -1, 2147483647, -1)
|
|
2606
2619
|
}
|
|
2607
2620
|
},
|
|
2608
2621
|
{
|
|
@@ -2616,9 +2629,6 @@ var { MODELS: MODELS6 } = defineModels("bytedance", [
|
|
|
2616
2629
|
estimatedTime: 300,
|
|
2617
2630
|
mode: "video",
|
|
2618
2631
|
inputType: "v2v",
|
|
2619
|
-
// The pa-bytedance-pluggable-worker MR adding this task is still open, so
|
|
2620
|
-
// the workflow is not deployed. Flip this off once the worker ships.
|
|
2621
|
-
disabled: true,
|
|
2622
2632
|
description: "Denoise, color-correct and super-resolve existing footage up to 8K, with frame-rate conversion.",
|
|
2623
2633
|
features: [feat("Video Required", "input"), feat("Up to 8K", "resolution"), feat("Enhance", "quality")],
|
|
2624
2634
|
paramConfig: {
|
|
@@ -2661,8 +2671,17 @@ var buildBytedanceVideoEnhancePayload = (input) => {
|
|
|
2661
2671
|
...input.scene && toolVersion === DEFAULT_TOOL_VERSION ? { scene: input.scene } : {}
|
|
2662
2672
|
};
|
|
2663
2673
|
};
|
|
2674
|
+
var buildBytedanceOmniHumanPayload = (input) => ({
|
|
2675
|
+
image_url: input.imageUrls[0],
|
|
2676
|
+
audio_url: input.audioUrl,
|
|
2677
|
+
resolution: input.resolution ?? "1080p",
|
|
2678
|
+
...input.prompt ? { prompt: input.prompt } : {},
|
|
2679
|
+
...input.turboMode ? { turbo_mode: true } : {},
|
|
2680
|
+
...input.seed != null && input.seed !== -1 ? { seed: input.seed } : {}
|
|
2681
|
+
});
|
|
2664
2682
|
registerPayloads(MODELS6, {
|
|
2665
|
-
"bytedance-video-enhance": buildBytedanceVideoEnhancePayload
|
|
2683
|
+
"bytedance-video-enhance": buildBytedanceVideoEnhancePayload,
|
|
2684
|
+
"bytedance-omnihuman-v1.5": buildBytedanceOmniHumanPayload
|
|
2666
2685
|
});
|
|
2667
2686
|
|
|
2668
2687
|
// src/vendors/catalog/videography.ts
|
|
@@ -5382,6 +5401,7 @@ var fluxResolutions = ["1K", "2K", "4K"];
|
|
|
5382
5401
|
var buildFluxV2Payload = (modelId) => (ctx) => ({
|
|
5383
5402
|
prompt: ctx.prompt,
|
|
5384
5403
|
model: modelId,
|
|
5404
|
+
count: ctx.count ?? 1,
|
|
5385
5405
|
imageUrls: ctx.imageUrls ?? [],
|
|
5386
5406
|
resolution: ctx.resolution ?? "1K",
|
|
5387
5407
|
aspectRatio: ctx.aspectRatio ?? "1:1",
|
|
@@ -5411,17 +5431,18 @@ var buildFluxKontextPayload = (modelId) => (ctx) => {
|
|
|
5411
5431
|
return {
|
|
5412
5432
|
prompt: ctx.prompt,
|
|
5413
5433
|
model: modelId,
|
|
5434
|
+
count: ctx.count ?? 1,
|
|
5414
5435
|
imageUrls: ctx.imageUrls ?? [],
|
|
5415
5436
|
...aspectRatio ? { aspectRatio } : {}
|
|
5416
5437
|
};
|
|
5417
5438
|
};
|
|
5418
5439
|
var fluxV2Base = {
|
|
5419
|
-
workflow: "flux-
|
|
5440
|
+
workflow: "bfl/v1/flux-2",
|
|
5420
5441
|
mode: "image",
|
|
5421
5442
|
inputType: "t2i"
|
|
5422
5443
|
};
|
|
5423
5444
|
var fluxKontextBase = {
|
|
5424
|
-
workflow: "flux-kontext",
|
|
5445
|
+
workflow: "bfl/v1/flux-kontext",
|
|
5425
5446
|
mode: "image",
|
|
5426
5447
|
inputType: "t2i"
|
|
5427
5448
|
};
|