@picsart/ai-sdk 6.40.0 → 6.41.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 +10 -0
  2. package/index.js +81 -0
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -728,6 +728,15 @@ type ModelInputById = {
728
728
  prompt: string;
729
729
  voiceId?: string;
730
730
  };
731
+ "hailuo-02": {
732
+ prompt: string;
733
+ enhancePrompt?: boolean;
734
+ resolution?: "512P" | "768P" | "1080P";
735
+ duration?: 6 | 10;
736
+ startFrame?: string;
737
+ endFrame?: string;
738
+ imageUrls?: string[];
739
+ };
731
740
  "hailuo-2.3": {
732
741
  prompt: string;
733
742
  enhancePrompt?: boolean;
@@ -3565,6 +3574,7 @@ declare const Models: {
3565
3574
  readonly GrokImagineVideo15: "grok-imagine-video-1.5";
3566
3575
  readonly GrokImagineVideo15Lite: "grok-imagine-video-1.5-lite";
3567
3576
  readonly GrokTts: "grok-tts";
3577
+ readonly Hailuo02: "hailuo-02";
3568
3578
  readonly Hailuo23: "hailuo-2.3";
3569
3579
  readonly Hailuo23Fast: "hailuo-2.3-fast";
3570
3580
  readonly Hailuo23FastPro: "hailuo-2.3-fast-pro";
package/index.js CHANGED
@@ -3437,10 +3437,70 @@ var minimaxH3Constraints = [
3437
3437
  audioUrls: { disabled: true, reason: AUDIO_NEEDS_VISUAL2 }
3438
3438
  } }
3439
3439
  ];
3440
+ var HAILUO_02_1080P_6S = "1080P supports a 6s duration only.";
3441
+ var HAILUO_02_512P_I2V = "512P needs a start frame and has no end frame.";
3442
+ var HAILUO_02_ONE_SOURCE = "Use either the start frame or the start image.";
3443
+ var hailuo02Constraints = [
3444
+ { when: { resolution: { is: "1080P" } }, then: {
3445
+ duration: { allowed: [6], reason: HAILUO_02_1080P_6S }
3446
+ } },
3447
+ { when: { duration: { is: 10 } }, then: {
3448
+ resolution: { allowed: ["512P", "768P"], reason: HAILUO_02_1080P_6S }
3449
+ } },
3450
+ { when: { startFrame: { exists: false }, imageUrls: { exists: false } }, then: {
3451
+ endFrame: { disabled: true, reason: LAST_NEEDS_FIRST },
3452
+ resolution: { allowed: ["768P", "1080P"], reason: HAILUO_02_512P_I2V }
3453
+ } },
3454
+ { when: { startFrame: { exists: true } }, then: {
3455
+ imageUrls: { disabled: true, reason: HAILUO_02_ONE_SOURCE }
3456
+ } },
3457
+ { when: { imageUrls: { exists: true } }, then: {
3458
+ startFrame: { disabled: true, reason: HAILUO_02_ONE_SOURCE }
3459
+ } },
3460
+ { when: { endFrame: { exists: true } }, then: {
3461
+ resolution: { allowed: ["768P", "1080P"], reason: HAILUO_02_512P_I2V }
3462
+ } },
3463
+ { when: { resolution: { is: "512P" } }, then: {
3464
+ endFrame: { disabled: true, reason: HAILUO_02_512P_I2V }
3465
+ } }
3466
+ ];
3440
3467
  var base = {
3441
3468
  mode: "video"
3442
3469
  };
