@picsart/ai-sdk 5.4.0 → 5.5.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/index.d.ts +16 -6
- package/index.js +50 -39
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -153,19 +153,22 @@ type ModelInputById = {
|
|
|
153
153
|
};
|
|
154
154
|
"flux-2-flex": {
|
|
155
155
|
prompt: string;
|
|
156
|
-
aspectRatio?: "1:1" | "
|
|
156
|
+
aspectRatio?: "1:1" | "16:9" | "9:16" | "4:3" | "3:4" | "21:9" | "9:21";
|
|
157
|
+
resolution?: "1K" | "2K" | "4K";
|
|
157
158
|
count?: 1 | 2 | 4 | 6 | 8 | 10;
|
|
158
159
|
imageUrls?: string[];
|
|
159
160
|
};
|
|
160
161
|
"flux-2-max": {
|
|
161
162
|
prompt: string;
|
|
162
|
-
aspectRatio?: "1:1" | "
|
|
163
|
+
aspectRatio?: "1:1" | "16:9" | "9:16" | "4:3" | "3:4" | "21:9" | "9:21";
|
|
164
|
+
resolution?: "1K" | "2K" | "4K";
|
|
163
165
|
count?: 1 | 2 | 4 | 6 | 8 | 10;
|
|
164
166
|
imageUrls?: string[];
|
|
165
167
|
};
|
|
166
168
|
"flux-2-pro": {
|
|
167
169
|
prompt: string;
|
|
168
|
-
aspectRatio?: "1:1" | "
|
|
170
|
+
aspectRatio?: "1:1" | "16:9" | "9:16" | "4:3" | "3:4" | "21:9" | "9:21";
|
|
171
|
+
resolution?: "1K" | "2K" | "4K";
|
|
169
172
|
count?: 1 | 2 | 4 | 6 | 8 | 10;
|
|
170
173
|
imageUrls?: string[];
|
|
171
174
|
};
|
|
@@ -1258,7 +1261,7 @@ type ModelInputById = {
|
|
|
1258
1261
|
"seedance-2.5": {
|
|
1259
1262
|
prompt: string;
|
|
1260
1263
|
aspectRatio?: "16:9" | "9:16" | "1:1" | "4:3" | "3:4" | "21:9" | "adaptive";
|
|
1261
|
-
resolution?: "480p" | "720p";
|
|
1264
|
+
resolution?: "480p" | "720p" | "1080p";
|
|
1262
1265
|
duration?: 4 | 5 | 6 | 8 | 10 | 12 | 15 | 20 | 25 | 30;
|
|
1263
1266
|
generateAudio?: boolean;
|
|
1264
1267
|
returnLastFrame?: boolean;
|
|
@@ -1272,7 +1275,7 @@ type ModelInputById = {
|
|
|
1272
1275
|
"seedance-2.5-video-edit": {
|
|
1273
1276
|
prompt: string;
|
|
1274
1277
|
aspectRatio?: "adaptive";
|
|
1275
|
-
resolution?: "480p" | "720p";
|
|
1278
|
+
resolution?: "480p" | "720p" | "1080p";
|
|
1276
1279
|
generateAudio?: boolean;
|
|
1277
1280
|
returnLastFrame?: boolean;
|
|
1278
1281
|
outputFormat?: "mp4" | "mov";
|
|
@@ -1282,7 +1285,7 @@ type ModelInputById = {
|
|
|
1282
1285
|
"seedance-2.5-video-extend": {
|
|
1283
1286
|
prompt: string;
|
|
1284
1287
|
aspectRatio?: "adaptive";
|
|
1285
|
-
resolution?: "480p" | "720p";
|
|
1288
|
+
resolution?: "480p" | "720p" | "1080p";
|
|
1286
1289
|
duration?: 4 | 5 | 6 | 8 | 10 | 12 | 15 | 20 | 25 | 30;
|
|
1287
1290
|
generateAudio?: boolean;
|
|
1288
1291
|
outputFormat?: "mp4" | "mov";
|
|
@@ -1734,6 +1737,13 @@ interface FileDescriptor {
|
|
|
1734
1737
|
* authoritative gate. Omit for no client-side ceiling.
|
|
1735
1738
|
*/
|
|
1736
1739
|
maxShortSidePixels?: number;
|
|
1740
|
+
/**
|
|
1741
|
+
* Max file size in bytes accepted for this slot (e.g. Seedance 2.5 reference
|
|
1742
|
+
* videos are capped at 200 MiB by the vendor). Enforced client-side at upload
|
|
1743
|
+
* by measuring the file (or its `Content-Length`) before it is sent; the
|
|
1744
|
+
* backend worker stays the authoritative gate. Omit for no client-side cap.
|
|
1745
|
+
*/
|
|
1746
|
+
maxBytes?: number;
|
|
1737
1747
|
}
|
|
1738
1748
|
interface ObjectDescriptor {
|
|
1739
1749
|
kind: 'object';
|
package/index.js
CHANGED
|
@@ -1004,7 +1004,8 @@ var p = {
|
|
|
1004
1004
|
...opts?.array ? { array: opts.array } : {},
|
|
1005
1005
|
...opts?.maxDurationSec != null ? { maxDurationSec: opts.maxDurationSec } : {},
|
|
1006
1006
|
...opts?.minPixels != null ? { minPixels: opts.minPixels } : {},
|
|
1007
|
-
...opts?.maxShortSidePixels != null ? { maxShortSidePixels: opts.maxShortSidePixels } : {}
|
|
1007
|
+
...opts?.maxShortSidePixels != null ? { maxShortSidePixels: opts.maxShortSidePixels } : {},
|
|
1008
|
+
...opts?.maxBytes != null ? { maxBytes: opts.maxBytes } : {}
|
|
1008
1009
|
}
|
|
1009
1010
|
}
|
|
1010
1011
|
};
|
|
@@ -1221,20 +1222,30 @@ var params = {
|
|
|
1221
1222
|
// reference → ref images/videos/audios (guidance signals)
|
|
1222
1223
|
imageInput: (max = 1, label = "Start Image", required = false, category = "reference", minPixels) => p.file("imageUrls", "image", { array: { max }, label, required, category, ...minPixels != null ? { minPixels } : {} }),
|
|
1223
1224
|
/** Single source-video slot (v2v / video edit). Writes to `videoUrl`.
|
|
1224
|
-
* `maxDurationSec` caps the source clip length
|
|
1225
|
-
* the shorter side (upscaler sources)
|
|
1226
|
-
|
|
1225
|
+
* `maxDurationSec` caps the source clip length, `maxShortSidePixels` caps
|
|
1226
|
+
* the shorter side (upscaler sources) and `maxBytes` caps the file size,
|
|
1227
|
+
* all enforced client-side at upload. */
|
|
1228
|
+
videoInput: (label = "Source Video", category = "reference", required = true, maxDurationSec, maxShortSidePixels, maxBytes) => p.file("videoUrl", "video", {
|
|
1227
1229
|
label,
|
|
1228
1230
|
required,
|
|
1229
1231
|
category,
|
|
1230
1232
|
...maxDurationSec != null ? { maxDurationSec } : {},
|
|
1231
|
-
...maxShortSidePixels != null ? { maxShortSidePixels } : {}
|
|
1233
|
+
...maxShortSidePixels != null ? { maxShortSidePixels } : {},
|
|
1234
|
+
...maxBytes != null ? { maxBytes } : {}
|
|
1232
1235
|
}),
|
|
1233
1236
|
/** Single driving / sync-audio slot. Writes to `audioUrl`. */
|
|
1234
1237
|
audioInput: (label = "Audio Track", required = false, category = "asset") => p.file("audioUrl", "audio", { label, required, category }),
|
|
1235
1238
|
/** Array of reference videos (writes to `videoUrls`). Backend enforces
|
|
1236
|
-
* per-model total-duration caps (e.g. ≤ 15s for seedance).
|
|
1237
|
-
|
|
1239
|
+
* per-model total-duration caps (e.g. ≤ 15s for seedance). `maxBytes` caps
|
|
1240
|
+
* each individual clip's file size, enforced client-side at upload. */
|
|
1241
|
+
videoInputs: (max = 3, label = "Reference Videos", required = false, minPixels, maxBytes) => p.file("videoUrls", "video", {
|
|
1242
|
+
array: { max },
|
|
1243
|
+
label,
|
|
1244
|
+
required,
|
|
1245
|
+
category: "reference",
|
|
1246
|
+
...minPixels != null ? { minPixels } : {},
|
|
1247
|
+
...maxBytes != null ? { maxBytes } : {}
|
|
1248
|
+
}),
|
|
1238
1249
|
/** Array of reference audios (writes to `audioUrls`). Backend enforces
|
|
1239
1250
|
* per-model total-duration caps. */
|
|
1240
1251
|
audioInputs: (max = 3, label = "Reference Audios", required = false) => p.file("audioUrls", "audio", { array: { max }, label, required, category: "reference" }),
|
|
@@ -3852,6 +3863,7 @@ registerPayloads(MODELS11, {
|
|
|
3852
3863
|
// src/vendors/catalog/seedance.ts
|
|
3853
3864
|
var SEEDANCE_FRAME_REF_REASON = "Start/End frames cannot be combined with reference images, videos, or audios";
|
|
3854
3865
|
var SEEDANCE_MIN_PIXELS = 409600;
|
|
3866
|
+
var SEEDANCE_25_MAX_VIDEO_BYTES = 209715200;
|
|
3855
3867
|
var seedance20Constraints = [
|
|
3856
3868
|
{
|
|
3857
3869
|
when: {
|
|
@@ -4091,18 +4103,18 @@ var { MODELS: MODELS12 } = defineModels("seedance", [
|
|
|
4091
4103
|
inputType: "t2v",
|
|
4092
4104
|
badge: ["new", "premium", "hot"],
|
|
4093
4105
|
description: "Latest cinematic video with audio, multi-reference input, and mp4/mov output. Up to 30s.",
|
|
4094
|
-
features: [feat("Reference Image", "frame"), feat("Start/End Frame", "frame"), feat("Audio", "audio"), feat("
|
|
4106
|
+
features: [feat("Reference Image", "frame"), feat("Start/End Frame", "frame"), feat("Audio", "audio"), feat("1080p", "resolution"), feat("4-30 sec", "duration")],
|
|
4095
4107
|
paramConfig: {
|
|
4096
4108
|
...params.prompt(),
|
|
4097
4109
|
...params.aspectRatio(SEEDANCE_AR),
|
|
4098
|
-
...params.resolution(["480p", "720p"], "720p"),
|
|
4110
|
+
...params.resolution(["480p", "720p", "1080p"], "720p"),
|
|
4099
4111
|
...params.duration(SEEDANCE_25_DURATIONS, 5),
|
|
4100
4112
|
...params.generateAudio(),
|
|
4101
4113
|
...params.returnLastFrame(),
|
|
4102
4114
|
...p.enum("outputFormat", ["mp4", "mov"], "mp4", { label: "Format" }),
|
|
4103
4115
|
// 2.5 lifts the reference caps to 30 images / 10 videos / 10 audios.
|
|
4104
4116
|
...params.imageInput(30, "Reference Images", false, "reference", SEEDANCE_MIN_PIXELS),
|
|
4105
|
-
...params.videoInputs(10, "Reference Videos", false, SEEDANCE_MIN_PIXELS),
|
|
4117
|
+
...params.videoInputs(10, "Reference Videos", false, SEEDANCE_MIN_PIXELS, SEEDANCE_25_MAX_VIDEO_BYTES),
|
|
4106
4118
|
...params.audioInputs(10, "Reference Audios"),
|
|
4107
4119
|
...params.startFrame(),
|
|
4108
4120
|
...params.endFrame()
|
|
@@ -4120,17 +4132,17 @@ var { MODELS: MODELS12 } = defineModels("seedance", [
|
|
|
4120
4132
|
inputType: "v2v",
|
|
4121
4133
|
badge: ["new", "premium", "hot"],
|
|
4122
4134
|
description: "Edit video \u2014 replace subjects, add or remove objects, restyle scenes with reference images.",
|
|
4123
|
-
features: [feat("Video Input", "input"), feat("Multi-Image Input", "input"), feat("Audio", "audio"), feat("
|
|
4135
|
+
features: [feat("Video Input", "input"), feat("Multi-Image Input", "input"), feat("Audio", "audio"), feat("1080p", "resolution"), feat("Source length", "duration")],
|
|
4124
4136
|
paramConfig: {
|
|
4125
4137
|
...params.prompt(),
|
|
4126
4138
|
// Editing mode: aspect ratio is fixed to 'adaptive' and duration is
|
|
4127
4139
|
// source-driven ('-1'), so neither is user-selectable (vendor rule).
|
|
4128
4140
|
...params.aspectRatio(["adaptive"]),
|
|
4129
|
-
...params.resolution(["480p", "720p"], "720p"),
|
|
4141
|
+
...params.resolution(["480p", "720p", "1080p"], "720p"),
|
|
4130
4142
|
...params.generateAudio(),
|
|
4131
4143
|
...params.returnLastFrame(),
|
|
4132
4144
|
...p.enum("outputFormat", ["mp4", "mov"], "mp4", { label: "Format" }),
|
|
4133
|
-
...params.videoInput("Source Video"),
|
|
4145
|
+
...params.videoInput("Source Video", "reference", true, void 0, void 0, SEEDANCE_25_MAX_VIDEO_BYTES),
|
|
4134
4146
|
...params.imageInput(30, "Reference Images")
|
|
4135
4147
|
}
|
|
4136
4148
|
},
|
|
@@ -4146,17 +4158,17 @@ var { MODELS: MODELS12 } = defineModels("seedance", [
|
|
|
4146
4158
|
inputType: "v2v",
|
|
4147
4159
|
badge: ["new", "premium", "hot"],
|
|
4148
4160
|
description: "Stitch up to 10 clips into one continuous, extended video.",
|
|
4149
|
-
features: [feat("Multi-Video Input", "input"), feat("Audio", "audio"), feat("
|
|
4161
|
+
features: [feat("Multi-Video Input", "input"), feat("Audio", "audio"), feat("1080p", "resolution"), feat("4-30 sec", "duration")],
|
|
4150
4162
|
paramConfig: {
|
|
4151
4163
|
...params.prompt(),
|
|
4152
4164
|
// Extension mode: aspect ratio is locked to 'adaptive' (vendor rule);
|
|
4153
4165
|
// duration stays user-selectable.
|
|
4154
4166
|
...params.aspectRatio(["adaptive"]),
|
|
4155
|
-
...params.resolution(["480p", "720p"], "720p"),
|
|
4167
|
+
...params.resolution(["480p", "720p", "1080p"], "720p"),
|
|
4156
4168
|
...params.duration(SEEDANCE_25_DURATIONS, 15),
|
|
4157
4169
|
...params.generateAudio(),
|
|
4158
4170
|
...p.enum("outputFormat", ["mp4", "mov"], "mp4", { label: "Format" }),
|
|
4159
|
-
...params.videoInputs(10, "Source Videos", true)
|
|
4171
|
+
...params.videoInputs(10, "Source Videos", true, void 0, SEEDANCE_25_MAX_VIDEO_BYTES)
|
|
4160
4172
|
}
|
|
4161
4173
|
},
|
|
4162
4174
|
{
|
|
@@ -5477,9 +5489,6 @@ var { MODELS: MODELS20 } = defineModels("runway", [
|
|
|
5477
5489
|
}
|
|
5478
5490
|
]);
|
|
5479
5491
|
|
|
5480
|
-
// src/core/helpers.ts
|
|
5481
|
-
var resolveImageSize = (ctx, arMap) => ctx.aspectRatio && arMap[ctx.aspectRatio] || ctx.size;
|
|
5482
|
-
|
|
5483
5492
|
// src/vendors/catalog/flux.ts
|
|
5484
5493
|
var FLUX_AR_TO_SIZE = {
|
|
5485
5494
|
"1:1": "1024x1024",
|
|
@@ -5488,21 +5497,17 @@ var FLUX_AR_TO_SIZE = {
|
|
|
5488
5497
|
"4:3": "1024x768",
|
|
5489
5498
|
"3:4": "768x1024"
|
|
5490
5499
|
};
|
|
5491
|
-
var fluxAspectRatios =
|
|
5492
|
-
var
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
...ctx.guidance != null ? { guidance: ctx.guidance } : {},
|
|
5503
|
-
...ctx.seed != null ? { seed: ctx.seed } : {}
|
|
5504
|
-
};
|
|
5505
|
-
};
|
|
5500
|
+
var fluxAspectRatios = ["1:1", "16:9", "9:16", "4:3", "3:4", "21:9", "9:21"];
|
|
5501
|
+
var fluxResolutions = ["1K", "2K", "4K"];
|
|
5502
|
+
var buildFluxV2Payload = (modelId) => (ctx) => ({
|
|
5503
|
+
prompt: ctx.prompt,
|
|
5504
|
+
model: modelId,
|
|
5505
|
+
imageUrls: ctx.imageUrls ?? [],
|
|
5506
|
+
resolution: ctx.resolution ?? "1K",
|
|
5507
|
+
aspectRatio: ctx.aspectRatio ?? "1:1",
|
|
5508
|
+
...ctx.guidance != null ? { guidance: ctx.guidance } : {},
|
|
5509
|
+
...ctx.seed != null ? { seed: ctx.seed } : {}
|
|
5510
|
+
});
|
|
5506
5511
|
function normalizeAspectRatio(aspect) {
|
|
5507
5512
|
if (!aspect) return null;
|
|
5508
5513
|
const raw = String(aspect).trim();
|
|
@@ -5554,11 +5559,12 @@ var { MODELS: MODELS21 } = defineModels("flux", [
|
|
|
5554
5559
|
addedAt: "2026-02-06",
|
|
5555
5560
|
buildPayload: buildFluxV2Payload("flux-2-pro"),
|
|
5556
5561
|
estimatedTime: 19,
|
|
5557
|
-
description: "Sharp
|
|
5558
|
-
features: [feat("Multi-Image Input", "input"), feat("
|
|
5562
|
+
description: "Sharp images up to 4K with fine-tuned color accuracy and detail.",
|
|
5563
|
+
features: [feat("Multi-Image Input", "input"), feat("4K", "resolution")],
|
|
5559
5564
|
paramConfig: {
|
|
5560
5565
|
...params.prompt(),
|
|
5561
5566
|
...params.aspectRatio(fluxAspectRatios, "4:3"),
|
|
5567
|
+
...params.resolution(fluxResolutions, "1K"),
|
|
5562
5568
|
...params.count(),
|
|
5563
5569
|
...params.imageInput(4, "Source Images")
|
|
5564
5570
|
}
|
|
@@ -5572,10 +5578,11 @@ var { MODELS: MODELS21 } = defineModels("flux", [
|
|
|
5572
5578
|
buildPayload: buildFluxV2Payload("flux-2-max"),
|
|
5573
5579
|
estimatedTime: 27,
|
|
5574
5580
|
description: "Maximum detail for intricate compositions and demanding scenes.",
|
|
5575
|
-
features: [feat("Image Input", "input"), feat("
|
|
5581
|
+
features: [feat("Image Input", "input"), feat("4K", "resolution")],
|
|
5576
5582
|
paramConfig: {
|
|
5577
5583
|
...params.prompt(),
|
|
5578
5584
|
...params.aspectRatio(fluxAspectRatios, "1:1"),
|
|
5585
|
+
...params.resolution(fluxResolutions, "1K"),
|
|
5579
5586
|
...params.count(),
|
|
5580
5587
|
...params.imageInput(1, "Source Image")
|
|
5581
5588
|
}
|
|
@@ -5588,11 +5595,12 @@ var { MODELS: MODELS21 } = defineModels("flux", [
|
|
|
5588
5595
|
addedAt: "2026-02-06",
|
|
5589
5596
|
buildPayload: buildFluxV2Payload("flux-2-flex"),
|
|
5590
5597
|
estimatedTime: 15,
|
|
5591
|
-
description: "Adaptable generation across varied visual styles
|
|
5592
|
-
features: [feat("Image Input", "input"), feat("
|
|
5598
|
+
description: "Adaptable generation across varied visual styles up to 4K.",
|
|
5599
|
+
features: [feat("Image Input", "input"), feat("4K", "resolution")],
|
|
5593
5600
|
paramConfig: {
|
|
5594
5601
|
...params.prompt(),
|
|
5595
5602
|
...params.aspectRatio(fluxAspectRatios, "3:4"),
|
|
5603
|
+
...params.resolution(fluxResolutions, "1K"),
|
|
5596
5604
|
...params.count(),
|
|
5597
5605
|
...params.imageInput(1, "Source Image")
|
|
5598
5606
|
}
|
|
@@ -7526,6 +7534,9 @@ registerPayloads(MODELS30, {
|
|
|
7526
7534
|
"topaz-upscale-video": buildTopazVideoPayload
|
|
7527
7535
|
});
|
|
7528
7536
|
|
|
7537
|
+
// src/core/helpers.ts
|
|
7538
|
+
var resolveImageSize = (ctx, arMap) => ctx.aspectRatio && arMap[ctx.aspectRatio] || ctx.size;
|
|
7539
|
+
|
|
7529
7540
|
// src/vendors/catalog/picsart.ts
|
|
7530
7541
|
var MAX_WORDS = 77;
|
|
7531
7542
|
var truncateWords = (text) => {
|