@picsart/ai-sdk 5.26.1 → 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.
Files changed (3) hide show
  1. package/index.d.ts +27 -20
  2. package/index.js +140 -59
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -142,19 +142,14 @@ type ModelInputById = {
142
142
  };
143
143
  "eleven-dubbing": {
144
144
  audioUrl: string;
145
- language?: string;
146
- accent?: string;
145
+ language: string;
147
146
  };
148
147
  "eleven-multilingual-sts-v2": {
149
148
  audioUrl: string;
150
149
  voiceId?: string;
151
- language?: string;
152
- accent?: string;
153
150
  removeBackgroundNoise?: boolean;
154
151
  };
155
152
  "eleven-multilingual-v2": {
156
- language?: string;
157
- accent?: string;
158
153
  prompt: string;
159
154
  voiceId?: string;
160
155
  };
@@ -165,7 +160,6 @@ type ModelInputById = {
165
160
  };
166
161
  "eleven-v3": {
167
162
  language?: string;
168
- accent?: string;
169
163
  prompt: string;
170
164
  voiceId?: string;
171
165
  };
@@ -179,7 +173,7 @@ type ModelInputById = {
179
173
  prompt: string;
180
174
  };
181
175
  "eleven-voice-remix": {
182
- voiceId?: string;
176
+ voiceId: string;
183
177
  prompt: string;
184
178
  };
