@picsart/ai-sdk 5.23.0 → 5.24.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.
Files changed (3) hide show
  1. package/index.d.ts +9 -0
  2. package/index.js +49 -18
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -1828,6 +1828,15 @@ interface FileDescriptor {
1828
1828
  * backend worker stays the authoritative gate. Omit for no client-side floor.
1829
1829
  */
1830
1830
  minPixels?: number;
1831
+ /**
1832
+ * Min intrinsic short-side length (pixels) accepted for an image/video file —
1833
+ * `min(width, height)` must be at least this. Most vendors specify input limits
1834
+ * per side rather than by total pixel count (e.g. Seedance reference images:
1835
+ * width and height each in [300, 6000]). Enforced client-side at upload by
1836
+ * measuring the media before it is sent; the backend worker stays the
1837
+ * authoritative gate. Omit for no client-side floor.
1838
+ */
1839
+ minSidePixels?: number;
1831
1840
  /**
1832
1841
  * Max intrinsic short-side length (pixels) accepted for an image/video file —
1833
1842
  * `min(width, height)` must not exceed this. Used by upscalers whose source
package/index.js CHANGED
@@ -1019,6 +1019,7 @@ var p = {
1019
1019
  ...opts?.array ? { array: opts.array } : {},
1020
1020
  ...opts?.maxDurationSec != null ? { maxDurationSec: opts.maxDurationSec } : {},
1021
1021
  ...opts?.minPixels != null ? { minPixels: opts.minPixels } : {},
1022
+ ...opts?.minSidePixels != null ? { minSidePixels: opts.minSidePixels } : {},
1022
1023
  ...opts?.maxShortSidePixels != null ? { maxShortSidePixels: opts.maxShortSidePixels } : {},
1023
1024
  ...opts?.maxBytes != null ? { maxBytes: opts.maxBytes } : {}
1024
1025
  }
@@ -1252,7 +1253,18 @@ var params = {
1252
1253
  // `category` defaults to the most common role for the slot (overridable per call):
1253
1254
  // asset → start/end frame, sync audio (direct inputs to the output)
1254
1255
  // reference → ref images/videos/audios (guidance signals)
1255
- imageInput: (max = 1, label = "Start Image", required = false, category = "reference", minPixels) => p.file("imageUrls", "image", { array: { max }, label, required, category, ...minPixels != null ? { minPixels } : {} }),
1256
+ /** Array of image inputs (writes to `imageUrls`). `bounds` carries the
1257
+ * client-side dimension floors enforced at upload: `minPixels` for a vendor
1258
+ * rule stated as a total pixel count, `minSidePixels` for one stated per
1259
+ * side (width and height each), which is what most vendors publish. */
1260
+ imageInput: (max = 1, label = "Start Image", required = false, category = "reference", bounds) => p.file("imageUrls", "image", {
1261
+ array: { max },
1262
+ label,
1263
+ required,
1264
+ category,
1265
+ ...bounds?.minPixels != null ? { minPixels: bounds.minPixels } : {},
1266
+ ...bounds?.minSidePixels != null ? { minSidePixels: bounds.minSidePixels } : {}
1267
+ }),
1256
1268
  /** Single source-video slot (v2v / video edit). Writes to `videoUrl`.
1257
1269
  * `maxDurationSec` caps the source clip length, `maxShortSidePixels` caps
1258
1270
  * the shorter side (upscaler sources) and `maxBytes` caps the file size,
@@ -1268,15 +1280,17 @@ var params = {
1268
1280
  /** Single driving / sync-audio slot. Writes to `audioUrl`. */
1269
1281
  audioInput: (label = "Audio Track", required = false, category = "asset") => p.file("audioUrl", "audio", { label, required, category }),
1270
1282
  /** Array of reference videos (writes to `videoUrls`). Backend enforces
1271
- * per-model total-duration caps (e.g. ≤ 15s for seedance). `maxBytes` caps
1272
- * each individual clip's file size, enforced client-side at upload. */
1273
- videoInputs: (max = 3, label = "Reference Videos", required = false, minPixels, maxBytes) => p.file("videoUrls", "video", {
1283
+ * per-model total-duration caps (e.g. ≤ 15s for seedance). `bounds` carries
1284
+ * the client-side checks run at upload: `minPixels` for a total-pixel floor,
1285
+ * `minSidePixels` for a per-side one, `maxBytes` for each clip's file size. */
1286
+ videoInputs: (max = 3, label = "Reference Videos", required = false, bounds) => p.file("videoUrls", "video", {
1274
1287
  array: { max },
1275
1288
  label,
1276
1289
  required,
1277
1290
  category: "reference",
1278
- ...minPixels != null ? { minPixels } : {},
1279
- ...maxBytes != null ? { maxBytes } : {}
1291
+ ...bounds?.minPixels != null ? { minPixels: bounds.minPixels } : {},
1292
+ ...bounds?.minSidePixels != null ? { minSidePixels: bounds.minSidePixels } : {},
1293
+ ...bounds?.maxBytes != null ? { maxBytes: bounds.maxBytes } : {}
1280
1294
  }),
1281
1295
  /** Array of reference audios (writes to `audioUrls`). Backend enforces
1282
1296
  * per-model total-duration caps. */
@@ -3541,7 +3555,8 @@ registerPayloads(MODELS11, {
3541
3555
 
3542
3556
  // src/vendors/catalog/seedance.ts
3543
3557
  var SEEDANCE_FRAME_REF_REASON = "Start/End frames cannot be combined with reference images, videos, or audios";
3544
- var SEEDANCE_MIN_PIXELS = 409600;
3558
+ var SEEDANCE_MIN_SIDE_PIXELS = 300;
3559
+ var SEEDANCE_VIDEO_MIN_PIXELS = 407696;
3545
3560
  var SEEDANCE_25_MAX_VIDEO_BYTES = 209715200;
3546
3561
  var seedance20Constraints = [
3547
3562
  {
@@ -3792,8 +3807,12 @@ var { MODELS: MODELS12 } = defineModels("seedance", [
3792
3807
  ...params.returnLastFrame(),
3793
3808
  ...p.enum("outputFormat", ["mp4", "mov"], "mp4", { label: "Format" }),
3794
3809
  // 2.5 lifts the reference caps to 30 images / 10 videos / 10 audios.
3795
- ...params.imageInput(30, "Reference Images", false, "reference", SEEDANCE_MIN_PIXELS),
3796
- ...params.videoInputs(10, "Reference Videos", false, SEEDANCE_MIN_PIXELS, SEEDANCE_25_MAX_VIDEO_BYTES),
3810
+ ...params.imageInput(30, "Reference Images", false, "reference", { minSidePixels: SEEDANCE_MIN_SIDE_PIXELS }),
3811
+ ...params.videoInputs(10, "Reference Videos", false, {
3812
+ minPixels: SEEDANCE_VIDEO_MIN_PIXELS,
3813
+ minSidePixels: SEEDANCE_MIN_SIDE_PIXELS,
3814
+ maxBytes: SEEDANCE_25_MAX_VIDEO_BYTES
3815
+ }),
3797
3816
  ...params.audioInputs(10, "Reference Audios"),
3798
3817
  ...params.startFrame(),
3799
3818
  ...params.endFrame()
@@ -3847,7 +3866,7 @@ var { MODELS: MODELS12 } = defineModels("seedance", [
3847
3866
  ...params.durationRange(SEEDANCE_25_DURATION.min, SEEDANCE_25_DURATION.max, 15),
3848
3867
  ...params.generateAudio(),
3849
3868
  ...p.enum("outputFormat", ["mp4", "mov"], "mp4", { label: "Format" }),
3850
- ...params.videoInputs(10, "Source Videos", true, void 0, SEEDANCE_25_MAX_VIDEO_BYTES)
3869
+ ...params.videoInputs(10, "Source Videos", true, { maxBytes: SEEDANCE_25_MAX_VIDEO_BYTES })
3851
3870
  }
3852
3871
  },
3853
3872
  {
@@ -3873,8 +3892,11 @@ var { MODELS: MODELS12 } = defineModels("seedance", [
3873
3892
  ...params.returnLastFrame(),
3874
3893
  // Reference roles map directly to backend `reference_*` content entries.
3875
3894
  // start/end frame stay on their own named slots.
3876
- ...params.imageInput(9, "Reference Images", false, "reference", SEEDANCE_MIN_PIXELS),
3877
- ...params.videoInputs(3, "Reference Videos", false, SEEDANCE_MIN_PIXELS),
3895
+ ...params.imageInput(9, "Reference Images", false, "reference", { minSidePixels: SEEDANCE_MIN_SIDE_PIXELS }),
3896
+ ...params.videoInputs(3, "Reference Videos", false, {
3897
+ minPixels: SEEDANCE_VIDEO_MIN_PIXELS,
3898
+ minSidePixels: SEEDANCE_MIN_SIDE_PIXELS
3899
+ }),
3878
3900
  ...params.audioInputs(3, "Reference Audios"),
3879
3901
  ...params.startFrame(),
3880
3902
  ...params.endFrame()
@@ -3907,8 +3929,11 @@ var { MODELS: MODELS12 } = defineModels("seedance", [
3907
3929
  ...params.returnLastFrame(),
3908
3930
  // Reference roles map directly to backend `reference_*` content entries.
3909
3931
  // start/end frame stay on their own named slots.
3910
- ...params.imageInput(9, "Reference Images", false, "reference", SEEDANCE_MIN_PIXELS),
3911
- ...params.videoInputs(3, "Reference Videos", false, SEEDANCE_MIN_PIXELS),
3932
+ ...params.imageInput(9, "Reference Images", false, "reference", { minSidePixels: SEEDANCE_MIN_SIDE_PIXELS }),
3933
+ ...params.videoInputs(3, "Reference Videos", false, {
3934
+ minPixels: SEEDANCE_VIDEO_MIN_PIXELS,
3935
+ minSidePixels: SEEDANCE_MIN_SIDE_PIXELS
3936
+ }),
3912
3937
  ...params.audioInputs(3, "Reference Audios"),
3913
3938
  ...params.startFrame(),
3914
3939
  ...params.endFrame()
@@ -3937,8 +3962,11 @@ var { MODELS: MODELS12 } = defineModels("seedance", [
3937
3962
  ...params.returnLastFrame(),
3938
3963
  // Reference roles map directly to backend `reference_*` content entries.
3939
3964
  // start/end frame stay on their own named slots.
3940
- ...params.imageInput(9, "Reference Images", false, "reference", SEEDANCE_MIN_PIXELS),
3941
- ...params.videoInputs(3, "Reference Videos", false, SEEDANCE_MIN_PIXELS),
3965
+ ...params.imageInput(9, "Reference Images", false, "reference", { minSidePixels: SEEDANCE_MIN_SIDE_PIXELS }),
3966
+ ...params.videoInputs(3, "Reference Videos", false, {
3967
+ minPixels: SEEDANCE_VIDEO_MIN_PIXELS,
3968
+ minSidePixels: SEEDANCE_MIN_SIDE_PIXELS
3969
+ }),
3942
3970
  ...params.audioInputs(3, "Reference Audios"),
3943
3971
  ...params.startFrame(),
3944
3972
  ...params.endFrame()
@@ -3967,8 +3995,11 @@ var { MODELS: MODELS12 } = defineModels("seedance", [
3967
3995
  ...params.returnLastFrame(),
3968
3996
  // Reference roles map directly to backend `reference_*` content entries.
3969
3997
  // start/end frame stay on their own named slots.
3970
- ...params.imageInput(9, "Reference Images", false, "reference", SEEDANCE_MIN_PIXELS),
3971
- ...params.videoInputs(3, "Reference Videos", false, SEEDANCE_MIN_PIXELS),
3998
+ ...params.imageInput(9, "Reference Images", false, "reference", { minSidePixels: SEEDANCE_MIN_SIDE_PIXELS }),
3999
+ ...params.videoInputs(3, "Reference Videos", false, {
4000
+ minPixels: SEEDANCE_VIDEO_MIN_PIXELS,
4001
+ minSidePixels: SEEDANCE_MIN_SIDE_PIXELS
4002
+ }),
3972
4003
  ...params.audioInputs(3, "Reference Audios"),
3973
4004
  ...params.startFrame(),
3974
4005
  ...params.endFrame()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@picsart/ai-sdk",
3
- "version": "5.23.0",
3
+ "version": "5.24.0",
4
4
  "type": "module",
5
5
  "description": "Type-safe SDK for 100+ AI models — image, video, audio, and text generation with Picsart",
6
6
  "license": "MIT",