3443
3470
  var { MODELS: MODELS10 } = defineModels("minimax", [
3471
+ {
3472
+ // Builder lives in hailuo.payloads.ts. One task for every mode and
3473
+ // resolution — the worker picks text- or image-to-video from image_url
3474
+ // and resolves pricing per mode and resolution.
3475
+ // Preview until minimax/hailuo-02/video-generation is deployed.
3476
+ ...base,
3477
+ id: "hailuo-02",
3478
+ name: "Hailuo 02",
3479
+ modelId: "minimax-hailuo-02",
3480
+ addedAt: "2026-08-15",
3481
+ release: "preview",
3482
+ inputType: "t2v",
3483
+ workflow: "minimax/hailuo-02/video-generation",
3484
+ estimatedTime: 300,
3485
+ description: "Up to 1080p video from text or a start/end frame, with strong physics and instruction following.",
3486
+ features: [
3487
+ feat("Start Frame", "frame"),
3488
+ feat("End Frame", "frame"),
3489
+ feat("1080p", "resolution"),
3490
+ feat("10 sec", "duration")
3491
+ ],
3492
+ paramConfig: {
3493
+ ...params.prompt({ maxLength: 2e3 }),
3494
+ ...params.enhancePrompt(),
3495
+ ...params.resolution(["512P", "768P", "1080P"], "768P"),
3496
+ ...params.duration([6, 10]),
3497
+ ...params.startFrame(),
3498
+ ...params.endFrame(),
3499
+ // Same first frame for callers that send images as imageUrls.
3500
+ ...params.imageInput(1, "Start Image")
3501
+ },
3502
+ constraints: hailuo02Constraints
3503
+ },
3444
3504
  {
3445
3505
  ...base,
3446
3506
  id: "hailuo-2.3",
@@ -3556,6 +3616,25 @@ var { MODELS: MODELS10 } = defineModels("minimax", [
3556
3616
  }
3557
3617
  ]);
3558
3618
 
3619
+ // src/vendors/catalog/hailuo.payloads.ts
3620
+ var buildHailuo02Payload = (input) => {
3621
+ const startFrame = input.startFrame || input.imageUrls?.[0];
3622
+ if (input.endFrame && !startFrame) {
3623
+ throw new ApiError("Hailuo 02: an end frame requires a start frame.", { status: 400, code: "validation_error" });
3624
+ }
3625
+ return {
3626
+ prompt: input.prompt,
3627
+ ...input.enhancePrompt !== void 0 ? { prompt_optimizer: input.enhancePrompt } : {},
3628
+ ...input.resolution ? { resolution: input.resolution } : {},
3629
+ ...input.duration ? { duration: input.duration } : {},
3630
+ ...startFrame ? { image_url: startFrame } : {},
3631
+ ...input.endFrame ? { end_image_url: input.endFrame } : {}
3632
+ };
3633
+ };
3634
+ registerPayloads(MODELS10, {
3635
+ "hailuo-02": buildHailuo02Payload
3636
+ });
3637
+
3559
3638
  // src/vendors/catalog/wan.ts
3560
3639
  var buildWanT2VPayload = (ctx) => ({
3561
3640
  prompt: ctx.prompt,
@@ -14870,6 +14949,7 @@ var GrokImagineVideo = "grok-imagine-video";
14870
14949
  var GrokImagineVideo15 = "grok-imagine-video-1.5";
14871
14950
  var GrokImagineVideo15Lite = "grok-imagine-video-1.5-lite";
14872
14951
  var GrokTts = "grok-tts";
14952
+ var Hailuo02 = "hailuo-02";
14873
14953
  var Hailuo23 = "hailuo-2.3";
14874
14954
  var Hailuo23Fast = "hailuo-2.3-fast";
14875
14955
  var Hailuo23FastPro = "hailuo-2.3-fast-pro";
@@ -15136,6 +15216,7 @@ var Models = {
15136
15216
  GrokImagineVideo15,
15137
15217
  GrokImagineVideo15Lite,
15138
15218
  GrokTts,
15219
+ Hailuo02,
15139
15220
  Hailuo23,
15140
15221
  Hailuo23Fast,
15141
15222
  Hailuo23FastPro,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@picsart/ai-sdk",
3
- "version": "6.40.0",
3
+ "version": "6.41.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",