@picsart/ai-sdk 5.22.1 → 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 (4) hide show
  1. package/README.md +3 -3
  2. package/index.d.ts +15 -1
  3. package/index.js +110 -27
  4. package/package.json +1 -1
package/README.md CHANGED
@@ -144,10 +144,10 @@ catalog.find({ output: 'text' })
144
144
  image/video model throws, and `generate()` throws on a text model — use the matching
145
145
  method for each.
146
146
 
147
- ## Voice & Avatar Catalogs
147
+ ## Voice, Avatar & Template Catalogs
148
148
 
149
- Models with catalog-backed params (voices, avatars) serve their option lists
150
- from platform catalog tasks (`<vendor>/v1/catalog/<voices|avatars>`) — nothing
149
+ Models with catalog-backed params (voices, avatars, effect / caption templates) serve their option lists
150
+ from platform catalog tasks (`<vendor>/v1/catalog/<voices|avatars|templates|…>`) — nothing
151
151
  is bundled; the workers cache the lists and answer fast. Fetch them via
152
152
  `ai.catalogs`:
153
153
 
package/index.d.ts CHANGED
@@ -112,6 +112,10 @@ type ModelInputById = {
112
112
  "bytedance-video-upscaler": {
113
113
  videoUrl: string;
114
114
  };
115
+ "captionsai-video-captions": {
116
+ videoUrl: string;
117
+ templateId?: string;
118
+ };
115
119
  "claude-haiku-4-5": {
116
120
  prompt: string;
117
121
  imageUrls?: string[];
@@ -1824,6 +1828,15 @@ interface FileDescriptor {
1824
1828
  * backend worker stays the authoritative gate. Omit for no client-side floor.
1825
1829
  */
1826
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;
1827
1840
  /**
1828
1841
  * Max intrinsic short-side length (pixels) accepted for an image/video file —
1829
1842
  * `min(width, height)` must not exceed this. Used by upscalers whose source
@@ -2013,7 +2026,7 @@ interface ModelFilter$1 {
2013
2026
  release?: ReleaseTag[];
2014
2027
  }
2015
2028
 
2016
- type AppProvider = 'picsart' | 'google' | 'kling' | 'grok' | 'openai' | 'flux' | 'ideogram' | 'elevenlabs' | 'minimax' | 'wan' | 'seedance' | 'ltx' | 'seedream' | 'seedaudio' | 'hunyuan' | 'pika' | 'runway' | 'luma' | 'ovi' | 'creatify' | 'veed' | 'bytedance' | 'qwen' | 'reve' | 'recraft' | 'videography' | 'topaz' | 'heygen' | 'happyhorse' | 'pixverse' | 'anthropic' | 'async';
2029
+ type AppProvider = 'picsart' | 'google' | 'kling' | 'grok' | 'openai' | 'flux' | 'ideogram' | 'elevenlabs' | 'minimax' | 'wan' | 'seedance' | 'ltx' | 'seedream' | 'seedaudio' | 'hunyuan' | 'pika' | 'runway' | 'luma' | 'ovi' | 'creatify' | 'veed' | 'bytedance' | 'qwen' | 'reve' | 'recraft' | 'videography' | 'topaz' | 'heygen' | 'happyhorse' | 'pixverse' | 'anthropic' | 'async' | 'captionsai';
2017
2030
  /** Provider used by model definitions. */
2018
2031
  type Provider = AppProvider;
2019
2032
  /** App generation modes. */
@@ -2514,6 +2527,7 @@ declare const Models: {
2514
2527
  readonly BytedanceOmnihumanV15: "bytedance-omnihuman-v1.5";
2515
2528
  readonly BytedanceVideoEnhance: "bytedance-video-enhance";
2516
2529
  readonly BytedanceVideoUpscaler: "bytedance-video-upscaler";
2530
+ readonly CaptionsaiVideoCaptions: "captionsai-video-captions";
2517
2531
  readonly ClaudeHaiku45: "claude-haiku-4-5";
2518
2532
  readonly ClaudeOpus48: "claude-opus-4-8";
2519
2533
  readonly ClaudeSonnet46: "claude-sonnet-4-6";
package/index.js CHANGED
@@ -820,7 +820,8 @@ var providers = {
820
820
  happyhorse: { color: "#FF6A00", label: "HH", name: "Happy Horse" },
821
821
  pixverse: { color: "#7C3AED", label: "PV", name: "PixVerse" },
822
822
  anthropic: { color: "#D97757", label: "CL", name: "Anthropic" },
823
- async: { color: "#5E5CE6", label: "AA", name: "Async AI" }
823
+ async: { color: "#5E5CE6", label: "AA", name: "Async AI" },
824
+ captionsai: { color: "#1D1F20", label: "MR", name: "Mirage" }
824
825
  };
825
826
 
826
827
  // src/core/descriptors/presets.ts
@@ -1018,6 +1019,7 @@ var p = {
1018
1019
  ...opts?.array ? { array: opts.array } : {},
1019
1020
  ...opts?.maxDurationSec != null ? { maxDurationSec: opts.maxDurationSec } : {},
1020
1021
  ...opts?.minPixels != null ? { minPixels: opts.minPixels } : {},
1022
+ ...opts?.minSidePixels != null ? { minSidePixels: opts.minSidePixels } : {},
1021
1023
  ...opts?.maxShortSidePixels != null ? { maxShortSidePixels: opts.maxShortSidePixels } : {},
1022
1024
  ...opts?.maxBytes != null ? { maxBytes: opts.maxBytes } : {}
1023
1025
  }
@@ -1175,7 +1177,7 @@ var passthroughPayload = (paramConfig) => (ctx) => {
1175
1177
  return payload;
1176
1178
  };
1177
1179
  function defineModels(provider, configs) {
1178
- const MODELS37 = [];
1180
+ const MODELS38 = [];
1179
1181
  for (const c of configs) {
1180
1182
  const prov = c.provider ?? provider;
1181
1183
  const resolvedPayload = c.buildPayload ?? passthroughPayload(c.paramConfig);
@@ -1211,19 +1213,19 @@ function defineModels(provider, configs) {
1211
1213
  if (c.constraints !== void 0) model.constraints = c.constraints;
1212
1214
  const contract = createModelContract(model);
1213
1215
  model.outputSchema = c.outputSchema ?? contract.output;
1214
- MODELS37.push(model);
1216
+ MODELS38.push(model);
1215
1217
  }
1216
- return { MODELS: MODELS37 };
1218
+ return { MODELS: MODELS38 };
1217
1219
  }
1218
- function registerPayloads(MODELS37, payloads) {
1220
+ function registerPayloads(MODELS38, payloads) {
1219
1221
  for (const [id, builder] of Object.entries(payloads)) {
1220
- const model = MODELS37.find((m) => m.id === id);
1222
+ const model = MODELS38.find((m) => m.id === id);
1221
1223
  if (model) model.buildPayload = builder;
1222
1224
  }
1223
1225
  }
1224
- function registerEditPayloads(MODELS37, payloads) {
1226
+ function registerEditPayloads(MODELS38, payloads) {
1225
1227
  for (const [id, builder] of Object.entries(payloads)) {
1226
- const model = MODELS37.find((m) => m.id === id);
1228
+ const model = MODELS38.find((m) => m.id === id);
1227
1229
  if (model) model.buildEditPayload = builder;
1228
1230
  }
1229
1231
  }
@@ -1251,7 +1253,18 @@ var params = {
1251
1253
  // `category` defaults to the most common role for the slot (overridable per call):
1252
1254
  // asset → start/end frame, sync audio (direct inputs to the output)
1253
1255
  // reference → ref images/videos/audios (guidance signals)
1254
- 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
+ }),
1255
1268
  /** Single source-video slot (v2v / video edit). Writes to `videoUrl`.
1256
1269
  * `maxDurationSec` caps the source clip length, `maxShortSidePixels` caps
1257
1270
  * the shorter side (upscaler sources) and `maxBytes` caps the file size,
@@ -1267,15 +1280,17 @@ var params = {
1267
1280
  /** Single driving / sync-audio slot. Writes to `audioUrl`. */
1268
1281
  audioInput: (label = "Audio Track", required = false, category = "asset") => p.file("audioUrl", "audio", { label, required, category }),
1269
1282
  /** Array of reference videos (writes to `videoUrls`). Backend enforces
1270
- * per-model total-duration caps (e.g. ≤ 15s for seedance). `maxBytes` caps
1271
- * each individual clip's file size, enforced client-side at upload. */
1272
- 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", {
1273
1287
  array: { max },
1274
1288
  label,
1275
1289
  required,
1276
1290
  category: "reference",
1277
- ...minPixels != null ? { minPixels } : {},
1278
- ...maxBytes != null ? { maxBytes } : {}
1291
+ ...bounds?.minPixels != null ? { minPixels: bounds.minPixels } : {},
1292
+ ...bounds?.minSidePixels != null ? { minSidePixels: bounds.minSidePixels } : {},
1293
+ ...bounds?.maxBytes != null ? { maxBytes: bounds.maxBytes } : {}
1279
1294
  }),
1280
1295
  /** Array of reference audios (writes to `audioUrls`). Backend enforces
1281
1296
  * per-model total-duration caps. */
@@ -3540,7 +3555,8 @@ registerPayloads(MODELS11, {
3540
3555
 
3541
3556
  // src/vendors/catalog/seedance.ts
3542
3557
  var SEEDANCE_FRAME_REF_REASON = "Start/End frames cannot be combined with reference images, videos, or audios";
3543
- var SEEDANCE_MIN_PIXELS = 409600;
3558
+ var SEEDANCE_MIN_SIDE_PIXELS = 300;
3559
+ var SEEDANCE_VIDEO_MIN_PIXELS = 407696;
3544
3560
  var SEEDANCE_25_MAX_VIDEO_BYTES = 209715200;
3545
3561
  var seedance20Constraints = [
3546
3562
  {
@@ -3791,8 +3807,12 @@ var { MODELS: MODELS12 } = defineModels("seedance", [
3791
3807
  ...params.returnLastFrame(),
3792
3808
  ...p.enum("outputFormat", ["mp4", "mov"], "mp4", { label: "Format" }),
3793
3809
  // 2.5 lifts the reference caps to 30 images / 10 videos / 10 audios.
3794
- ...params.imageInput(30, "Reference Images", false, "reference", SEEDANCE_MIN_PIXELS),
3795
- ...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
+ }),
3796
3816
  ...params.audioInputs(10, "Reference Audios"),
3797
3817
  ...params.startFrame(),
3798
3818
  ...params.endFrame()
@@ -3846,7 +3866,7 @@ var { MODELS: MODELS12 } = defineModels("seedance", [
3846
3866
  ...params.durationRange(SEEDANCE_25_DURATION.min, SEEDANCE_25_DURATION.max, 15),
3847
3867
  ...params.generateAudio(),
3848
3868
  ...p.enum("outputFormat", ["mp4", "mov"], "mp4", { label: "Format" }),
3849
- ...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 })
3850
3870
  }
3851
3871
  },
3852
3872
  {
@@ -3872,8 +3892,11 @@ var { MODELS: MODELS12 } = defineModels("seedance", [
3872
3892
  ...params.returnLastFrame(),
3873
3893
  // Reference roles map directly to backend `reference_*` content entries.
3874
3894
  // start/end frame stay on their own named slots.
3875
- ...params.imageInput(9, "Reference Images", false, "reference", SEEDANCE_MIN_PIXELS),
3876
- ...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
+ }),
3877
3900
  ...params.audioInputs(3, "Reference Audios"),
3878
3901
  ...params.startFrame(),
3879
3902
  ...params.endFrame()
@@ -3906,8 +3929,11 @@ var { MODELS: MODELS12 } = defineModels("seedance", [
3906
3929
  ...params.returnLastFrame(),
3907
3930
  // Reference roles map directly to backend `reference_*` content entries.
3908
3931
  // start/end frame stay on their own named slots.
3909
- ...params.imageInput(9, "Reference Images", false, "reference", SEEDANCE_MIN_PIXELS),
3910
- ...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
+ }),
3911
3937
  ...params.audioInputs(3, "Reference Audios"),
3912
3938
  ...params.startFrame(),
3913
3939
  ...params.endFrame()
@@ -3936,8 +3962,11 @@ var { MODELS: MODELS12 } = defineModels("seedance", [
3936
3962
  ...params.returnLastFrame(),
3937
3963
  // Reference roles map directly to backend `reference_*` content entries.
3938
3964
  // start/end frame stay on their own named slots.
3939
- ...params.imageInput(9, "Reference Images", false, "reference", SEEDANCE_MIN_PIXELS),
3940
- ...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
+ }),
3941
3970
  ...params.audioInputs(3, "Reference Audios"),
3942
3971
  ...params.startFrame(),
3943
3972
  ...params.endFrame()
@@ -3966,8 +3995,11 @@ var { MODELS: MODELS12 } = defineModels("seedance", [
3966
3995
  ...params.returnLastFrame(),
3967
3996
  // Reference roles map directly to backend `reference_*` content entries.
3968
3997
  // start/end frame stay on their own named slots.
3969
- ...params.imageInput(9, "Reference Images", false, "reference", SEEDANCE_MIN_PIXELS),
3970
- ...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
+ }),
3971
4003
  ...params.audioInputs(3, "Reference Audios"),
3972
4004
  ...params.startFrame(),
3973
4005
  ...params.endFrame()
@@ -8481,6 +8513,54 @@ registerPayloads(MODELS36, {
8481
8513
  "gemini-3.5-flash-lite": buildOpenAiPayload("gemini-3.5-flash-lite")
8482
8514
  });
8483
8515
 
8516
+ // src/vendors/catalog/captionsai.ts
8517
+ var CAPTIONS_MAX_DURATION_SEC = 300;
8518
+ var CAPTIONS_MAX_BYTES = 50 * 1024 * 1024;
8519
+ var DEFAULT_CAPTION_TEMPLATE_ID = "ctpl_DxflLOnuKkb198FNdI9E";
8520
+ var { MODELS: MODELS37 } = defineModels("captionsai", [
8521
+ {
8522
+ id: "captionsai-video-captions",
8523
+ name: "Captions",
8524
+ modelId: "mirage-captions",
8525
+ addedAt: "2026-08-27",
8526
+ workflow: "captionsai/v1/videos/captions",
8527
+ // ~26s measured for an 8s clip on the live API; scales with clip length.
8528
+ estimatedTime: 60,
8529
+ mode: "video",
8530
+ inputType: "v2v",
8531
+ // Stage-only until the worker is deployed to prod and the pricing record
8532
+ // (mirage-captions / video-to-video) exists — flip to production then.
8533
+ release: "preview",
8534
+ description: "Auto-transcribes a vertical video and burns in animated captions from 67 style templates \u2014 up to 5 minutes, 9:16.",
8535
+ features: [
8536
+ feat("Video Required", "input"),
8537
+ feat("9:16", "resolution"),
8538
+ feat("Up to 5 min", "duration"),
8539
+ feat("67 Templates", "style")
8540
+ ],
8541
+ paramConfig: {
8542
+ ...params.videoInput("Source Video", "asset", true, CAPTIONS_MAX_DURATION_SEC, void 0, CAPTIONS_MAX_BYTES),
8543
+ ...params.catalog("templateId", {
8544
+ label: "Caption Style",
8545
+ // Not `required`: the declared default fills it, and request validation runs
8546
+ // before the payload builder — a required flag would reject the very
8547
+ // calls the default exists for (same shape as Kling's effect templateId).
8548
+ source: { workflow: "captionsai/v1/catalog/caption-templates" },
8549
+ default: DEFAULT_CAPTION_TEMPLATE_ID
8550
+ })
8551
+ }
8552
+ }
8553
+ ]);
8554
+
8555
+ // src/vendors/catalog/captionsai.payloads.ts
8556
+ var buildCaptionsPayload = (input) => ({
8557
+ video: { url: input.videoUrl },
8558
+ caption_template_id: input.templateId ?? DEFAULT_CAPTION_TEMPLATE_ID
8559
+ });
8560
+ registerPayloads(MODELS37, {
8561
+ "captionsai-video-captions": buildCaptionsPayload
8562
+ });
8563
+
8484
8564
  // src/vendors/catalog/index.ts
8485
8565
  var ALL_MODELS = [
8486
8566
  ...MODELS,
@@ -8518,7 +8598,8 @@ var ALL_MODELS = [
8518
8598
  ...MODELS33,
8519
8599
  ...MODELS34,
8520
8600
  ...MODELS35,
8521
- ...MODELS36
8601
+ ...MODELS36,
8602
+ ...MODELS37
8522
8603
  ];
8523
8604
  var getModelsByMode = (mode, includeDisabled = false) => ALL_MODELS.filter((m) => m.mode === mode && (includeDisabled || isVisibleForReleases(m)));
8524
8605
 
@@ -10610,6 +10691,7 @@ var AsyncFlashV1 = "async-flash-v1";
10610
10691
  var BytedanceOmnihumanV15 = "bytedance-omnihuman-v1.5";
10611
10692
  var BytedanceVideoEnhance = "bytedance-video-enhance";
10612
10693
  var BytedanceVideoUpscaler = "bytedance-video-upscaler";
10694
+ var CaptionsaiVideoCaptions = "captionsai-video-captions";
10613
10695
  var ClaudeHaiku45 = "claude-haiku-4-5";
10614
10696
  var ClaudeOpus48 = "claude-opus-4-8";
10615
10697
  var ClaudeSonnet46 = "claude-sonnet-4-6";
@@ -10821,6 +10903,7 @@ var Models = {
10821
10903
  BytedanceOmnihumanV15,
10822
10904
  BytedanceVideoEnhance,
10823
10905
  BytedanceVideoUpscaler,
10906
+ CaptionsaiVideoCaptions,
10824
10907
  ClaudeHaiku45,
10825
10908
  ClaudeOpus48,
10826
10909
  ClaudeSonnet46,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@picsart/ai-sdk",
3
- "version": "5.22.1",
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",