@picsart/ai-sdk 6.51.1 → 6.52.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 +26 -9
  2. package/index.js +126 -6
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -379,6 +379,27 @@ type ModelInputById = {
379
379
  steps?: number;
380
380
  safetyTolerance?: number;
381
381
  };
382
+ "flux-3-max": {
383
+ prompt: string;
384
+ startFrame?: string;
385
+ endFrame?: string;
386
+ aspectRatio?: "auto" | "21:9" | "2:1" | "16:9" | "4:3" | "1:1" | "3:4" | "9:16";
387
+ resolution?: "720p" | "1080p";
388
+ duration?: number;
389
+ generateAudio?: boolean;
390
+ reasoningLevel?: "low" | "high";
391
+ seed?: number;
392
+ };
393
+ "flux-3-max-keyframes": {
394
+ prompt: string;
395
+ imageUrls: [string, ...string[]];
396
+ aspectRatio?: "auto" | "21:9" | "2:1" | "16:9" | "4:3" | "1:1" | "3:4" | "9:16";
397
+ resolution?: "720p" | "1080p";
398
+ duration?: number;
399
+ generateAudio?: boolean;
400
+ reasoningLevel?: "low" | "high";
401
+ seed?: number;
402
+ };
382
403
  "flux-3-video": {
383
404
  prompt: string;
384
405
  aspectRatio?: "auto" | "21:9" | "2:1" | "16:9" | "4:3" | "1:1" | "3:4" | "9:16";
@@ -1872,8 +1893,6 @@ type ModelInputById = {
1872
1893
  draft?: boolean;
1873
1894
  draftTask?: {
1874
1895
  id: string;
1875
- video_input: boolean;
1876
- signature: string;
1877
1896
  };
1878
1897
  omniReferenceTaskType?: "auto" | "reference" | "edit" | "extend";
1879
1898
  imageUrls?: string[];
@@ -1917,8 +1936,6 @@ type ModelInputById = {
1917
1936
  draft?: boolean;
1918
1937
  draftTask?: {
1919
1938
  id: string;
1920
- video_input: boolean;
1921
- signature: string;
1922
1939
  };
1923
1940
  omniReferenceTaskType?: "auto" | "reference" | "edit" | "extend";
1924
1941
  imageUrls?: string[];
@@ -2805,15 +2822,13 @@ interface GenerateResultItemMetadata {
2805
2822
  lastFrameUrl?: string;
2806
2823
  /** The draft a Seedance 2.5 Draft generation produced — pass it back
2807
2824
  * unchanged as `draftTask` to the matching `-draft-final` model to render
2808
- * the final 1080p video (valid 7 days). Wire field names on purpose: the
2809
- * worker signs it, so any change is rejected. */
2825
+ * the final 1080p video (valid 7 days). */
2810
2826
  draftTask?: SeedanceDraftTask;
2811
2827
  }
2812
- /** A Seedance 2.5 draft reference, as the worker issues it. */
2828
+ /** A Seedance 2.5 draft reference, as the worker issues it. The final step
2829
+ * needs only the draft `id`; the worker resolves the rest from it. */
2813
2830
  interface SeedanceDraftTask {
2814
2831
  id: string;
2815
- video_input: boolean;
2816
- signature: string;
2817
2832
  }
2818
2833
 
2819
2834
  /**
@@ -3550,6 +3565,8 @@ declare const Models: {
3550
3565
  readonly Flux2Pro: "flux-2-pro";
3551
3566
  readonly Flux3Image: "flux-3-image";
3552
3567
  readonly Flux3ImageKlein: "flux-3-image-klein";
3568
+ readonly Flux3Max: "flux-3-max";
3569
+ readonly Flux3MaxKeyframes: "flux-3-max-keyframes";
3553
3570
  readonly Flux3Video: "flux-3-video";
3554
3571
  readonly FluxKontextMax: "flux-kontext-max";
3555
3572
  readonly FluxKontextPro: "flux-kontext-pro";
package/index.js CHANGED
@@ -4754,9 +4754,7 @@ var seedance25DraftTaskParam = {
4754
4754
  descriptor: {
4755
4755
  kind: "object",
4756
4756
  fields: {
4757
- id: { kind: "text" },
4758
- video_input: { kind: "boolean", default: false },
4759
- signature: { kind: "text" }
4757
+ id: { kind: "text" }
4760
4758
  }
4761
4759
  }
4762
4760
  }
@@ -6285,6 +6283,7 @@ var flux3ImageAspectRatios = [
6285
6283
  "9:21",
6286
6284
  "1:2"
6287
6285
  ];
6286
+ var flux3MaxAspectRatios = ["auto", "21:9", "2:1", "16:9", "4:3", "1:1", "3:4", "9:16"];
6288
6287
  var flux3ImageResolutions = ["768sq", "1k", "1.5k", "2k", "4k"];
6289
6288
  var buildFluxV2Payload = (modelId) => (ctx) => ({
6290
6289
  prompt: ctx.prompt,
@@ -6612,6 +6611,84 @@ var { MODELS: MODELS20 } = defineModels("flux", [
6612
6611
  // Moderation level: 0 (strict) … 4 (permissive).
6613
6612
  ...p.range("safetyTolerance", 0, 4, 2, { label: "Safety Tolerance" })
6614
6613
  }
6614
+ },
6615
+ {
6616
+ // FLUX 3 Max video — text-to-video, or image-to-video from a start (and
6617
+ // optional end) frame: a frame routes to the `flux-3-max/image-to-video`
6618
+ // endpoint via editWorkflow. Keyframe interpolation is its own entry
6619
+ // (flux-3-max-keyframes) because routing has only two slots. The worker
6620
+ // forwards the command straight to fal, so the builders emit fal snake_case.
6621
+ id: "flux-3-max",
6622
+ name: "Flux 3 Max",
6623
+ modelId: "fal-ai-flux-3-max",
6624
+ workflow: "flux-3-max/text-to-video",
6625
+ editWorkflow: "flux-3-max/image-to-video",
6626
+ mode: "video",
6627
+ inputType: "t2v",
6628
+ addedAt: "2026-10-21",
6629
+ estimatedTime: 60,
6630
+ description: "Text-to-video with synchronized audio, or image-to-video from a start (and optional end) frame. Up to 20s at 1080p.",
6631
+ features: [
6632
+ feat("Start/End Frame", "frame"),
6633
+ feat("Audio", "audio"),
6634
+ feat("Up to 20s", "duration"),
6635
+ feat("1080p", "resolution")
6636
+ ],
6637
+ paramConfig: {
6638
+ ...params.prompt(),
6639
+ // A start frame routes to image-to-video (image_url); end frame is the
6640
+ // optional end_image_url.
6641
+ ...params.startFrame("Start Frame", false),
6642
+ ...params.endFrame("End Frame"),
6643
+ ...params.aspectRatio(flux3MaxAspectRatios, "16:9"),
6644
+ ...params.resolution(["720p", "1080p"], "720p"),
6645
+ ...params.durationRange(5, 20, 5),
6646
+ ...params.generateAudio(true),
6647
+ // Vendor reasoning tier for the planner; vendor default high.
6648
+ ...p.enum("reasoningLevel", ["low", "high"], "high", { label: "Reasoning" }),
6649
+ // -1 (sentinel) means "pick a random seed"; the builder drops it.
6650
+ ...p.range("seed", -1, 2147483647, -1)
6651
+ },
6652
+ constraints: [
6653
+ // image-to-video requires image_url; end_image_url alone is invalid. An
6654
+ // end frame is only ever a second keyframe, so require a start frame
6655
+ // whenever one is supplied rather than let the request reach fal and 400.
6656
+ { when: { endFrame: { exists: true } }, then: {
6657
+ startFrame: { required: true, reason: "An end frame needs a start frame \u2014 image-to-video animates from the start image." }
6658
+ } }
6659
+ ]
6660
+ },
6661
+ {
6662
+ // Keyframe-interpolation sibling: 1–10 positioned images animate into a
6663
+ // video via `flux-3-max/keyframes-to-video`. Shares the image-to-video
6664
+ // pricing tier (same modelId). The images are spaced evenly across the
6665
+ // 24 fps timeline in flux.payloads.ts.
6666
+ id: "flux-3-max-keyframes",
6667
+ name: "Flux 3 Max Keyframes",
6668
+ modelId: "fal-ai-flux-3-max",
6669
+ workflow: "flux-3-max/keyframes-to-video",
6670
+ mode: "video",
6671
+ inputType: "i2v",
6672
+ addedAt: "2026-10-21",
6673
+ estimatedTime: 60,
6674
+ description: "Animate a video between up to 10 positioned keyframe images, with synchronized audio. Up to 20s at 1080p.",
6675
+ features: [
6676
+ feat("Multi-Image Input", "input"),
6677
+ feat("Audio", "audio"),
6678
+ feat("Up to 20s", "duration"),
6679
+ feat("1080p", "resolution")
6680
+ ],
6681
+ paramConfig: {
6682
+ ...params.prompt(),
6683
+ // imageUrls → keyframes[]; combined ≤10 is backend-enforced.
6684
+ ...params.imageInput(10, "Keyframes", true, "asset"),
6685
+ ...params.aspectRatio(flux3MaxAspectRatios, "16:9"),
6686
+ ...params.resolution(["720p", "1080p"], "720p"),
6687
+ ...params.durationRange(5, 20, 5),
6688
+ ...params.generateAudio(true),
6689
+ ...p.enum("reasoningLevel", ["low", "high"], "high", { label: "Reasoning" }),
6690
+ ...p.range("seed", -1, 2147483647, -1)
6691
+ }
6615
6692
  }
6616
6693
  ]);
6617
6694
 
@@ -6636,6 +6713,45 @@ var buildFlux3VideoPayload = (input) => {
6636
6713
  registerPayloads(MODELS20, {
6637
6714
  "flux-3-video": buildFlux3VideoPayload
6638
6715
  });
6716
+ var flux3MaxShared = (i) => ({
6717
+ aspect_ratio: i.aspectRatio ?? "16:9",
6718
+ resolution: i.resolution ?? "720p",
6719
+ duration: Number(i.duration ?? 5),
6720
+ generate_audio: i.generateAudio ?? true,
6721
+ reasoning_level: i.reasoningLevel ?? "high",
6722
+ // -1 is the "random seed" sentinel — omit so fal picks one.
6723
+ ...i.seed != null && i.seed !== -1 ? { seed: i.seed } : {}
6724
+ });
6725
+ var buildFlux3MaxPayload = (i) => ({
6726
+ prompt: i.prompt,
6727
+ ...flux3MaxShared(i)
6728
+ });
6729
+ var buildFlux3MaxEditPayload = (i) => ({
6730
+ prompt: i.prompt,
6731
+ image_url: i.startFrame,
6732
+ ...i.endFrame ? { end_image_url: i.endFrame } : {},
6733
+ ...flux3MaxShared(i)
6734
+ });
6735
+ var buildFlux3MaxKeyframesPayload = (i) => {
6736
+ const imgs = i.imageUrls ?? [];
6737
+ const last = Number(i.duration ?? 5) * 24;
6738
+ const keyframes = imgs.map((url, idx) => ({
6739
+ image_url: url,
6740
+ frame_index: imgs.length <= 1 ? 0 : Math.round(last * idx / (imgs.length - 1))
6741
+ }));
6742
+ return {
6743
+ prompt: i.prompt,
6744
+ keyframes,
6745
+ ...flux3MaxShared(i)
6746
+ };
6747
+ };
6748
+ registerPayloads(MODELS20, {
6749
+ "flux-3-max": buildFlux3MaxPayload,
6750
+ "flux-3-max-keyframes": buildFlux3MaxKeyframesPayload
6751
+ });
6752
+ registerEditPayloads(MODELS20, {
6753
+ "flux-3-max": buildFlux3MaxEditPayload
6754
+ });
6639
6755
 
6640
6756
  // src/vendors/catalog/gemini.ts
6641
6757
  function buildThinkingConfig(ctx) {
@@ -11764,7 +11880,7 @@ var extractAllResults = (result) => {
11764
11880
  };
11765
11881
  var isSeedanceDraftTask = (value) => {
11766
11882
  const v = value;
11767
- return !!v && typeof v === "object" && typeof v.id === "string" && typeof v.video_input === "boolean" && typeof v.signature === "string";
11883
+ return !!v && typeof v === "object" && typeof v.id === "string";
11768
11884
  };
11769
11885
  function buildItemMetadata(parsed, item, _index, provider) {
11770
11886
  const meta = {};
@@ -11776,7 +11892,7 @@ function buildItemMetadata(parsed, item, _index, provider) {
11776
11892
  if (typeof lastFrame === "string") meta.lastFrameUrl = lastFrame;
11777
11893
  const draftTask = top?.draft_task;
11778
11894
  if (provider === "bytedance" && isSeedanceDraftTask(draftTask)) {
11779
- meta.draftTask = { id: draftTask.id, video_input: draftTask.video_input, signature: draftTask.signature };
11895
+ meta.draftTask = { id: draftTask.id };
11780
11896
  }
11781
11897
  return Object.keys(meta).length > 0 ? meta : void 0;
11782
11898
  }
@@ -13849,7 +13965,7 @@ function parseDraftInfo(attrs) {
13849
13965
  const draftTask = parseJsonAttr(attrs[DRAFT_TASK_ATTR]);
13850
13966
  if (!isSeedanceDraftTask(draftTask)) return {};
13851
13967
  return {
13852
- draftTask: { id: draftTask.id, video_input: draftTask.video_input, signature: draftTask.signature },
13968
+ draftTask: { id: draftTask.id },
13853
13969
  ...attrs[DRAFT_EXPIRES_AT_ATTR] ? { draftExpiresAt: attrs[DRAFT_EXPIRES_AT_ATTR] } : {}
13854
13970
  };
13855
13971
  }
@@ -15061,6 +15177,8 @@ var Flux2Max = "flux-2-max";
15061
15177
  var Flux2Pro = "flux-2-pro";
15062
15178
  var Flux3Image = "flux-3-image";
15063
15179
  var Flux3ImageKlein = "flux-3-image-klein";
15180
+ var Flux3Max = "flux-3-max";
15181
+ var Flux3MaxKeyframes = "flux-3-max-keyframes";
15064
15182
  var Flux3Video = "flux-3-video";
15065
15183
  var FluxKontextMax = "flux-kontext-max";
15066
15184
  var FluxKontextPro = "flux-kontext-pro";
@@ -15325,6 +15443,8 @@ var Models = {
15325
15443
  Flux2Pro,
15326
15444
  Flux3Image,
15327
15445
  Flux3ImageKlein,
15446
+ Flux3Max,
15447
+ Flux3MaxKeyframes,
15328
15448
  Flux3Video,
15329
15449
  FluxKontextMax,
15330
15450
  FluxKontextPro,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@picsart/ai-sdk",
3
- "version": "6.51.1",
3
+ "version": "6.52.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",