@picsart/ai-sdk 6.39.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 +22 -1
  2. package/index.js +148 -1
  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;
@@ -1189,6 +1198,16 @@ type ModelInputById = {
1189
1198
  duration?: number;
1190
1199
  aspectRatio?: "adaptive" | "21:9" | "16:9" | "4:3" | "1:1" | "3:4" | "9:16";
1191
1200
  };
1201
+ "minimax-h3-context-ir": {
1202
+ prompt: string;
1203
+ startFrame?: string;
1204
+ endFrame?: string;
1205
+ imageUrls?: string[];
1206
+ videoUrls?: string[];
1207
+ audioUrls?: string[];
1208
+ duration?: number;
1209
+ aspectRatio?: "adaptive" | "21:9" | "16:9" | "4:3" | "1:1" | "3:4" | "9:16";
1210
+ };
1192
1211
  "minimax-h3-max": {
1193
1212
  prompt: string;
1194
1213
  startFrame?: string;
@@ -2104,7 +2123,7 @@ type ModelInputById = {
2104
2123
  type TypedModelId = keyof ModelInputById;
2105
2124
  type ModelInput<M extends TypedModelId> = ModelInputById[M];
2106
2125
  /** IDs of text-generation (LLM) models — narrows generateText(). */
2107
- type TextModelId = "claude-fable-5" | "claude-fable-5-1" | "claude-haiku-4-5" | "claude-haiku-5-5" | "claude-opus-4-8" | "claude-opus-5" | "claude-sonnet-4-5" | "claude-sonnet-4-6" | "claude-sonnet-5" | "eleven-speech-to-text" | "gemini-2.5-flash" | "gemini-3-pro" | "gemini-3.5-flash-lite" | "gemini-3.6-flash" | "gemini-3.7-flash" | "gemini-3.8-flash" | "gemini-4-argon" | "gpt-4.1-mini" | "gpt-4.1-nano" | "gpt-4o" | "gpt-4o-mini" | "gpt-5" | "gpt-5-mini" | "gpt-5.1" | "gpt-5.2" | "gpt-5.5" | "gpt-5.6-luna" | "gpt-5.6-sol" | "gpt-5.6-terra" | "gpt-6-astra" | "gpt-6-luna" | "gpt-6-sol" | "grok-4.7" | "kimi-k3";
2126
+ type TextModelId = "claude-fable-5" | "claude-fable-5-1" | "claude-haiku-4-5" | "claude-haiku-5-5" | "claude-opus-4-8" | "claude-opus-5" | "claude-sonnet-4-5" | "claude-sonnet-4-6" | "claude-sonnet-5" | "eleven-speech-to-text" | "gemini-2.5-flash" | "gemini-3-pro" | "gemini-3.5-flash-lite" | "gemini-3.6-flash" | "gemini-3.7-flash" | "gemini-3.8-flash" | "gemini-4-argon" | "gpt-4.1-mini" | "gpt-4.1-nano" | "gpt-4o" | "gpt-4o-mini" | "gpt-5" | "gpt-5-mini" | "gpt-5.1" | "gpt-5.2" | "gpt-5.5" | "gpt-5.6-luna" | "gpt-5.6-sol" | "gpt-5.6-terra" | "gpt-6-astra" | "gpt-6-luna" | "gpt-6-sol" | "grok-4.7" | "kimi-k3" | "minimax-h3-context-ir";
2108
2127
  type TextModelInputById = Pick<ModelInputById, TextModelId>;
2109
2128
  /** IDs of structured-output (json-mode) models — narrows run()'s result type. */
2110
2129
  type JsonModelId = "typesafe-evaluate";
@@ -3555,6 +3574,7 @@ declare const Models: {
3555
3574
  readonly GrokImagineVideo15: "grok-imagine-video-1.5";
3556
3575
  readonly GrokImagineVideo15Lite: "grok-imagine-video-1.5-lite";
3557
3576
  readonly GrokTts: "grok-tts";
3577
+ readonly Hailuo02: "hailuo-02";
3558
3578
  readonly Hailuo23: "hailuo-2.3";
3559
3579
  readonly Hailuo23Fast: "hailuo-2.3-fast";
3560
3580
  readonly Hailuo23FastPro: "hailuo-2.3-fast-pro";
@@ -3612,6 +3632,7 @@ declare const Models: {
3612
3632
  readonly Lyria3Pro: "lyria-3-pro";
3613
3633
  readonly Lyria35: "lyria-3.5";
3614
3634
  readonly MinimaxH3: "minimax-h3";
3635
+ readonly MinimaxH3ContextIr: "minimax-h3-context-ir";
3615
3636
  readonly MinimaxH3Max: "minimax-h3-max";
3616
3637
  readonly MinimaxH3MaxCameraControls: "minimax-h3-max-camera-controls";
3617
3638
  readonly MinimaxH3MaxExtend: "minimax-h3-max-extend";
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,
@@ -10664,7 +10743,56 @@ var { MODELS: GROK_LLM } = defineModels("grok", [
10664
10743
  }
10665
10744
  }
10666
10745
  ]);
10667
- var MODELS35 = [...ANTHROPIC, ...OPENAI_LLM, ...GEMINI_LLM, ...KIMI_LLM, ...GROK_LLM];
10746
+ var H3_FRAME_REF_EXCLUSIVE = "References and start/end frames cannot be combined.";
10747
+ var H3_FRAME_EXCLUDES_REFERENCES = {
10748
+ imageUrls: { disabled: true, reason: H3_FRAME_REF_EXCLUSIVE },
10749
+ videoUrls: { disabled: true, reason: H3_FRAME_REF_EXCLUSIVE },
10750
+ audioUrls: { disabled: true, reason: H3_FRAME_REF_EXCLUSIVE }
10751
+ };
10752
+ var H3_REFERENCE_EXCLUDES_FRAMES = {
10753
+ startFrame: { disabled: true, reason: H3_FRAME_REF_EXCLUSIVE },
10754
+ endFrame: { disabled: true, reason: H3_FRAME_REF_EXCLUSIVE }
10755
+ };
10756
+ var h3ContextIrConstraints = [
10757
+ { when: { startFrame: { exists: true } }, then: H3_FRAME_EXCLUDES_REFERENCES },
10758
+ { when: { endFrame: { exists: true } }, then: H3_FRAME_EXCLUDES_REFERENCES },
10759
+ { when: { imageUrls: { exists: true } }, then: H3_REFERENCE_EXCLUDES_FRAMES },
10760
+ { when: { videoUrls: { exists: true } }, then: H3_REFERENCE_EXCLUDES_FRAMES },
10761
+ { when: { audioUrls: { exists: true } }, then: H3_REFERENCE_EXCLUDES_FRAMES }
10762
+ ];
10763
+ var { MODELS: MINIMAX_LLM } = defineModels("minimax", [
10764
+ {
10765
+ id: "minimax-h3-context-ir",
10766
+ name: "MiniMax H3 Context IR",
10767
+ workflow: "minimax/v2/h3-context-ir",
10768
+ addedAt: "2026-10-14",
10769
+ estimatedTime: 8,
10770
+ mode: "text",
10771
+ inputType: "v2t",
10772
+ badge: ["new"],
10773
+ description: "MiniMax H3 Context IR \u2014 enhances a video prompt from text plus optional first/last frame, reference images, videos, and audio. Returns an enhanced prompt, not a video.",
10774
+ features: [
10775
+ feat("Vision", "input"),
10776
+ feat("Video Input", "input"),
10777
+ feat("Audio Input", "input"),
10778
+ feat("Start/End Frame", "frame")
10779
+ ],
10780
+ paramConfig: {
10781
+ ...params.prompt(),
10782
+ ...params.startFrame("Start Frame", false),
10783
+ ...params.endFrame("End Frame"),
10784
+ ...params.imageInput(9, "Reference Images", false, "reference"),
10785
+ ...params.videoInputs(3, "Reference Videos", false),
10786
+ ...params.audioInputs(3, "Reference Audios", false),
10787
+ // Target video shape the enhancement is written towards (4-15s; the
10788
+ // ratio defaults to 'adaptive' — follow the references).
10789
+ ...params.durationRange(4, 15, 5),
10790
+ ...params.aspectRatio(["adaptive", "21:9", "16:9", "4:3", "1:1", "3:4", "9:16"], "adaptive")
10791
+ },
10792
+ constraints: h3ContextIrConstraints
10793
+ }
10794
+ ]);
10795
+ var MODELS35 = [...ANTHROPIC, ...OPENAI_LLM, ...GEMINI_LLM, ...KIMI_LLM, ...GROK_LLM, ...MINIMAX_LLM];
10668
10796
 
10669
10797
  // src/vendors/catalog/llm.payloads.ts
10670
10798
  var CLAUDE_MAX_TOKENS = 8192;
@@ -10715,7 +10843,22 @@ var buildGeminiPayload = (modelId) => (input) => {
10715
10843
  ...level ? { generationConfig: { thinkingConfig: { thinkingLevel: level } } } : {}
10716
10844
  };
10717
10845
  };
10846
+ var buildMinimaxH3ContextIrPayload = (input) => {
10847
+ const content = [{ type: "text", text: input.prompt }];
10848
+ if (input.startFrame) content.push({ type: "image_url", image_url: { url: input.startFrame }, role: "first_frame" });
10849
+ if (input.endFrame) content.push({ type: "image_url", image_url: { url: input.endFrame }, role: "last_frame" });
10850
+ for (const url of input.imageUrls ?? []) content.push({ type: "image_url", image_url: { url }, role: "reference_image" });
10851
+ for (const url of input.videoUrls ?? []) content.push({ type: "video_url", video_url: { url }, role: "reference_video" });
10852
+ for (const url of input.audioUrls ?? []) content.push({ type: "audio_url", audio_url: { url }, role: "reference_audio" });
10853
+ return {
10854
+ model: "MiniMax-H3",
10855
+ content,
10856
+ duration: input.duration ?? 5,
10857
+ ...input.aspectRatio ? { ratio: input.aspectRatio } : {}
10858
+ };
10859
+ };
10718
10860
  registerPayloads(MODELS35, {
10861
+ "minimax-h3-context-ir": buildMinimaxH3ContextIrPayload,
10719
10862
  "claude-fable-5-1": buildClaudePayload("claude-fable-5-1"),
10720
10863
  "claude-fable-5": buildClaudePayload("claude-fable-5"),
10721
10864
  "claude-opus-5": buildClaudePayload("claude-opus-5"),
@@ -14806,6 +14949,7 @@ var GrokImagineVideo = "grok-imagine-video";
14806
14949
  var GrokImagineVideo15 = "grok-imagine-video-1.5";
14807
14950
  var GrokImagineVideo15Lite = "grok-imagine-video-1.5-lite";
14808
14951
  var GrokTts = "grok-tts";
14952
+ var Hailuo02 = "hailuo-02";
14809
14953
  var Hailuo23 = "hailuo-2.3";
14810
14954
  var Hailuo23Fast = "hailuo-2.3-fast";
14811
14955
  var Hailuo23FastPro = "hailuo-2.3-fast-pro";
@@ -14863,6 +15007,7 @@ var Lyria3Clip = "lyria-3-clip";
14863
15007
  var Lyria3Pro = "lyria-3-pro";
14864
15008
  var Lyria35 = "lyria-3.5";
14865
15009
  var MinimaxH3 = "minimax-h3";
15010
+ var MinimaxH3ContextIr = "minimax-h3-context-ir";
14866
15011
  var MinimaxH3Max = "minimax-h3-max";
14867
15012
  var MinimaxH3MaxCameraControls = "minimax-h3-max-camera-controls";
14868
15013
  var MinimaxH3MaxExtend = "minimax-h3-max-extend";
@@ -15071,6 +15216,7 @@ var Models = {
15071
15216
  GrokImagineVideo15,
15072
15217
  GrokImagineVideo15Lite,
15073
15218
  GrokTts,
15219
+ Hailuo02,
15074
15220
  Hailuo23,
15075
15221
  Hailuo23Fast,
15076
15222
  Hailuo23FastPro,
@@ -15128,6 +15274,7 @@ var Models = {
15128
15274
  Lyria3Pro,
15129
15275
  Lyria35,
15130
15276
  MinimaxH3,
15277
+ MinimaxH3ContextIr,
15131
15278
  MinimaxH3Max,
15132
15279
  MinimaxH3MaxCameraControls,
15133
15280
  MinimaxH3MaxExtend,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@picsart/ai-sdk",
3
- "version": "6.39.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",