185
179
  "elevenlabs-music-v2": {
@@ -189,7 +183,7 @@ type ModelInputById = {
189
183
  };
190
184
  "elevenlabs-sfx": {
191
185
  prompt: string;
192
- duration?: 1 | 3 | 5 | 8 | 10 | 15;
186
+ duration?: number;
193
187
  };
194
188
  "flux-2-flex": {
195
189
  prompt: string;
@@ -427,20 +421,23 @@ type ModelInputById = {
427
421
  };
428
422
  "happyhorse-1.0-r2v": {
429
423
  prompt: string;
424
+ seed?: number;
430
425
  aspectRatio?: "16:9" | "9:16" | "1:1" | "4:3" | "3:4";
431
426
  resolution?: "720P" | "1080P";
432
- duration?: 5 | 10 | 15;
427
+ duration?: number;
433
428
  imageUrls: [string, ...string[]];
434
429
  };
435
430
  "happyhorse-1.0-t2v": {
436
431
  prompt: string;
432
+ seed?: number;
437
433
  aspectRatio?: "16:9" | "9:16" | "1:1" | "4:3" | "3:4";
438
434
  resolution?: "720P" | "1080P";
439
- duration?: 5 | 10 | 15;
435
+ duration?: number;
440
436
  startFrame?: string;
441
437
  };
442
438
  "happyhorse-1.0-video-edit": {
443
439
  prompt: string;
440
+ seed?: number;
444
441
  resolution?: "720P" | "1080P";
445
442
  audioSetting?: "auto" | "origin";
446
443
  videoUrl: string;
@@ -448,16 +445,18 @@ type ModelInputById = {
448
445
  };
449
446
  "happyhorse-1.1-r2v": {
450
447
  prompt: string;
448
+ seed?: number;
451
449
  aspectRatio?: "16:9" | "9:16" | "1:1" | "4:3" | "3:4";
452
450
  resolution?: "720P" | "1080P";
453
- duration?: 5 | 10 | 15;
451
+ duration?: number;
454
452
  imageUrls: [string, ...string[]];
455
453
  };
456
454
  "happyhorse-1.1-t2v": {
457
455
  prompt: string;
456
+ seed?: number;
458
457
  aspectRatio?: "16:9" | "9:16" | "1:1" | "4:3" | "3:4";
459
458
  resolution?: "720P" | "1080P";
460
- duration?: 5 | 10 | 15;
459
+ duration?: number;
461
460
  startFrame?: string;
462
461
  };
463
462
  "heygen-talking-photo": {
@@ -966,7 +965,6 @@ type ModelInputById = {
966
965
  };
967
966
  "qwen": {
968
967
  prompt: string;
969
- count?: 1 | 2 | 4 | 6 | 8 | 10;
970
968
  imageUrls?: string[];
971
969
  };
972
970
  "qwen-image-2": {
@@ -981,6 +979,7 @@ type ModelInputById = {
981
979
  count?: 1 | 2 | 4 | 6;
982
980
  enhancePrompt?: boolean;
983
981
  imageUrls?: string[];
982
+ seed?: number;
984
983
  };
985
984
  "qwen-image-3.0": {
986
985
  prompt: string;
@@ -989,6 +988,7 @@ type ModelInputById = {
989
988
  count?: 1 | 2 | 4 | 6;
990
989
  enhancePrompt?: boolean;
991
990
  imageUrls?: string[];
991
+ seed?: number;
992
992
  promptExtendMode?: "direct" | "agent";
993
993
  enableThinking?: boolean;
994
994
  };
@@ -999,6 +999,7 @@ type ModelInputById = {
999
999
  count?: 1 | 2 | 4 | 6;
1000
1000
  enhancePrompt?: boolean;
1001
1001
  imageUrls?: string[];
1002
+ seed?: number;
1002
1003
  promptExtendMode?: "direct" | "agent";
1003
1004
  enableThinking?: boolean;
1004
1005
  };
@@ -1523,7 +1524,6 @@ type ModelInputById = {
1523
1524
  resolution?: "480p" | "720p" | "1080p";
1524
1525
  aspectRatio?: "16:9" | "9:16" | "1:1" | "4:3" | "3:4";
1525
1526
  negativePrompt?: string;
1526
- cfgScale?: number;
1527
1527
  startFrame?: string;
1528
1528
  };
1529
1529
  "wan-2.7-i2v": {
@@ -1535,6 +1535,7 @@ type ModelInputById = {
1535
1535
  startFrame: string;
1536
1536
  endFrame?: string;
1537
1537
  audioUrl?: string;
1538
+ seed?: number;
1538
1539
  };
1539
1540
  "wan-2.7-r2v": {
1540
1541
  prompt: string;
@@ -1544,6 +1545,7 @@ type ModelInputById = {
1544
1545
  negativePrompt?: string;
1545
1546
  imageUrls: [string, ...string[]];
1546
1547
  videoUrl: string;
1548
+ seed?: number;
1547
1549
  };
1548
1550
  "wan-2.7-t2v": {
1549
1551
  prompt: string;
@@ -1554,6 +1556,7 @@ type ModelInputById = {
1554
1556
  enhancePrompt?: boolean;
1555
1557
  audioUrl?: string;
1556
1558
  startFrame?: string;
1559
+ seed?: number;
1557
1560
  };
1558
1561
  "wan-2.7-video-edit": {
1559
1562
  prompt?: string;
@@ -1562,10 +1565,13 @@ type ModelInputById = {
1562
1565
  negativePrompt?: string;
1563
1566
  videoUrl: string;
1564
1567
  imageUrls?: string[];
1568
+ audioSetting?: "auto" | "origin";
1569
+ duration?: number;
1570
+ seed?: number;
1565
1571
  };
1566
1572
  "wan-3.0-video": {
1567
- prompt: string;
1568
- duration?: 5 | 10 | 15 | 30;
1573
+ prompt?: string;
1574
+ duration?: -1 | 5 | 10 | 15 | 30;
1569
1575
  resolution?: "480P" | "720P" | "1080P";
1570
1576
  aspectRatio?: "16:9" | "9:16" | "1:1" | "4:3" | "3:4" | "adaptive";
1571
1577
  generateAudio?: boolean;
@@ -1579,8 +1585,8 @@ type ModelInputById = {
1579
1585
  seed?: number;
1580
1586
  };
1581
1587
  "wan-3.0-video-prime": {
1582
- prompt: string;
1583
- duration?: 5 | 10 | 15 | 30;
1588
+ prompt?: string;
1589
+ duration?: -1 | 5 | 10 | 15 | 30;
1584
1590
  resolution?: "480P" | "720P" | "1080P";
1585
1591
  aspectRatio?: "16:9" | "9:16" | "1:1" | "4:3" | "3:4" | "adaptive";
1586
1592
  generateAudio?: boolean;
@@ -1814,7 +1820,8 @@ interface RangeDescriptor {
1814
1820
  min: number;
1815
1821
  max: number;
1816
1822
  step?: number;
1817
- default: number;
1823
+ /** Optional: default-less ranges (e.g. seed) are sent only when set. */
1824
+ default?: number;
1818
1825
  }
1819
1826
  interface BooleanDescriptor {
1820
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.aspectRatio ? { aspect_ratio: ctx.aspectRatio } : {}
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, 3)) media.push({ type: "reference_image", url });
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
- ...params.prompt(),
3108
- ...params.duration([5, 10, 15, 30], 5),
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
- ...params.aspectRatio(["16:9", "9:16", "1:1", "4:3", "3:4", "adaptive"]),
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
- ...p.range("seed", 0, 2147483647, 0, { label: "Seed" })
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, cfg adjustable.",
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
- ...params.imageInput(3, "Reference Images")
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
- ratio: input.aspectRatio ?? "16:9",
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,
@@ -6172,8 +6225,9 @@ var buildElevenLabsDubbingPayload = (ctx) => ({
6172
6225
  target_lang: ctx.language
6173
6226
  });
6174
6227
  var buildElevenLabsVoiceRemixPayload = (ctx) => ({
6175
- voice_id: ctx.voiceId ?? DEFAULT_VOICE_ID,
6176
- voice_description: ctx.prompt
6228
+ voice_id: ctx.voiceId,
6229
+ voice_description: ctx.prompt,
6230
+ auto_generate_text: true
6177
6231
  });
6178
6232
  var buildElevenLabsVoiceDesignPayload = (modelId) => (ctx) => ({
6179
6233
  voice_description: ctx.prompt,
@@ -6184,8 +6238,11 @@ var buildElevenLabsVoicePreviewsPayload = (ctx) => ({
6184
6238
  voice_description: ctx.prompt,
6185
6239
  auto_generate_text: true
6186
6240
  });
6187
- var ttsParamConfig = (promptMaxLength) => ({
6188
- ...params.language(true),
6241
+ var ttsParamConfig = (promptMaxLength, withLanguage) => ({
6242
+ // language_code is honoured by eleven_v3 only — the vendor documents it as
6243
+ // "not supported for multilingual_v2 models" (silently ignored there).
6244
+ // No accent param anywhere: no builder ever read it.
6245
+ ...withLanguage ? params.language(false) : {},
6189
6246
  ...params.prompt({ maxLength: promptMaxLength }),
6190
6247
  ...params.voiceId([], DEFAULT_VOICE_ID, { catalog: { workflow: "elevenlabs/v1/catalog/voices" } })
6191
6248
  });
@@ -6204,7 +6261,7 @@ var { MODELS: MODELS24 } = defineModels("elevenlabs", [
6204
6261
  badge: ["popular"],
6205
6262
  description: "Latest voice engine with expanded tone and pacing control.",
6206
6263
  features: [feat("Experimental", "characteristic"), feat("Creative Control", "characteristic")],
6207
- paramConfig: ttsParamConfig(5e3)
6264
+ paramConfig: ttsParamConfig(5e3, true)
6208
6265
  },
6209
6266
  {
6210
6267
  id: "eleven-multilingual-v2",
@@ -6219,7 +6276,7 @@ var { MODELS: MODELS24 } = defineModels("elevenlabs", [
6219
6276
  badge: ["popular", "fast"],
6220
6277
  description: "Stable multilingual speech across 29+ languages with natural rhythm.",
6221
6278
  features: [feat("Stable", "characteristic"), feat("Professional", "characteristic")],
6222
- paramConfig: ttsParamConfig(1e4)
6279
+ paramConfig: ttsParamConfig(1e4, false)
6223
6280
  },
6224
6281
  // ── Sound Effects ─────────────────────────────────────────────────
6225
6282
  {
@@ -6233,9 +6290,9 @@ var { MODELS: MODELS24 } = defineModels("elevenlabs", [
6233
6290
  mode: "audio",
6234
6291
  inputType: "sfx",
6235
6292
  badge: ["popular"],
6236
- description: "Create custom sound effects from a text description \u2014 up to 15 seconds.",
6293
+ description: "Create custom sound effects from a text description \u2014 up to 30 seconds.",
6237
6294
  features: [feat("Sound Effects", "characteristic")],
6238
- paramConfig: { ...params.prompt(), ...params.duration([1, 3, 5, 8, 10, 15], 5) }
6295
+ paramConfig: { ...params.prompt(), ...params.durationRange(0.5, 30, 5, 0.5) }
6239
6296
  },
6240
6297
  // ── Music ─────────────────────────────────────────────────────────
6241
6298
  {
@@ -6289,7 +6346,6 @@ var { MODELS: MODELS24 } = defineModels("elevenlabs", [
6289
6346
  paramConfig: {
6290
6347
  ...params.audioInput("Speech Audio", true),
6291
6348
  ...params.voiceId([], DEFAULT_VOICE_ID, { catalog: { workflow: "elevenlabs/v1/catalog/voices" } }),
6292
- ...params.language(true),
6293
6349
  ...p.boolean("removeBackgroundNoise", false, "Remove Background Noise")
6294
6350
  }
6295
6351
  },
@@ -6320,7 +6376,12 @@ var { MODELS: MODELS24 } = defineModels("elevenlabs", [
6320
6376
  features: [feat("Multilingual", "characteristic"), feat("Dubbing", "characteristic")],
6321
6377
  paramConfig: {
6322
6378
  ...params.audioInput("Source Audio", true),
6323
- ...params.language(true)
6379
+ // target_lang is the vendor's only required field (ISO 639-1/639-3 code).
6380
+ language: {
6381
+ label: "Target Language (ISO 639 code)",
6382
+ required: true,
6383
+ descriptor: { kind: "text", placeholder: "e.g. es, fr, de" }
6384
+ }
6324
6385
  }
6325
6386
  },
6326
6387
  // ── Voice Design ────────────────────────────────────────────────
@@ -6337,8 +6398,14 @@ var { MODELS: MODELS24 } = defineModels("elevenlabs", [
6337
6398
  description: "Remix voice characteristics by describing the desired vocal style.",
6338
6399
  features: [feat("Voice Design", "characteristic"), feat("Remix", "characteristic")],
6339
6400
  paramConfig: {
6340
- ...params.voiceId([], DEFAULT_VOICE_ID, { catalog: { workflow: "elevenlabs/v1/catalog/voices" } }),
6341
- ...params.prompt({ maxLength: 1e3 })
6401
+ // Vendor: "Only your own custom voices can be remixed" the premade
6402
+ // voices catalog cannot serve this model, so voiceId is a plain id input.
6403
+ voiceId: {
6404
+ label: "Voice ID (a custom voice from your workspace)",
6405
+ required: true,
6406
+ descriptor: { kind: "text", placeholder: "Premade/catalog voices are rejected by ElevenLabs" }
6407
+ },
6408
+ ...params.prompt({ minLength: 5, maxLength: 1e3 })
6342
6409
  }
6343
6410
  },
6344
6411
  {
@@ -6353,7 +6420,7 @@ var { MODELS: MODELS24 } = defineModels("elevenlabs", [
6353
6420
  inputType: "tts",
6354
6421
  description: "Design a new voice from a text description using v3 engine.",
6355
6422
  features: [feat("Voice Design", "characteristic"), feat("Preview", "characteristic")],
6356
- paramConfig: { ...params.prompt({ maxLength: 1e3 }) }
6423
+ paramConfig: { ...params.prompt({ minLength: 20, maxLength: 1e3 }) }
6357
6424
  },
6358
6425
  {
6359
6426
  id: "eleven-voice-design-v2",
@@ -6367,7 +6434,7 @@ var { MODELS: MODELS24 } = defineModels("elevenlabs", [
6367
6434
  inputType: "tts",
6368
6435
  description: "Design a new voice from a text description with multilingual support.",
6369
6436
  features: [feat("Voice Design", "characteristic"), feat("Multilingual", "characteristic"), feat("Preview", "characteristic")],
6370
- paramConfig: { ...params.prompt({ maxLength: 1e3 }) }
6437
+ paramConfig: { ...params.prompt({ minLength: 20, maxLength: 1e3 }) }
6371
6438
  },
6372
6439
  {
6373
6440
  id: "eleven-voice-create",
@@ -6380,7 +6447,7 @@ var { MODELS: MODELS24 } = defineModels("elevenlabs", [
6380
6447
  inputType: "tts",
6381
6448
  description: "Generate voice previews from a description to audition before committing.",
6382
6449
  features: [feat("Voice Design", "characteristic"), feat("Preview", "characteristic")],
6383
- paramConfig: { ...params.prompt({ maxLength: 1e3 }) }
6450
+ paramConfig: { ...params.prompt({ minLength: 20, maxLength: 1e3 }) }
6384
6451
  }
6385
6452
  ]);
6386
6453
 
@@ -6923,35 +6990,40 @@ var buildQwen2Payload = (ctx) => {
6923
6990
  const hasImages = Array.isArray(ctx.imageUrls) && ctx.imageUrls.length > 0;
6924
6991
  return {
6925
6992
  prompt: ctx.prompt,
6993
+ num_images: ctx.count ?? 1,
6926
6994
  ...hasImages ? { image_urls: ctx.imageUrls } : {}
6927
6995
  };
6928
6996
  };
6929
6997
  var buildQwenV1 = (model) => (ctx) => {
6930
6998
  const hasImages = Array.isArray(ctx.imageUrls) && ctx.imageUrls.length > 0;
6931
- const promptExtendMode = ctx.promptExtendMode === "agent" && hasImages && model === "qwen-image-3.0-pro" ? void 0 : ctx.promptExtendMode;
6999
+ const promptExtendMode = ctx.promptExtendMode === "agent" && hasImages && model.startsWith("qwen-image-3.0") ? void 0 : ctx.promptExtendMode;
7000
+ const promptExtend = ctx.enhancePrompt ?? true;
6932
7001
  return {
6933
7002
  prompt: ctx.prompt,
6934
7003
  model,
6935
7004
  ...hasImages ? { image_urls: ctx.imageUrls } : {},
6936
7005
  ...ctx.negativePrompt ? { negative_prompt: ctx.negativePrompt } : {},
6937
- size: (ctx.resolution ?? "2048x2048").replace("x", "*"),
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", "*") },
6938
7009
  n: ctx.count ?? 1,
6939
- prompt_extend: ctx.enhancePrompt ?? true,
7010
+ prompt_extend: promptExtend,
6940
7011
  // Qwen 3.0 family only — prompt-rewrite strategy (direct/agent); 2.x ignores it.
6941
7012
  ...promptExtendMode ? { prompt_extend_mode: promptExtendMode } : {},
6942
- // Qwen 3.0 family only — thinking mode (requires prompt_extend).
6943
- ...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 } : {},
6944
7015
  watermark: false,
6945
7016
  ...ctx.seed != null ? { seed: ctx.seed } : {}
6946
7017
  };
6947
7018
  };
6948
7019
  var qwenV1Params = {
6949
7020
  ...params.prompt({ maxLength: 800 }),
6950
- ...params.negativePrompt(),
7021
+ ...params.negativePrompt(void 0, 500),
6951
7022
  ...params.resolution(QWEN_V1_SIZES, "2048x2048"),
6952
7023
  ...params.count([1, 2, 4, 6]),
6953
7024
  ...params.enhancePrompt(true),
6954
- ...params.imageInput(3, "Source Images")
7025
+ ...params.imageInput(3, "Source Images"),
7026
+ ...params.seed()
6955
7027
  };
6956
7028
  var qwenV1Params3 = {
6957
7029
  ...qwenV1Params,
@@ -6975,7 +7047,6 @@ var { MODELS: MODELS28 } = defineModels("qwen", [
6975
7047
  features: [feat("Image Input", "input"), feat("1K", "resolution")],
6976
7048
  paramConfig: {
6977
7049
  ...params.prompt(),
6978
- ...params.count(),
6979
7050
  ...params.imageInput(1, "Source Image")
6980
7051
  }
6981
7052
  },
@@ -6983,6 +7054,8 @@ var { MODELS: MODELS28 } = defineModels("qwen", [
6983
7054
  id: "qwen-image-2",
6984
7055
  name: "Qwen 2",
6985
7056
  addedAt: "2026-03-27",
7057
+ deprecated: true,
7058
+ // fal marks both endpoints 'no longer supported' — use qwen-image-3.0
6986
7059
  workflow: "qwen-image-2/text-to-image",
6987
7060
  editWorkflow: "qwen-image-2/edit",
6988
7061
  buildPayload: buildQwen2Payload,
@@ -8157,7 +8230,6 @@ var buildHH11R2VPayload = (ctx) => {
8157
8230
  };
8158
8231
  var HH_AR = ["16:9", "9:16", "1:1", "4:3", "3:4"];
8159
8232
  var HH_RES = ["720P", "1080P"];
8160
- var HH_DURATIONS = [5, 10, 15];
8161
8233
  var { MODELS: MODELS33 } = defineModels("happyhorse", [
8162
8234
  {
8163
8235
  id: "happyhorse-1.0-t2v",
@@ -8175,13 +8247,15 @@ var { MODELS: MODELS33 } = defineModels("happyhorse", [
8175
8247
  features: [
8176
8248
  feat("Start Frame", "frame"),
8177
8249
  feat("1080P", "resolution"),
8178
- feat("5/10/15 sec", "duration")
8250
+ feat("3-15 sec", "duration")
8179
8251
  ],
8180
8252
  paramConfig: {
8181
8253
  ...params.prompt({ maxLength: 2500 }),
8254
+ ...params.seed(),
8182
8255
  ...params.aspectRatio(HH_AR, "16:9"),
8183
8256
  ...params.resolution(HH_RES, "720P"),
8184
- ...params.duration(HH_DURATIONS, 5),
8257
+ // Vendor/worker accept any integer 3-15 (docs: default 5).
8258
+ ...params.durationRange(3, 15, 5),
8185
8259
  ...params.startFrame()
8186
8260
  }
8187
8261
  },
@@ -8200,13 +8274,15 @@ var { MODELS: MODELS33 } = defineModels("happyhorse", [
8200
8274
  features: [
8201
8275
  feat("Multi-Image Input", "input"),
8202
8276
  feat("1080P", "resolution"),
8203
- feat("5/10/15 sec", "duration")
8277
+ feat("3-15 sec", "duration")
8204
8278
  ],
8205
8279
  paramConfig: {
8206
8280
  ...params.prompt({ maxLength: 2500 }),
8281
+ ...params.seed(),
8207
8282
  ...params.aspectRatio(HH_AR, "16:9"),
8208
8283
  ...params.resolution(HH_RES, "720P"),
8209
- ...params.duration(HH_DURATIONS, 5),
8284
+ // Vendor/worker accept any integer 3-15 (docs: default 5).
8285
+ ...params.durationRange(3, 15, 5),
8210
8286
  ...params.imageInput(9, "Reference Images", true)
8211
8287
  }
8212
8288
  },
@@ -8229,6 +8305,7 @@ var { MODELS: MODELS33 } = defineModels("happyhorse", [
8229
8305
  ],
8230
8306
  paramConfig: {
8231
8307
  ...params.prompt({ maxLength: 2500 }),
8308
+ ...params.seed(),
8232
8309
  ...params.resolution(HH_RES, "720P"),
8233
8310
  ...params.audioSetting(),
8234
8311
  ...params.videoInput("Source Video"),
@@ -8251,13 +8328,15 @@ var { MODELS: MODELS33 } = defineModels("happyhorse", [
8251
8328
  features: [
8252
8329
  feat("Start Frame", "frame"),
8253
8330
  feat("1080P", "resolution"),
8254
- feat("5/10/15 sec", "duration")
8331
+ feat("3-15 sec", "duration")
8255
8332
  ],
8256
8333
  paramConfig: {
8257
8334
  ...params.prompt({ maxLength: 2500 }),
8335
+ ...params.seed(),
8258
8336
  ...params.aspectRatio(HH_AR, "16:9"),
8259
8337
  ...params.resolution(HH_RES, "720P"),
8260
- ...params.duration(HH_DURATIONS, 5),
8338
+ // Vendor/worker accept any integer 3-15 (docs: default 5).
8339
+ ...params.durationRange(3, 15, 5),
8261
8340
  ...params.startFrame()
8262
8341
  }
8263
8342
  },
@@ -8275,13 +8354,15 @@ var { MODELS: MODELS33 } = defineModels("happyhorse", [
8275
8354
  features: [
8276
8355
  feat("Multi-Image Input", "input"),
8277
8356
  feat("1080P", "resolution"),
8278
- feat("5/10/15 sec", "duration")
8357
+ feat("3-15 sec", "duration")
8279
8358
  ],
8280
8359
  paramConfig: {
8281
8360
  ...params.prompt({ maxLength: 2500 }),
8361
+ ...params.seed(),
8282
8362
  ...params.aspectRatio(HH_AR, "16:9"),
8283
8363
  ...params.resolution(HH_RES, "720P"),
8284
- ...params.duration(HH_DURATIONS, 5),
8364
+ // Vendor/worker accept any integer 3-15 (docs: default 5).
8365
+ ...params.durationRange(3, 15, 5),
8285
8366
  ...params.imageInput(9, "Reference Images", true)
8286
8367
  }
8287
8368
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@picsart/ai-sdk",
3
- "version": "5.26.1",
3
+ "version": "5.26.3",
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",