@picsart/ai-sdk 5.26.2 → 5.26.3
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 +24 -11
- package/index.js +111 -44
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -421,20 +421,23 @@ type ModelInputById = {
|
|
|
421
421
|
};
|
|
422
422
|
"happyhorse-1.0-r2v": {
|
|
423
423
|
prompt: string;
|
|
424
|
+
seed?: number;
|
|
424
425
|
aspectRatio?: "16:9" | "9:16" | "1:1" | "4:3" | "3:4";
|
|
425
426
|
resolution?: "720P" | "1080P";
|
|
426
|
-
duration?:
|
|
427
|
+
duration?: number;
|
|
427
428
|
imageUrls: [string, ...string[]];
|
|
428
429
|
};
|
|
429
430
|
"happyhorse-1.0-t2v": {
|
|
430
431
|
prompt: string;
|
|
432
|
+
seed?: number;
|
|
431
433
|
aspectRatio?: "16:9" | "9:16" | "1:1" | "4:3" | "3:4";
|
|
432
434
|
resolution?: "720P" | "1080P";
|
|
433
|
-
duration?:
|
|
435
|
+
duration?: number;
|
|
434
436
|
startFrame?: string;
|
|
435
437
|
};
|
|
436
438
|
"happyhorse-1.0-video-edit": {
|
|
437
439
|
prompt: string;
|
|
440
|
+
seed?: number;
|
|
438
441
|
resolution?: "720P" | "1080P";
|
|
439
442
|
audioSetting?: "auto" | "origin";
|
|
440
443
|
videoUrl: string;
|
|
@@ -442,16 +445,18 @@ type ModelInputById = {
|
|
|
442
445
|
};
|
|
443
446
|
"happyhorse-1.1-r2v": {
|
|
444
447
|
prompt: string;
|
|
448
|
+
seed?: number;
|
|
445
449
|
aspectRatio?: "16:9" | "9:16" | "1:1" | "4:3" | "3:4";
|
|
446
450
|
resolution?: "720P" | "1080P";
|
|
447
|
-
duration?:
|
|
451
|
+
duration?: number;
|
|
448
452
|
imageUrls: [string, ...string[]];
|
|
449
453
|
};
|
|
450
454
|
"happyhorse-1.1-t2v": {
|
|
451
455
|
prompt: string;
|
|
456
|
+
seed?: number;
|
|
452
457
|
aspectRatio?: "16:9" | "9:16" | "1:1" | "4:3" | "3:4";
|
|
453
458
|
resolution?: "720P" | "1080P";
|
|
454
|
-
duration?:
|
|
459
|
+
duration?: number;
|
|
455
460
|
startFrame?: string;
|
|
456
461
|
};
|
|
457
462
|
"heygen-talking-photo": {
|
|
@@ -960,7 +965,6 @@ type ModelInputById = {
|
|
|
960
965
|
};
|
|
961
966
|
"qwen": {
|
|
962
967
|
prompt: string;
|
|
963
|
-
count?: 1 | 2 | 4 | 6 | 8 | 10;
|
|
964
968
|
imageUrls?: string[];
|
|
965
969
|
};
|
|
966
970
|
"qwen-image-2": {
|
|
@@ -975,6 +979,7 @@ type ModelInputById = {
|
|
|
975
979
|
count?: 1 | 2 | 4 | 6;
|
|
976
980
|
enhancePrompt?: boolean;
|
|
977
981
|
imageUrls?: string[];
|
|
982
|
+
seed?: number;
|
|
978
983
|
};
|
|
979
984
|
"qwen-image-3.0": {
|
|
980
985
|
prompt: string;
|
|
@@ -983,6 +988,7 @@ type ModelInputById = {
|
|
|
983
988
|
count?: 1 | 2 | 4 | 6;
|
|
984
989
|
enhancePrompt?: boolean;
|
|
985
990
|
imageUrls?: string[];
|
|
991
|
+
seed?: number;
|
|
986
992
|
promptExtendMode?: "direct" | "agent";
|
|
987
993
|
enableThinking?: boolean;
|
|
988
994
|
};
|
|
@@ -993,6 +999,7 @@ type ModelInputById = {
|
|
|
993
999
|
count?: 1 | 2 | 4 | 6;
|
|
994
1000
|
enhancePrompt?: boolean;
|
|
995
1001
|
imageUrls?: string[];
|
|
1002
|
+
seed?: number;
|
|
996
1003
|
promptExtendMode?: "direct" | "agent";
|
|
997
1004
|
enableThinking?: boolean;
|
|
998
1005
|
};
|
|
@@ -1517,7 +1524,6 @@ type ModelInputById = {
|
|
|
1517
1524
|
resolution?: "480p" | "720p" | "1080p";
|
|
1518
1525
|
aspectRatio?: "16:9" | "9:16" | "1:1" | "4:3" | "3:4";
|
|
1519
1526
|
negativePrompt?: string;
|
|
1520
|
-
cfgScale?: number;
|
|
1521
1527
|
startFrame?: string;
|
|
1522
1528
|
};
|
|
1523
1529
|
"wan-2.7-i2v": {
|
|
@@ -1529,6 +1535,7 @@ type ModelInputById = {
|
|
|
1529
1535
|
startFrame: string;
|
|
1530
1536
|
endFrame?: string;
|
|
1531
1537
|
audioUrl?: string;
|
|
1538
|
+
seed?: number;
|
|
1532
1539
|
};
|
|
1533
1540
|
"wan-2.7-r2v": {
|
|
1534
1541
|
prompt: string;
|
|
@@ -1538,6 +1545,7 @@ type ModelInputById = {
|
|
|
1538
1545
|
negativePrompt?: string;
|
|
1539
1546
|
imageUrls: [string, ...string[]];
|
|
1540
1547
|
videoUrl: string;
|
|
1548
|
+
seed?: number;
|
|
1541
1549
|
};
|
|
1542
1550
|
"wan-2.7-t2v": {
|
|
1543
1551
|
prompt: string;
|
|
@@ -1548,6 +1556,7 @@ type ModelInputById = {
|
|
|
1548
1556
|
enhancePrompt?: boolean;
|
|
1549
1557
|
audioUrl?: string;
|
|
1550
1558
|
startFrame?: string;
|
|
1559
|
+
seed?: number;
|
|
1551
1560
|
};
|
|
1552
1561
|
"wan-2.7-video-edit": {
|
|
1553
1562
|
prompt?: string;
|
|
@@ -1556,10 +1565,13 @@ type ModelInputById = {
|
|
|
1556
1565
|
negativePrompt?: string;
|
|
1557
1566
|
videoUrl: string;
|
|
1558
1567
|
imageUrls?: string[];
|
|
1568
|
+
audioSetting?: "auto" | "origin";
|
|
1569
|
+
duration?: number;
|
|
1570
|
+
seed?: number;
|
|
1559
1571
|
};
|
|
1560
1572
|
"wan-3.0-video": {
|
|
1561
|
-
prompt
|
|
1562
|
-
duration?: 5 | 10 | 15 | 30;
|
|
1573
|
+
prompt?: string;
|
|
1574
|
+
duration?: -1 | 5 | 10 | 15 | 30;
|
|
1563
1575
|
resolution?: "480P" | "720P" | "1080P";
|
|
1564
1576
|
aspectRatio?: "16:9" | "9:16" | "1:1" | "4:3" | "3:4" | "adaptive";
|
|
1565
1577
|
generateAudio?: boolean;
|
|
@@ -1573,8 +1585,8 @@ type ModelInputById = {
|
|
|
1573
1585
|
seed?: number;
|
|
1574
1586
|
};
|
|
1575
1587
|
"wan-3.0-video-prime": {
|
|
1576
|
-
prompt
|
|
1577
|
-
duration?: 5 | 10 | 15 | 30;
|
|
1588
|
+
prompt?: string;
|
|
1589
|
+
duration?: -1 | 5 | 10 | 15 | 30;
|
|
1578
1590
|
resolution?: "480P" | "720P" | "1080P";
|
|
1579
1591
|
aspectRatio?: "16:9" | "9:16" | "1:1" | "4:3" | "3:4" | "adaptive";
|
|
1580
1592
|
generateAudio?: boolean;
|
|
@@ -1808,7 +1820,8 @@ interface RangeDescriptor {
|
|
|
1808
1820
|
min: number;
|
|
1809
1821
|
max: number;
|
|
1810
1822
|
step?: number;
|
|
1811
|
-
|
|
1823
|
+
/** Optional: default-less ranges (e.g. seed) are sent only when set. */
|
|
1824
|
+
default?: number;
|
|
1812
1825
|
}
|
|
1813
1826
|
interface BooleanDescriptor {
|
|
1814
1827
|
kind: 'boolean';
|
package/index.js
CHANGED
|
@@ -1052,17 +1052,28 @@ var p = {
|
|
|
1052
1052
|
}
|
|
1053
1053
|
};
|
|
1054
1054
|
},
|
|
1055
|
-
negativePrompt(placeholder) {
|
|
1055
|
+
negativePrompt(placeholder, maxLength) {
|
|
1056
1056
|
return {
|
|
1057
1057
|
negativePrompt: {
|
|
1058
1058
|
label: "Negative Prompt",
|
|
1059
1059
|
descriptor: {
|
|
1060
1060
|
kind: "text",
|
|
1061
|
-
placeholder
|
|
1061
|
+
placeholder,
|
|
1062
|
+
maxLength
|
|
1062
1063
|
}
|
|
1063
1064
|
}
|
|
1064
1065
|
};
|
|
1065
1066
|
},
|
|
1067
|
+
/** Generation seed — optional, no default: sent only when the user sets it,
|
|
1068
|
+
* so the vendor's own randomization applies otherwise. */
|
|
1069
|
+
seed(max = 2147483647) {
|
|
1070
|
+
return {
|
|
1071
|
+
seed: {
|
|
1072
|
+
label: "Seed",
|
|
1073
|
+
descriptor: { kind: "range", min: 0, max, step: 1 }
|
|
1074
|
+
}
|
|
1075
|
+
};
|
|
1076
|
+
},
|
|
1066
1077
|
cfgScale(min, max, def, step) {
|
|
1067
1078
|
return {
|
|
1068
1079
|
cfgScale: {
|
|
@@ -1310,6 +1321,7 @@ var params = {
|
|
|
1310
1321
|
count: p.count,
|
|
1311
1322
|
resolution: p.resolution,
|
|
1312
1323
|
negativePrompt: p.negativePrompt,
|
|
1324
|
+
seed: p.seed,
|
|
1313
1325
|
generateAudio: p.generateAudio,
|
|
1314
1326
|
returnLastFrame: p.returnLastFrame,
|
|
1315
1327
|
audioSetting: p.audioSetting,
|
|
@@ -3000,15 +3012,15 @@ var buildWanT2VPayload = (ctx) => ({
|
|
|
3000
3012
|
var buildWanI2VPayload = (ctx) => ({
|
|
3001
3013
|
prompt: ctx.prompt,
|
|
3002
3014
|
image_url: ctx.startFrame,
|
|
3003
|
-
resolution: "720p",
|
|
3004
|
-
duration: ctx.duration ?? 5,
|
|
3005
|
-
...ctx.
|
|
3015
|
+
resolution: ctx.resolution === "1080p" ? "1080p" : "720p",
|
|
3016
|
+
duration: String(ctx.duration ?? 5),
|
|
3017
|
+
...ctx.negativePrompt ? { negative_prompt: ctx.negativePrompt } : {}
|
|
3006
3018
|
});
|
|
3007
3019
|
var buildWanR2VPayload = (ctx) => ({
|
|
3008
3020
|
prompt: ctx.prompt,
|
|
3009
3021
|
video_urls: [ctx.videoUrl],
|
|
3010
|
-
resolution: "720p",
|
|
3011
|
-
duration: ctx.duration ?? 5
|
|
3022
|
+
resolution: ctx.resolution === "1080p" ? "1080p" : "720p",
|
|
3023
|
+
duration: String(ctx.duration ?? 5)
|
|
3012
3024
|
});
|
|
3013
3025
|
var buildWanImagePayload = (ctx) => ({
|
|
3014
3026
|
prompt: ctx.prompt,
|
|
@@ -3048,6 +3060,12 @@ var buildWan27R2VPayload = (ctx) => {
|
|
|
3048
3060
|
for (const url of ctx.imageUrls) media.push({ type: "reference_image", url });
|
|
3049
3061
|
}
|
|
3050
3062
|
if (ctx.videoUrl) media.push({ type: "reference_video", url: ctx.videoUrl });
|
|
3063
|
+
if (media.length > 5) {
|
|
3064
|
+
throw new ApiError("Wan 2.7 R2V accepts at most 5 reference items (images + video combined).", {
|
|
3065
|
+
status: 400,
|
|
3066
|
+
code: "validation_error"
|
|
3067
|
+
});
|
|
3068
|
+
}
|
|
3051
3069
|
return {
|
|
3052
3070
|
prompt: ctx.prompt,
|
|
3053
3071
|
media,
|
|
@@ -3062,7 +3080,7 @@ var buildWan27VideoEditPayload = (ctx) => {
|
|
|
3062
3080
|
const media = [];
|
|
3063
3081
|
if (ctx.videoUrl) media.push({ type: "video", url: ctx.videoUrl });
|
|
3064
3082
|
if (ctx.imageUrls?.length) {
|
|
3065
|
-
for (const url of ctx.imageUrls.slice(0,
|
|
3083
|
+
for (const url of ctx.imageUrls.slice(0, 4)) media.push({ type: "reference_image", url });
|
|
3066
3084
|
}
|
|
3067
3085
|
return {
|
|
3068
3086
|
media,
|
|
@@ -3070,6 +3088,9 @@ var buildWan27VideoEditPayload = (ctx) => {
|
|
|
3070
3088
|
...ctx.prompt ? { prompt: ctx.prompt } : {},
|
|
3071
3089
|
...ctx.negativePrompt ? { negative_prompt: ctx.negativePrompt } : {},
|
|
3072
3090
|
...ctx.aspectRatio ? { ratio: ctx.aspectRatio } : {},
|
|
3091
|
+
// duration is truncation-only: unset (vendor default 0) keeps the input length.
|
|
3092
|
+
...ctx.duration ? { duration: ctx.duration } : {},
|
|
3093
|
+
...ctx.audioSetting ? { audio_setting: ctx.audioSetting } : {},
|
|
3073
3094
|
...ctx.seed != null ? { seed: ctx.seed } : {}
|
|
3074
3095
|
};
|
|
3075
3096
|
};
|
|
@@ -3104,10 +3125,21 @@ var wanV3Constraints = [
|
|
|
3104
3125
|
];
|
|
3105
3126
|
var wanV3Features = [feat("Image Input", "input"), feat("Video Input", "input"), feat("Audio", "audio"), feat("Start/End Frame", "frame"), feat("1080P", "resolution"), feat("Adaptive Ratio", "resolution")];
|
|
3106
3127
|
var wanV3ParamConfig = {
|
|
3107
|
-
|
|
3108
|
-
...params.
|
|
3128
|
+
// Vendor: 'either prompt or media' — the builder enforces the cross-field rule.
|
|
3129
|
+
...params.prompt({ required: false, maxLength: 5e3 }),
|
|
3130
|
+
// Vendor: integer 2-30, or -1 = Smart duration mode (model picks the length).
|
|
3131
|
+
duration: {
|
|
3132
|
+
label: "Duration (s)",
|
|
3133
|
+
descriptor: {
|
|
3134
|
+
kind: "enum",
|
|
3135
|
+
valueType: "number",
|
|
3136
|
+
options: [{ id: -1, label: "Auto" }, { id: 5 }, { id: 10 }, { id: 15 }, { id: 30 }],
|
|
3137
|
+
default: 5
|
|
3138
|
+
}
|
|
3139
|
+
},
|
|
3109
3140
|
...params.resolution(["480P", "720P", "1080P"], "1080P"),
|
|
3110
|
-
|
|
3141
|
+
// Vendor default is 'adaptive' (model chooses from intent and input media).
|
|
3142
|
+
...params.aspectRatio(["16:9", "9:16", "1:1", "4:3", "3:4", "adaptive"], "adaptive"),
|
|
3111
3143
|
...params.generateAudio(true),
|
|
3112
3144
|
...params.startFrame(),
|
|
3113
3145
|
...params.endFrame(),
|
|
@@ -3116,7 +3148,8 @@ var wanV3ParamConfig = {
|
|
|
3116
3148
|
...params.audioInputs(5, "Reference Audios"),
|
|
3117
3149
|
...p.boolean("enableThinking", false, "Deep Thinking"),
|
|
3118
3150
|
...p.boolean("watermark", false, "Watermark"),
|
|
3119
|
-
|
|
3151
|
+
// No default: a materialized seed would pin every generation to one value.
|
|
3152
|
+
...params.seed()
|
|
3120
3153
|
};
|
|
3121
3154
|
var { MODELS: MODELS10 } = defineModels("wan", [
|
|
3122
3155
|
// ── Video ─────────────────────────────────────────
|
|
@@ -3135,7 +3168,7 @@ var { MODELS: MODELS10 } = defineModels("wan", [
|
|
|
3135
3168
|
editEstimatedTime: 14,
|
|
3136
3169
|
mode: "video",
|
|
3137
3170
|
inputType: "t2v",
|
|
3138
|
-
description: "Painterly artistic look with audio \u2014 up to 15s at 1080p
|
|
3171
|
+
description: "Painterly artistic look with audio \u2014 up to 15s at 1080p.",
|
|
3139
3172
|
features: [feat("Image Input", "input"), feat("Start Frame", "frame"), feat("Audio", "audio"), feat("1080p", "resolution"), feat("5/10/15 sec", "duration")],
|
|
3140
3173
|
paramConfig: {
|
|
3141
3174
|
...params.prompt(),
|
|
@@ -3143,7 +3176,6 @@ var { MODELS: MODELS10 } = defineModels("wan", [
|
|
|
3143
3176
|
...params.resolution(["480p", "720p", "1080p"], "720p"),
|
|
3144
3177
|
...params.aspectRatio(["16:9", "9:16", "1:1", "4:3", "3:4"]),
|
|
3145
3178
|
...params.negativePrompt(),
|
|
3146
|
-
...params.cfgScale(1, 10, 5, 0.5),
|
|
3147
3179
|
...params.startFrame()
|
|
3148
3180
|
}
|
|
3149
3181
|
},
|
|
@@ -3205,14 +3237,15 @@ var { MODELS: MODELS10 } = defineModels("wan", [
|
|
|
3205
3237
|
description: "Wan 2.7 T2V \u2014 up to 15s at 1080p with audio input and prompt enhancement.",
|
|
3206
3238
|
features: [feat("Image Input", "input"), feat("Start Frame", "frame"), feat("Audio", "audio"), feat("1080P", "resolution"), feat("5/10/15 sec", "duration")],
|
|
3207
3239
|
paramConfig: {
|
|
3208
|
-
...params.prompt(),
|
|
3240
|
+
...params.prompt({ maxLength: 5e3 }),
|
|
3209
3241
|
...params.duration([5, 10, 15], 5),
|
|
3210
3242
|
...params.resolution(WAN27_RES, "720P"),
|
|
3211
3243
|
...params.aspectRatio(WAN27_AR),
|
|
3212
|
-
...params.negativePrompt(),
|
|
3244
|
+
...params.negativePrompt(void 0, 500),
|
|
3213
3245
|
...params.enhancePrompt(true),
|
|
3214
3246
|
...params.audioInput("Audio Track"),
|
|
3215
|
-
...params.startFrame()
|
|
3247
|
+
...params.startFrame(),
|
|
3248
|
+
...params.seed()
|
|
3216
3249
|
}
|
|
3217
3250
|
},
|
|
3218
3251
|
{
|
|
@@ -3229,14 +3262,15 @@ var { MODELS: MODELS10 } = defineModels("wan", [
|
|
|
3229
3262
|
description: "Wan 2.7 I2V \u2014 animate images with start/end frame and optional driving audio.",
|
|
3230
3263
|
features: [feat("Start/End Frame", "frame"), feat("Audio", "audio"), feat("1080P", "resolution"), feat("5/10/15 sec", "duration")],
|
|
3231
3264
|
paramConfig: {
|
|
3232
|
-
...params.prompt({ required: false }),
|
|
3265
|
+
...params.prompt({ required: false, maxLength: 5e3 }),
|
|
3233
3266
|
...params.duration([5, 10, 15], 5),
|
|
3234
3267
|
...params.resolution(WAN27_RES, "720P"),
|
|
3235
|
-
...params.negativePrompt(),
|
|
3268
|
+
...params.negativePrompt(void 0, 500),
|
|
3236
3269
|
...params.enhancePrompt(true),
|
|
3237
3270
|
...params.startFrame("Start Frame", true),
|
|
3238
3271
|
...params.endFrame(),
|
|
3239
|
-
...params.audioInput("Driving Audio")
|
|
3272
|
+
...params.audioInput("Driving Audio"),
|
|
3273
|
+
...params.seed()
|
|
3240
3274
|
}
|
|
3241
3275
|
},
|
|
3242
3276
|
{
|
|
@@ -3253,13 +3287,16 @@ var { MODELS: MODELS10 } = defineModels("wan", [
|
|
|
3253
3287
|
description: "Wan 2.7 R2V \u2014 generate video from reference images/video with style direction.",
|
|
3254
3288
|
features: [feat("Multi-Image Input", "input"), feat("Video Input", "input"), feat("1080P", "resolution"), feat("5/10 sec", "duration")],
|
|
3255
3289
|
paramConfig: {
|
|
3256
|
-
...params.prompt(),
|
|
3290
|
+
...params.prompt({ maxLength: 5e3 }),
|
|
3257
3291
|
...params.duration([5, 10], 5),
|
|
3258
3292
|
...params.resolution(WAN27_RES, "720P"),
|
|
3259
3293
|
...params.aspectRatio(WAN27_AR),
|
|
3260
|
-
...params.negativePrompt(),
|
|
3294
|
+
...params.negativePrompt(void 0, 500),
|
|
3295
|
+
// Vendor: reference images + reference video combined ≤ 5 (the builder
|
|
3296
|
+
// fails fast when a video pushes the total over the cap).
|
|
3261
3297
|
...params.imageInput(5, "Reference Images", true),
|
|
3262
|
-
...params.videoInput("Reference Video")
|
|
3298
|
+
...params.videoInput("Reference Video"),
|
|
3299
|
+
...params.seed()
|
|
3263
3300
|
}
|
|
3264
3301
|
},
|
|
3265
3302
|
{
|
|
@@ -3276,12 +3313,21 @@ var { MODELS: MODELS10 } = defineModels("wan", [
|
|
|
3276
3313
|
description: "Wan 2.7 Video Edit \u2014 restyle or modify existing video with reference images.",
|
|
3277
3314
|
features: [feat("Video Input", "input"), feat("Image Input", "input"), feat("1080P", "resolution")],
|
|
3278
3315
|
paramConfig: {
|
|
3279
|
-
...params.prompt({ required: false }),
|
|
3316
|
+
...params.prompt({ required: false, maxLength: 5e3 }),
|
|
3280
3317
|
...params.resolution(WAN27_RES, "720P"),
|
|
3281
3318
|
...params.aspectRatio(WAN27_AR),
|
|
3282
|
-
...params.negativePrompt(),
|
|
3319
|
+
...params.negativePrompt(void 0, 500),
|
|
3283
3320
|
...params.videoInput("Source Video"),
|
|
3284
|
-
|
|
3321
|
+
// Vendor: 1 video + up to 4 reference images.
|
|
3322
|
+
...params.imageInput(4, "Reference Images"),
|
|
3323
|
+
...params.audioSetting(),
|
|
3324
|
+
// Optional truncation: unset keeps the input video's length (vendor
|
|
3325
|
+
// default 0); set 2-10 to cut the output.
|
|
3326
|
+
duration: {
|
|
3327
|
+
label: "Output Duration (s)",
|
|
3328
|
+
descriptor: { kind: "range", min: 2, max: 10, step: 1 }
|
|
3329
|
+
},
|
|
3330
|
+
...params.seed()
|
|
3285
3331
|
}
|
|
3286
3332
|
},
|
|
3287
3333
|
// ── Wan 3.0 all-in-one Video ─────────────────────────
|
|
@@ -3335,10 +3381,17 @@ var makeWanV3VideoPayload = (model) => (input) => {
|
|
|
3335
3381
|
if (input.audioUrls?.length) {
|
|
3336
3382
|
for (const url of input.audioUrls) media.push({ type: "reference_audio", url });
|
|
3337
3383
|
}
|
|
3384
|
+
if (!input.prompt && media.length === 0) {
|
|
3385
|
+
throw new ApiError("Wan 3.0: provide a prompt or at least one media input (frames or references).", {
|
|
3386
|
+
status: 400,
|
|
3387
|
+
code: "validation_error"
|
|
3388
|
+
});
|
|
3389
|
+
}
|
|
3338
3390
|
return {
|
|
3339
3391
|
model,
|
|
3340
3392
|
resolution: input.resolution ?? "1080P",
|
|
3341
|
-
|
|
3393
|
+
// Vendor default: adaptive — the model picks the ratio from intent/media.
|
|
3394
|
+
ratio: input.aspectRatio ?? "adaptive",
|
|
3342
3395
|
duration: input.duration ?? 5,
|
|
3343
3396
|
audio: input.generateAudio ?? true,
|
|
3344
3397
|
enable_thinking: input.enableThinking ?? false,
|
|
@@ -6937,35 +6990,40 @@ var buildQwen2Payload = (ctx) => {
|
|
|
6937
6990
|
const hasImages = Array.isArray(ctx.imageUrls) && ctx.imageUrls.length > 0;
|
|
6938
6991
|
return {
|
|
6939
6992
|
prompt: ctx.prompt,
|
|
6993
|
+
num_images: ctx.count ?? 1,
|
|
6940
6994
|
...hasImages ? { image_urls: ctx.imageUrls } : {}
|
|
6941
6995
|
};
|
|
6942
6996
|
};
|
|
6943
6997
|
var buildQwenV1 = (model) => (ctx) => {
|
|
6944
6998
|
const hasImages = Array.isArray(ctx.imageUrls) && ctx.imageUrls.length > 0;
|
|
6945
|
-
const promptExtendMode = ctx.promptExtendMode === "agent" && hasImages && model
|
|
6999
|
+
const promptExtendMode = ctx.promptExtendMode === "agent" && hasImages && model.startsWith("qwen-image-3.0") ? void 0 : ctx.promptExtendMode;
|
|
7000
|
+
const promptExtend = ctx.enhancePrompt ?? true;
|
|
6946
7001
|
return {
|
|
6947
7002
|
prompt: ctx.prompt,
|
|
6948
7003
|
model,
|
|
6949
7004
|
...hasImages ? { image_urls: ctx.imageUrls } : {},
|
|
6950
7005
|
...ctx.negativePrompt ? { negative_prompt: ctx.negativePrompt } : {},
|
|
6951
|
-
|
|
7006
|
+
// I2I: omit size — the vendor auto-matches the input image's aspect ratio,
|
|
7007
|
+
// and the SDK's ~4MP presets exceed the current I2I ceiling.
|
|
7008
|
+
...hasImages ? {} : { size: (ctx.resolution ?? "2048x2048").replace("x", "*") },
|
|
6952
7009
|
n: ctx.count ?? 1,
|
|
6953
|
-
prompt_extend:
|
|
7010
|
+
prompt_extend: promptExtend,
|
|
6954
7011
|
// Qwen 3.0 family only — prompt-rewrite strategy (direct/agent); 2.x ignores it.
|
|
6955
7012
|
...promptExtendMode ? { prompt_extend_mode: promptExtendMode } : {},
|
|
6956
|
-
// Qwen 3.0 family only — thinking mode
|
|
6957
|
-
...ctx.enableThinking != null ? { enable_thinking: ctx.enableThinking } : {},
|
|
7013
|
+
// Qwen 3.0 family only — thinking mode; the vendor requires prompt_extend=true.
|
|
7014
|
+
...ctx.enableThinking != null && promptExtend ? { enable_thinking: ctx.enableThinking } : {},
|
|
6958
7015
|
watermark: false,
|
|
6959
7016
|
...ctx.seed != null ? { seed: ctx.seed } : {}
|
|
6960
7017
|
};
|
|
6961
7018
|
};
|
|
6962
7019
|
var qwenV1Params = {
|
|
6963
7020
|
...params.prompt({ maxLength: 800 }),
|
|
6964
|
-
...params.negativePrompt(),
|
|
7021
|
+
...params.negativePrompt(void 0, 500),
|
|
6965
7022
|
...params.resolution(QWEN_V1_SIZES, "2048x2048"),
|
|
6966
7023
|
...params.count([1, 2, 4, 6]),
|
|
6967
7024
|
...params.enhancePrompt(true),
|
|
6968
|
-
...params.imageInput(3, "Source Images")
|
|
7025
|
+
...params.imageInput(3, "Source Images"),
|
|
7026
|
+
...params.seed()
|
|
6969
7027
|
};
|
|
6970
7028
|
var qwenV1Params3 = {
|
|
6971
7029
|
...qwenV1Params,
|
|
@@ -6989,7 +7047,6 @@ var { MODELS: MODELS28 } = defineModels("qwen", [
|
|
|
6989
7047
|
features: [feat("Image Input", "input"), feat("1K", "resolution")],
|
|
6990
7048
|
paramConfig: {
|
|
6991
7049
|
...params.prompt(),
|
|
6992
|
-
...params.count(),
|
|
6993
7050
|
...params.imageInput(1, "Source Image")
|
|
6994
7051
|
}
|
|
6995
7052
|
},
|
|
@@ -6997,6 +7054,8 @@ var { MODELS: MODELS28 } = defineModels("qwen", [
|
|
|
6997
7054
|
id: "qwen-image-2",
|
|
6998
7055
|
name: "Qwen 2",
|
|
6999
7056
|
addedAt: "2026-03-27",
|
|
7057
|
+
deprecated: true,
|
|
7058
|
+
// fal marks both endpoints 'no longer supported' — use qwen-image-3.0
|
|
7000
7059
|
workflow: "qwen-image-2/text-to-image",
|
|
7001
7060
|
editWorkflow: "qwen-image-2/edit",
|
|
7002
7061
|
buildPayload: buildQwen2Payload,
|
|
@@ -8171,7 +8230,6 @@ var buildHH11R2VPayload = (ctx) => {
|
|
|
8171
8230
|
};
|
|
8172
8231
|
var HH_AR = ["16:9", "9:16", "1:1", "4:3", "3:4"];
|
|
8173
8232
|
var HH_RES = ["720P", "1080P"];
|
|
8174
|
-
var HH_DURATIONS = [5, 10, 15];
|
|
8175
8233
|
var { MODELS: MODELS33 } = defineModels("happyhorse", [
|
|
8176
8234
|
{
|
|
8177
8235
|
id: "happyhorse-1.0-t2v",
|
|
@@ -8189,13 +8247,15 @@ var { MODELS: MODELS33 } = defineModels("happyhorse", [
|
|
|
8189
8247
|
features: [
|
|
8190
8248
|
feat("Start Frame", "frame"),
|
|
8191
8249
|
feat("1080P", "resolution"),
|
|
8192
|
-
feat("
|
|
8250
|
+
feat("3-15 sec", "duration")
|
|
8193
8251
|
],
|
|
8194
8252
|
paramConfig: {
|
|
8195
8253
|
...params.prompt({ maxLength: 2500 }),
|
|
8254
|
+
...params.seed(),
|
|
8196
8255
|
...params.aspectRatio(HH_AR, "16:9"),
|
|
8197
8256
|
...params.resolution(HH_RES, "720P"),
|
|
8198
|
-
|
|
8257
|
+
// Vendor/worker accept any integer 3-15 (docs: default 5).
|
|
8258
|
+
...params.durationRange(3, 15, 5),
|
|
8199
8259
|
...params.startFrame()
|
|
8200
8260
|
}
|
|
8201
8261
|
},
|
|
@@ -8214,13 +8274,15 @@ var { MODELS: MODELS33 } = defineModels("happyhorse", [
|
|
|
8214
8274
|
features: [
|
|
8215
8275
|
feat("Multi-Image Input", "input"),
|
|
8216
8276
|
feat("1080P", "resolution"),
|
|
8217
|
-
feat("
|
|
8277
|
+
feat("3-15 sec", "duration")
|
|
8218
8278
|
],
|
|
8219
8279
|
paramConfig: {
|
|
8220
8280
|
...params.prompt({ maxLength: 2500 }),
|
|
8281
|
+
...params.seed(),
|
|
8221
8282
|
...params.aspectRatio(HH_AR, "16:9"),
|
|
8222
8283
|
...params.resolution(HH_RES, "720P"),
|
|
8223
|
-
|
|
8284
|
+
// Vendor/worker accept any integer 3-15 (docs: default 5).
|
|
8285
|
+
...params.durationRange(3, 15, 5),
|
|
8224
8286
|
...params.imageInput(9, "Reference Images", true)
|
|
8225
8287
|
}
|
|
8226
8288
|
},
|
|
@@ -8243,6 +8305,7 @@ var { MODELS: MODELS33 } = defineModels("happyhorse", [
|
|
|
8243
8305
|
],
|
|
8244
8306
|
paramConfig: {
|
|
8245
8307
|
...params.prompt({ maxLength: 2500 }),
|
|
8308
|
+
...params.seed(),
|
|
8246
8309
|
...params.resolution(HH_RES, "720P"),
|
|
8247
8310
|
...params.audioSetting(),
|
|
8248
8311
|
...params.videoInput("Source Video"),
|
|
@@ -8265,13 +8328,15 @@ var { MODELS: MODELS33 } = defineModels("happyhorse", [
|
|
|
8265
8328
|
features: [
|
|
8266
8329
|
feat("Start Frame", "frame"),
|
|
8267
8330
|
feat("1080P", "resolution"),
|
|
8268
|
-
feat("
|
|
8331
|
+
feat("3-15 sec", "duration")
|
|
8269
8332
|
],
|
|
8270
8333
|
paramConfig: {
|
|
8271
8334
|
...params.prompt({ maxLength: 2500 }),
|
|
8335
|
+
...params.seed(),
|
|
8272
8336
|
...params.aspectRatio(HH_AR, "16:9"),
|
|
8273
8337
|
...params.resolution(HH_RES, "720P"),
|
|
8274
|
-
|
|
8338
|
+
// Vendor/worker accept any integer 3-15 (docs: default 5).
|
|
8339
|
+
...params.durationRange(3, 15, 5),
|
|
8275
8340
|
...params.startFrame()
|
|
8276
8341
|
}
|
|
8277
8342
|
},
|
|
@@ -8289,13 +8354,15 @@ var { MODELS: MODELS33 } = defineModels("happyhorse", [
|
|
|
8289
8354
|
features: [
|
|
8290
8355
|
feat("Multi-Image Input", "input"),
|
|
8291
8356
|
feat("1080P", "resolution"),
|
|
8292
|
-
feat("
|
|
8357
|
+
feat("3-15 sec", "duration")
|
|
8293
8358
|
],
|
|
8294
8359
|
paramConfig: {
|
|
8295
8360
|
...params.prompt({ maxLength: 2500 }),
|
|
8361
|
+
...params.seed(),
|
|
8296
8362
|
...params.aspectRatio(HH_AR, "16:9"),
|
|
8297
8363
|
...params.resolution(HH_RES, "720P"),
|
|
8298
|
-
|
|
8364
|
+
// Vendor/worker accept any integer 3-15 (docs: default 5).
|
|
8365
|
+
...params.durationRange(3, 15, 5),
|
|
8299
8366
|
...params.imageInput(9, "Reference Images", true)
|
|
8300
8367
|
}
|
|
8301
8368
|
}
|