@picsart/ai-sdk 5.20.0 → 5.21.1
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.
- package/index.d.ts +26 -14
- package/index.js +29 -23
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -395,16 +395,6 @@ type ModelInputById = {
|
|
|
395
395
|
prompt: string;
|
|
396
396
|
voiceId?: string;
|
|
397
397
|
};
|
|
398
|
-
"hailuo-03": {
|
|
399
|
-
prompt: string;
|
|
400
|
-
startFrame?: string;
|
|
401
|
-
endFrame?: string;
|
|
402
|
-
imageUrls?: string[];
|
|
403
|
-
videoUrls?: string[];
|
|
404
|
-
audioUrls?: string[];
|
|
405
|
-
duration?: 5 | 10 | 15;
|
|
406
|
-
aspectRatio?: "adaptive" | "21:9" | "16:9" | "4:3" | "1:1" | "3:4" | "9:16";
|
|
407
|
-
};
|
|
408
398
|
"hailuo-2.3": {
|
|
409
399
|
prompt: string;
|
|
410
400
|
enhancePrompt?: boolean;
|
|
@@ -791,6 +781,16 @@ type ModelInputById = {
|
|
|
791
781
|
accent?: string;
|
|
792
782
|
prompt: string;
|
|
793
783
|
};
|
|
784
|
+
"minimax-h3": {
|
|
785
|
+
prompt: string;
|
|
786
|
+
startFrame?: string;
|
|
787
|
+
endFrame?: string;
|
|
788
|
+
imageUrls?: string[];
|
|
789
|
+
videoUrls?: string[];
|
|
790
|
+
audioUrls?: string[];
|
|
791
|
+
duration?: 5 | 10 | 15;
|
|
792
|
+
aspectRatio?: "adaptive" | "21:9" | "16:9" | "4:3" | "1:1" | "3:4" | "9:16";
|
|
793
|
+
};
|
|
794
794
|
"minimax-music-v2": {
|
|
795
795
|
prompt: string;
|
|
796
796
|
lyricsPrompt?: string;
|
|
@@ -2187,9 +2187,10 @@ interface ModelDefinition {
|
|
|
2187
2187
|
editEstimatedTime?: number | Record<string, number>;
|
|
2188
2188
|
testTimeout?: number;
|
|
2189
2189
|
/**
|
|
2190
|
-
* Per-model polling overrides for async jobs.
|
|
2191
|
-
* 2s ×
|
|
2192
|
-
*
|
|
2190
|
+
* Per-model polling overrides for async jobs. Narrows or widens the mode
|
|
2191
|
+
* default (video 2s × 1800 ≈ 1 h; image/audio/text 1s × 1200 ≈ 20 min) for
|
|
2192
|
+
* models whose generations don't fit it. Explicit per-call poll options
|
|
2193
|
+
* still win.
|
|
2193
2194
|
*/
|
|
2194
2195
|
pollOptions?: {
|
|
2195
2196
|
intervalMs?: number;
|
|
@@ -2396,6 +2397,17 @@ interface GenerateTextResult {
|
|
|
2396
2397
|
/** Options for individual generate() / submit() calls. */
|
|
2397
2398
|
interface GenerateOptions {
|
|
2398
2399
|
signal?: AbortSignal;
|
|
2400
|
+
/**
|
|
2401
|
+
* Poll interval for the async status loop, in ms. Overrides the model's
|
|
2402
|
+
* `pollOptions` and the mode default (video 2s; image/audio/text 1s).
|
|
2403
|
+
*/
|
|
2404
|
+
intervalMs?: number;
|
|
2405
|
+
/**
|
|
2406
|
+
* Max poll attempts before the call throws a timeout. Overrides the model's
|
|
2407
|
+
* `pollOptions` and the mode default (video 1800 ≈ 1 hour;
|
|
2408
|
+
* image/audio/text 1200 ≈ 20 min).
|
|
2409
|
+
*/
|
|
2410
|
+
maxAttempts?: number;
|
|
2399
2411
|
/** Save to a specific subfolder instead of the root (legacy — used by SDK DriveConfig). */
|
|
2400
2412
|
folder?: DriveFolder;
|
|
2401
2413
|
/** Save result to Picsart Drive via backend. Injected into the workflow payload. */
|
|
@@ -2525,7 +2537,6 @@ declare const Models: {
|
|
|
2525
2537
|
readonly GrokImagineVideo: "grok-imagine-video";
|
|
2526
2538
|
readonly GrokImagineVideo15: "grok-imagine-video-1.5";
|
|
2527
2539
|
readonly GrokTts: "grok-tts";
|
|
2528
|
-
readonly Hailuo03: "hailuo-03";
|
|
2529
2540
|
readonly Hailuo23: "hailuo-2.3";
|
|
2530
2541
|
readonly Hailuo23Fast: "hailuo-2.3-fast";
|
|
2531
2542
|
readonly Hailuo23FastPro: "hailuo-2.3-fast-pro";
|
|
@@ -2578,6 +2589,7 @@ declare const Models: {
|
|
|
2578
2589
|
readonly Lyria3Clip: "lyria-3-clip";
|
|
2579
2590
|
readonly Lyria3Pro: "lyria-3-pro";
|
|
2580
2591
|
readonly Minimax02Hd: "minimax-02-hd";
|
|
2592
|
+
readonly MinimaxH3: "minimax-h3";
|
|
2581
2593
|
readonly MinimaxMusicV2: "minimax-music-v2";
|
|
2582
2594
|
readonly MinimaxMusicV3: "minimax-music-v3";
|
|
2583
2595
|
readonly Ovi: "ovi";
|
package/index.js
CHANGED
|
@@ -2667,7 +2667,7 @@ var buildMinimaxH3 = (ctx) => {
|
|
|
2667
2667
|
var FRAME_REF_EXCLUSIVE = "First/last frame and reference inputs cannot be combined.";
|
|
2668
2668
|
var LAST_NEEDS_FIRST = "An end frame requires a start frame.";
|
|
2669
2669
|
var AUDIO_NEEDS_VISUAL = "Reference audio needs a reference image or video.";
|
|
2670
|
-
var
|
|
2670
|
+
var minimaxH3Constraints = [
|
|
2671
2671
|
// Frame roles ⊥ reference roles (declared both ways so either input disables the other).
|
|
2672
2672
|
{ when: { startFrame: { exists: true } }, then: {
|
|
2673
2673
|
imageUrls: { disabled: true, reason: FRAME_REF_EXCLUSIVE },
|
|
@@ -2784,8 +2784,8 @@ var { MODELS: MODELS9 } = defineModels("minimax", [
|
|
|
2784
2784
|
},
|
|
2785
2785
|
{
|
|
2786
2786
|
...base,
|
|
2787
|
-
id: "
|
|
2788
|
-
name: "
|
|
2787
|
+
id: "minimax-h3",
|
|
2788
|
+
name: "MiniMax H3",
|
|
2789
2789
|
modelId: "minimax-h3",
|
|
2790
2790
|
addedAt: "2026-07-30",
|
|
2791
2791
|
inputType: "t2v",
|
|
@@ -2810,7 +2810,7 @@ var { MODELS: MODELS9 } = defineModels("minimax", [
|
|
|
2810
2810
|
...params.duration([5, 10, 15]),
|
|
2811
2811
|
...p.aspectRatio(["adaptive", "21:9", "16:9", "4:3", "1:1", "3:4", "9:16"], "adaptive")
|
|
2812
2812
|
},
|
|
2813
|
-
constraints:
|
|
2813
|
+
constraints: minimaxH3Constraints
|
|
2814
2814
|
}
|
|
2815
2815
|
]);
|
|
2816
2816
|
|
|
@@ -3129,9 +3129,6 @@ var { MODELS: MODELS10 } = defineModels("wan", [
|
|
|
3129
3129
|
description: "Wan 3.0 all-in-one \u2014 text, image/video/audio references, and start/end frames with adaptive ratio, intelligent duration, and audio.",
|
|
3130
3130
|
features: [...wanV3Features],
|
|
3131
3131
|
constraints: wanV3Constraints,
|
|
3132
|
-
// Generations at 1080P / long durations can outlast the global 10-min
|
|
3133
|
-
// polling default — widen to 5s × 360 attempts (30 min).
|
|
3134
|
-
pollOptions: { intervalMs: 5e3, maxAttempts: 360 },
|
|
3135
3132
|
paramConfig: { ...wanV3ParamConfig }
|
|
3136
3133
|
},
|
|
3137
3134
|
{
|
|
@@ -3146,7 +3143,6 @@ var { MODELS: MODELS10 } = defineModels("wan", [
|
|
|
3146
3143
|
description: "Wan 3.0 Prime \u2014 the same all-in-one model as Wan 3.0, up to 7x faster.",
|
|
3147
3144
|
features: [...wanV3Features],
|
|
3148
3145
|
constraints: wanV3Constraints,
|
|
3149
|
-
pollOptions: { intervalMs: 5e3, maxAttempts: 360 },
|
|
3150
3146
|
paramConfig: { ...wanV3ParamConfig }
|
|
3151
3147
|
}
|
|
3152
3148
|
]);
|
|
@@ -3786,12 +3782,6 @@ var { MODELS: MODELS12 } = defineModels("seedance", [
|
|
|
3786
3782
|
badge: ["new", "premium", "hot"],
|
|
3787
3783
|
description: "Latest cinematic video with audio, multi-reference input, and mp4/mov output. Up to 30s.",
|
|
3788
3784
|
features: [feat("Reference Image", "frame"), feat("Start/End Frame", "frame"), feat("Audio", "audio"), feat("1080p", "resolution"), feat("4-30 sec", "duration")],
|
|
3789
|
-
// 1080p / 30s runs, and the whole extend path, outlast the global 10-min
|
|
3790
|
-
// polling default: measured p90 for seedance-2.5-video-extend sits above
|
|
3791
|
-
// the 600s ceiling. Widened to 5s × 360 attempts (30 min), same request
|
|
3792
|
-
// count, 3x the wall clock. Deliberately NOT derived from estimatedTime,
|
|
3793
|
-
// which understates seedance latency by ~10x.
|
|
3794
|
-
pollOptions: { intervalMs: 5e3, maxAttempts: 360 },
|
|
3795
3785
|
paramConfig: {
|
|
3796
3786
|
...params.prompt(),
|
|
3797
3787
|
...params.aspectRatio(SEEDANCE_AR),
|
|
@@ -3821,7 +3811,6 @@ var { MODELS: MODELS12 } = defineModels("seedance", [
|
|
|
3821
3811
|
badge: ["new", "premium", "hot"],
|
|
3822
3812
|
description: "Edit video \u2014 replace subjects, add or remove objects, restyle scenes with reference images.",
|
|
3823
3813
|
features: [feat("Video Input", "input"), feat("Multi-Image Input", "input"), feat("Audio", "audio"), feat("1080p", "resolution"), feat("Source length", "duration")],
|
|
3824
|
-
pollOptions: { intervalMs: 5e3, maxAttempts: 360 },
|
|
3825
3814
|
paramConfig: {
|
|
3826
3815
|
...params.prompt(),
|
|
3827
3816
|
// Editing mode: aspect ratio is fixed to 'adaptive' and duration is
|
|
@@ -3848,7 +3837,6 @@ var { MODELS: MODELS12 } = defineModels("seedance", [
|
|
|
3848
3837
|
badge: ["new", "premium", "hot"],
|
|
3849
3838
|
description: "Stitch up to 10 clips into one continuous, extended video.",
|
|
3850
3839
|
features: [feat("Multi-Video Input", "input"), feat("Audio", "audio"), feat("1080p", "resolution"), feat("4-30 sec", "duration")],
|
|
3851
|
-
pollOptions: { intervalMs: 5e3, maxAttempts: 360 },
|
|
3852
3840
|
paramConfig: {
|
|
3853
3841
|
...params.prompt(),
|
|
3854
3842
|
// Extension mode: aspect ratio is locked to 'adaptive' (vendor rule);
|
|
@@ -9904,6 +9892,23 @@ function createCatalogs(transport, options) {
|
|
|
9904
9892
|
}
|
|
9905
9893
|
|
|
9906
9894
|
// src/client/index.ts
|
|
9895
|
+
var MODE_POLL_DEFAULTS = {
|
|
9896
|
+
video: { intervalMs: 2e3, maxAttempts: 1800 },
|
|
9897
|
+
// 2s × 1800 = 1 hour
|
|
9898
|
+
image: { intervalMs: 1e3, maxAttempts: 1200 },
|
|
9899
|
+
// 1s × 1200 = 20 min
|
|
9900
|
+
audio: { intervalMs: 1e3, maxAttempts: 1200 },
|
|
9901
|
+
// 1s × 1200 = 20 min
|
|
9902
|
+
text: { intervalMs: 1e3, maxAttempts: 1200 }
|
|
9903
|
+
// 1s × 1200 = 20 min
|
|
9904
|
+
};
|
|
9905
|
+
function resolvePollOptions(model, overrides) {
|
|
9906
|
+
const resolved = { ...MODE_POLL_DEFAULTS[model.mode], ...model.pollOptions };
|
|
9907
|
+
if (overrides?.intervalMs !== void 0) resolved.intervalMs = overrides.intervalMs;
|
|
9908
|
+
if (overrides?.maxAttempts !== void 0) resolved.maxAttempts = overrides.maxAttempts;
|
|
9909
|
+
if (overrides?.signal !== void 0) resolved.signal = overrides.signal;
|
|
9910
|
+
return resolved;
|
|
9911
|
+
}
|
|
9907
9912
|
function createClient(config) {
|
|
9908
9913
|
const isConfig = isClientConfig(config);
|
|
9909
9914
|
const transport = isConfig ? buildTransport(config) : config;
|
|
@@ -9913,7 +9918,8 @@ function createClient(config) {
|
|
|
9913
9918
|
const catalogs = createCatalogs(transport, isConfig ? config.catalogs : void 0);
|
|
9914
9919
|
const driveConfig = isConfig ? config.drive : void 0;
|
|
9915
9920
|
const driveClient = isConfig && driveConfig ? createDriveClient(resolveFetch(config), config.apiUrl, driveConfig.folder) : null;
|
|
9916
|
-
async function executeModel(model, workflow, payload,
|
|
9921
|
+
async function executeModel(model, workflow, payload, options) {
|
|
9922
|
+
const signal = options?.signal;
|
|
9917
9923
|
if (model.syncExecute || !supportsSubmit) {
|
|
9918
9924
|
const syncResponse = await client.run(
|
|
9919
9925
|
{ workflow, payload, signal },
|
|
@@ -9926,7 +9932,7 @@ function createClient(config) {
|
|
|
9926
9932
|
syncResponse.usage
|
|
9927
9933
|
);
|
|
9928
9934
|
}
|
|
9929
|
-
return client.run({ workflow, payload, signal }, model
|
|
9935
|
+
return client.run({ workflow, payload, signal }, resolvePollOptions(model, options));
|
|
9930
9936
|
}
|
|
9931
9937
|
function buildDrivePayloadOptions(model, params2, options) {
|
|
9932
9938
|
const explicit = options?.drive;
|
|
@@ -9966,7 +9972,7 @@ function createClient(config) {
|
|
|
9966
9972
|
const { workflow, payload, contract } = prepareRequest(resolved, params2);
|
|
9967
9973
|
const drive = buildDrivePayloadOptions(resolved, params2, options);
|
|
9968
9974
|
const finalPayload = injectDriveOptions(payload, drive);
|
|
9969
|
-
const completed = await executeModel(resolved, workflow, finalPayload, options
|
|
9975
|
+
const completed = await executeModel(resolved, workflow, finalPayload, options);
|
|
9970
9976
|
return parseResult(completed, resolved, contract);
|
|
9971
9977
|
},
|
|
9972
9978
|
/**
|
|
@@ -9983,7 +9989,7 @@ function createClient(config) {
|
|
|
9983
9989
|
throw new Error(`${resolved.name} is not a text model \u2014 use generate() instead.`);
|
|
9984
9990
|
}
|
|
9985
9991
|
const { workflow, payload } = prepareRequest(resolved, params2);
|
|
9986
|
-
const completed = await executeModel(resolved, workflow, payload, options
|
|
9992
|
+
const completed = await executeModel(resolved, workflow, payload, options);
|
|
9987
9993
|
return parseTextResult(completed, resolved);
|
|
9988
9994
|
},
|
|
9989
9995
|
/** @deprecated Use `getCredits()` instead. */
|
|
@@ -10027,7 +10033,7 @@ function createClient(config) {
|
|
|
10027
10033
|
async result(handle, model, options) {
|
|
10028
10034
|
const resolved = resolveModel(model);
|
|
10029
10035
|
const contract = getModelContract(resolved.id);
|
|
10030
|
-
const completed = await client.result(handle,
|
|
10036
|
+
const completed = await client.result(handle, resolvePollOptions(resolved, options));
|
|
10031
10037
|
return parseResult(completed, resolved, contract);
|
|
10032
10038
|
},
|
|
10033
10039
|
/**
|
|
@@ -10565,7 +10571,6 @@ var GrokImagineImageQuality = "grok-imagine-image-quality";
|
|
|
10565
10571
|
var GrokImagineVideo = "grok-imagine-video";
|
|
10566
10572
|
var GrokImagineVideo15 = "grok-imagine-video-1.5";
|
|
10567
10573
|
var GrokTts = "grok-tts";
|
|
10568
|
-
var Hailuo03 = "hailuo-03";
|
|
10569
10574
|
var Hailuo23 = "hailuo-2.3";
|
|
10570
10575
|
var Hailuo23Fast = "hailuo-2.3-fast";
|
|
10571
10576
|
var Hailuo23FastPro = "hailuo-2.3-fast-pro";
|
|
@@ -10618,6 +10623,7 @@ var LumaUni1Max = "luma-uni-1-max";
|
|
|
10618
10623
|
var Lyria3Clip = "lyria-3-clip";
|
|
10619
10624
|
var Lyria3Pro = "lyria-3-pro";
|
|
10620
10625
|
var Minimax02Hd = "minimax-02-hd";
|
|
10626
|
+
var MinimaxH3 = "minimax-h3";
|
|
10621
10627
|
var MinimaxMusicV2 = "minimax-music-v2";
|
|
10622
10628
|
var MinimaxMusicV3 = "minimax-music-v3";
|
|
10623
10629
|
var Ovi = "ovi";
|
|
@@ -10774,7 +10780,6 @@ var Models = {
|
|
|
10774
10780
|
GrokImagineVideo,
|
|
10775
10781
|
GrokImagineVideo15,
|
|
10776
10782
|
GrokTts,
|
|
10777
|
-
Hailuo03,
|
|
10778
10783
|
Hailuo23,
|
|
10779
10784
|
Hailuo23Fast,
|
|
10780
10785
|
Hailuo23FastPro,
|
|
@@ -10827,6 +10832,7 @@ var Models = {
|
|
|
10827
10832
|
Lyria3Clip,
|
|
10828
10833
|
Lyria3Pro,
|
|
10829
10834
|
Minimax02Hd,
|
|
10835
|
+
MinimaxH3,
|
|
10830
10836
|
MinimaxMusicV2,
|
|
10831
10837
|
MinimaxMusicV3,
|
|
10832
10838
|
Ovi,
|