@picsart/ai-sdk 5.22.0 → 5.23.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.
- package/README.md +3 -3
- package/index.d.ts +21 -2
- package/index.js +89 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -144,10 +144,10 @@ catalog.find({ output: 'text' })
|
|
|
144
144
|
image/video model throws, and `generate()` throws on a text model — use the matching
|
|
145
145
|
method for each.
|
|
146
146
|
|
|
147
|
-
## Voice &
|
|
147
|
+
## Voice, Avatar & Template Catalogs
|
|
148
148
|
|
|
149
|
-
Models with catalog-backed params (voices, avatars) serve their option lists
|
|
150
|
-
from platform catalog tasks (`<vendor>/v1/catalog/<voices|avatars
|
|
149
|
+
Models with catalog-backed params (voices, avatars, effect / caption templates) serve their option lists
|
|
150
|
+
from platform catalog tasks (`<vendor>/v1/catalog/<voices|avatars|templates|…>`) — nothing
|
|
151
151
|
is bundled; the workers cache the lists and answer fast. Fetch them via
|
|
152
152
|
`ai.catalogs`:
|
|
153
153
|
|
package/index.d.ts
CHANGED
|
@@ -112,6 +112,10 @@ type ModelInputById = {
|
|
|
112
112
|
"bytedance-video-upscaler": {
|
|
113
113
|
videoUrl: string;
|
|
114
114
|
};
|
|
115
|
+
"captionsai-video-captions": {
|
|
116
|
+
videoUrl: string;
|
|
117
|
+
templateId?: string;
|
|
118
|
+
};
|
|
115
119
|
"claude-haiku-4-5": {
|
|
116
120
|
prompt: string;
|
|
117
121
|
imageUrls?: string[];
|
|
@@ -968,6 +972,17 @@ type ModelInputById = {
|
|
|
968
972
|
enhancePrompt?: boolean;
|
|
969
973
|
imageUrls?: string[];
|
|
970
974
|
promptExtendMode?: "direct" | "agent";
|
|
975
|
+
enableThinking?: boolean;
|
|
976
|
+
};
|
|
977
|
+
"qwen-image-3.0-pro": {
|
|
978
|
+
prompt: string;
|
|
979
|
+
negativePrompt?: string;
|
|
980
|
+
resolution?: "2048x2048" | "2688x1536" | "1536x2688" | "2368x1728" | "1728x2368";
|
|
981
|
+
count?: 1 | 2 | 4 | 6;
|
|
982
|
+
enhancePrompt?: boolean;
|
|
983
|
+
imageUrls?: string[];
|
|
984
|
+
promptExtendMode?: "direct" | "agent";
|
|
985
|
+
enableThinking?: boolean;
|
|
971
986
|
};
|
|
972
987
|
"recraft-creative-upscale": {
|
|
973
988
|
imageUrls: [string, ...string[]];
|
|
@@ -2002,7 +2017,7 @@ interface ModelFilter$1 {
|
|
|
2002
2017
|
release?: ReleaseTag[];
|
|
2003
2018
|
}
|
|
2004
2019
|
|
|
2005
|
-
type AppProvider = 'picsart' | 'google' | 'kling' | 'grok' | 'openai' | 'flux' | 'ideogram' | 'elevenlabs' | 'minimax' | 'wan' | 'seedance' | 'ltx' | 'seedream' | 'seedaudio' | 'hunyuan' | 'pika' | 'runway' | 'luma' | 'ovi' | 'creatify' | 'veed' | 'bytedance' | 'qwen' | 'reve' | 'recraft' | 'videography' | 'topaz' | 'heygen' | 'happyhorse' | 'pixverse' | 'anthropic' | 'async';
|
|
2020
|
+
type AppProvider = 'picsart' | 'google' | 'kling' | 'grok' | 'openai' | 'flux' | 'ideogram' | 'elevenlabs' | 'minimax' | 'wan' | 'seedance' | 'ltx' | 'seedream' | 'seedaudio' | 'hunyuan' | 'pika' | 'runway' | 'luma' | 'ovi' | 'creatify' | 'veed' | 'bytedance' | 'qwen' | 'reve' | 'recraft' | 'videography' | 'topaz' | 'heygen' | 'happyhorse' | 'pixverse' | 'anthropic' | 'async' | 'captionsai';
|
|
2006
2021
|
/** Provider used by model definitions. */
|
|
2007
2022
|
type Provider = AppProvider;
|
|
2008
2023
|
/** App generation modes. */
|
|
@@ -2100,8 +2115,10 @@ interface GenerationContext {
|
|
|
2100
2115
|
substyle?: string;
|
|
2101
2116
|
thinkingLevel?: 'minimal' | 'high';
|
|
2102
2117
|
thinkingBudget?: number;
|
|
2103
|
-
/** Qwen 3.0 — prompt-rewrite strategy (`direct`/`agent`), sent as `prompt_extend_mode`. */
|
|
2118
|
+
/** Qwen 3.0 family — prompt-rewrite strategy (`direct`/`agent`), sent as `prompt_extend_mode`. */
|
|
2104
2119
|
promptExtendMode?: 'direct' | 'agent';
|
|
2120
|
+
/** Qwen 3.0 family — thinking mode (requires prompt_extend), sent as `enable_thinking`. */
|
|
2121
|
+
enableThinking?: boolean;
|
|
2105
2122
|
}
|
|
2106
2123
|
type PayloadBuilder<TContext extends GenerationContext = GenerationContext> = (ctx: TContext) => object;
|
|
2107
2124
|
/** Lightweight runtime schema contract used by SDK integrations. */
|
|
@@ -2501,6 +2518,7 @@ declare const Models: {
|
|
|
2501
2518
|
readonly BytedanceOmnihumanV15: "bytedance-omnihuman-v1.5";
|
|
2502
2519
|
readonly BytedanceVideoEnhance: "bytedance-video-enhance";
|
|
2503
2520
|
readonly BytedanceVideoUpscaler: "bytedance-video-upscaler";
|
|
2521
|
+
readonly CaptionsaiVideoCaptions: "captionsai-video-captions";
|
|
2504
2522
|
readonly ClaudeHaiku45: "claude-haiku-4-5";
|
|
2505
2523
|
readonly ClaudeOpus48: "claude-opus-4-8";
|
|
2506
2524
|
readonly ClaudeSonnet46: "claude-sonnet-4-6";
|
|
@@ -2630,6 +2648,7 @@ declare const Models: {
|
|
|
2630
2648
|
readonly QwenImage2: "qwen-image-2";
|
|
2631
2649
|
readonly QwenImage2Pro: "qwen-image-2-pro";
|
|
2632
2650
|
readonly QwenImage30: "qwen-image-3.0";
|
|
2651
|
+
readonly QwenImage30Pro: "qwen-image-3.0-pro";
|
|
2633
2652
|
readonly RecraftCreativeUpscale: "recraft-creative-upscale";
|
|
2634
2653
|
readonly RecraftCrispUpscale: "recraft-crisp-upscale";
|
|
2635
2654
|
readonly RecraftExplore: "recraft-explore";
|
package/index.js
CHANGED
|
@@ -820,7 +820,8 @@ var providers = {
|
|
|
820
820
|
happyhorse: { color: "#FF6A00", label: "HH", name: "Happy Horse" },
|
|
821
821
|
pixverse: { color: "#7C3AED", label: "PV", name: "PixVerse" },
|
|
822
822
|
anthropic: { color: "#D97757", label: "CL", name: "Anthropic" },
|
|
823
|
-
async: { color: "#5E5CE6", label: "AA", name: "Async AI" }
|
|
823
|
+
async: { color: "#5E5CE6", label: "AA", name: "Async AI" },
|
|
824
|
+
captionsai: { color: "#1D1F20", label: "MR", name: "Mirage" }
|
|
824
825
|
};
|
|
825
826
|
|
|
826
827
|
// src/core/descriptors/presets.ts
|
|
@@ -1175,7 +1176,7 @@ var passthroughPayload = (paramConfig) => (ctx) => {
|
|
|
1175
1176
|
return payload;
|
|
1176
1177
|
};
|
|
1177
1178
|
function defineModels(provider, configs) {
|
|
1178
|
-
const
|
|
1179
|
+
const MODELS38 = [];
|
|
1179
1180
|
for (const c of configs) {
|
|
1180
1181
|
const prov = c.provider ?? provider;
|
|
1181
1182
|
const resolvedPayload = c.buildPayload ?? passthroughPayload(c.paramConfig);
|
|
@@ -1211,19 +1212,19 @@ function defineModels(provider, configs) {
|
|
|
1211
1212
|
if (c.constraints !== void 0) model.constraints = c.constraints;
|
|
1212
1213
|
const contract = createModelContract(model);
|
|
1213
1214
|
model.outputSchema = c.outputSchema ?? contract.output;
|
|
1214
|
-
|
|
1215
|
+
MODELS38.push(model);
|
|
1215
1216
|
}
|
|
1216
|
-
return { MODELS:
|
|
1217
|
+
return { MODELS: MODELS38 };
|
|
1217
1218
|
}
|
|
1218
|
-
function registerPayloads(
|
|
1219
|
+
function registerPayloads(MODELS38, payloads) {
|
|
1219
1220
|
for (const [id, builder] of Object.entries(payloads)) {
|
|
1220
|
-
const model =
|
|
1221
|
+
const model = MODELS38.find((m) => m.id === id);
|
|
1221
1222
|
if (model) model.buildPayload = builder;
|
|
1222
1223
|
}
|
|
1223
1224
|
}
|
|
1224
|
-
function registerEditPayloads(
|
|
1225
|
+
function registerEditPayloads(MODELS38, payloads) {
|
|
1225
1226
|
for (const [id, builder] of Object.entries(payloads)) {
|
|
1226
|
-
const model =
|
|
1227
|
+
const model = MODELS38.find((m) => m.id === id);
|
|
1227
1228
|
if (model) model.buildEditPayload = builder;
|
|
1228
1229
|
}
|
|
1229
1230
|
}
|
|
@@ -6735,6 +6736,7 @@ var buildQwen2Payload = (ctx) => {
|
|
|
6735
6736
|
};
|
|
6736
6737
|
var buildQwenV1 = (model) => (ctx) => {
|
|
6737
6738
|
const hasImages = Array.isArray(ctx.imageUrls) && ctx.imageUrls.length > 0;
|
|
6739
|
+
const promptExtendMode = ctx.promptExtendMode === "agent" && hasImages && model === "qwen-image-3.0-pro" ? void 0 : ctx.promptExtendMode;
|
|
6738
6740
|
return {
|
|
6739
6741
|
prompt: ctx.prompt,
|
|
6740
6742
|
model,
|
|
@@ -6743,8 +6745,10 @@ var buildQwenV1 = (model) => (ctx) => {
|
|
|
6743
6745
|
size: (ctx.resolution ?? "2048x2048").replace("x", "*"),
|
|
6744
6746
|
n: ctx.count ?? 1,
|
|
6745
6747
|
prompt_extend: ctx.enhancePrompt ?? true,
|
|
6746
|
-
// Qwen 3.0 only — prompt-rewrite strategy (direct/agent); 2.x ignores it.
|
|
6747
|
-
...
|
|
6748
|
+
// Qwen 3.0 family only — prompt-rewrite strategy (direct/agent); 2.x ignores it.
|
|
6749
|
+
...promptExtendMode ? { prompt_extend_mode: promptExtendMode } : {},
|
|
6750
|
+
// Qwen 3.0 family only — thinking mode (requires prompt_extend).
|
|
6751
|
+
...ctx.enableThinking != null ? { enable_thinking: ctx.enableThinking } : {},
|
|
6748
6752
|
watermark: false,
|
|
6749
6753
|
...ctx.seed != null ? { seed: ctx.seed } : {}
|
|
6750
6754
|
};
|
|
@@ -6759,7 +6763,8 @@ var qwenV1Params = {
|
|
|
6759
6763
|
};
|
|
6760
6764
|
var qwenV1Params3 = {
|
|
6761
6765
|
...qwenV1Params,
|
|
6762
|
-
...p.enum("promptExtendMode", ["direct", "agent"], "direct")
|
|
6766
|
+
...p.enum("promptExtendMode", ["direct", "agent"], "direct"),
|
|
6767
|
+
...p.boolean("enableThinking", true, "Deep Thinking")
|
|
6763
6768
|
};
|
|
6764
6769
|
var { MODELS: MODELS28 } = defineModels("qwen", [
|
|
6765
6770
|
{
|
|
@@ -6837,6 +6842,25 @@ var { MODELS: MODELS28 } = defineModels("qwen", [
|
|
|
6837
6842
|
feat("2K", "resolution")
|
|
6838
6843
|
],
|
|
6839
6844
|
paramConfig: qwenV1Params3
|
|
6845
|
+
},
|
|
6846
|
+
{
|
|
6847
|
+
id: "qwen-image-3.0-pro",
|
|
6848
|
+
name: "Qwen 3.0 Pro",
|
|
6849
|
+
addedAt: "2026-08-31",
|
|
6850
|
+
workflow: "qwen/v1/text-to-image",
|
|
6851
|
+
editWorkflow: "qwen/v1/image-to-image",
|
|
6852
|
+
buildPayload: buildQwenV1("qwen-image-3.0-pro"),
|
|
6853
|
+
estimatedTime: 90,
|
|
6854
|
+
mode: "image",
|
|
6855
|
+
inputType: "t2i",
|
|
6856
|
+
badge: ["premium"],
|
|
6857
|
+
description: "Qwen-Image 3.0 Pro (GA) \u2014 flagship text-to-image and image editing with prompt-rewrite modes and thinking mode.",
|
|
6858
|
+
features: [
|
|
6859
|
+
feat("Image Input", "input"),
|
|
6860
|
+
feat("Negative Prompt", "characteristic"),
|
|
6861
|
+
feat("2K", "resolution")
|
|
6862
|
+
],
|
|
6863
|
+
paramConfig: qwenV1Params3
|
|
6840
6864
|
}
|
|
6841
6865
|
]);
|
|
6842
6866
|
|
|
@@ -8458,6 +8482,54 @@ registerPayloads(MODELS36, {
|
|
|
8458
8482
|
"gemini-3.5-flash-lite": buildOpenAiPayload("gemini-3.5-flash-lite")
|
|
8459
8483
|
});
|
|
8460
8484
|
|
|
8485
|
+
// src/vendors/catalog/captionsai.ts
|
|
8486
|
+
var CAPTIONS_MAX_DURATION_SEC = 300;
|
|
8487
|
+
var CAPTIONS_MAX_BYTES = 50 * 1024 * 1024;
|
|
8488
|
+
var DEFAULT_CAPTION_TEMPLATE_ID = "ctpl_DxflLOnuKkb198FNdI9E";
|
|
8489
|
+
var { MODELS: MODELS37 } = defineModels("captionsai", [
|
|
8490
|
+
{
|
|
8491
|
+
id: "captionsai-video-captions",
|
|
8492
|
+
name: "Captions",
|
|
8493
|
+
modelId: "mirage-captions",
|
|
8494
|
+
addedAt: "2026-08-27",
|
|
8495
|
+
workflow: "captionsai/v1/videos/captions",
|
|
8496
|
+
// ~26s measured for an 8s clip on the live API; scales with clip length.
|
|
8497
|
+
estimatedTime: 60,
|
|
8498
|
+
mode: "video",
|
|
8499
|
+
inputType: "v2v",
|
|
8500
|
+
// Stage-only until the worker is deployed to prod and the pricing record
|
|
8501
|
+
// (mirage-captions / video-to-video) exists — flip to production then.
|
|
8502
|
+
release: "preview",
|
|
8503
|
+
description: "Auto-transcribes a vertical video and burns in animated captions from 67 style templates \u2014 up to 5 minutes, 9:16.",
|
|
8504
|
+
features: [
|
|
8505
|
+
feat("Video Required", "input"),
|
|
8506
|
+
feat("9:16", "resolution"),
|
|
8507
|
+
feat("Up to 5 min", "duration"),
|
|
8508
|
+
feat("67 Templates", "style")
|
|
8509
|
+
],
|
|
8510
|
+
paramConfig: {
|
|
8511
|
+
...params.videoInput("Source Video", "asset", true, CAPTIONS_MAX_DURATION_SEC, void 0, CAPTIONS_MAX_BYTES),
|
|
8512
|
+
...params.catalog("templateId", {
|
|
8513
|
+
label: "Caption Style",
|
|
8514
|
+
// Not `required`: the declared default fills it, and request validation runs
|
|
8515
|
+
// before the payload builder — a required flag would reject the very
|
|
8516
|
+
// calls the default exists for (same shape as Kling's effect templateId).
|
|
8517
|
+
source: { workflow: "captionsai/v1/catalog/caption-templates" },
|
|
8518
|
+
default: DEFAULT_CAPTION_TEMPLATE_ID
|
|
8519
|
+
})
|
|
8520
|
+
}
|
|
8521
|
+
}
|
|
8522
|
+
]);
|
|
8523
|
+
|
|
8524
|
+
// src/vendors/catalog/captionsai.payloads.ts
|
|
8525
|
+
var buildCaptionsPayload = (input) => ({
|
|
8526
|
+
video: { url: input.videoUrl },
|
|
8527
|
+
caption_template_id: input.templateId ?? DEFAULT_CAPTION_TEMPLATE_ID
|
|
8528
|
+
});
|
|
8529
|
+
registerPayloads(MODELS37, {
|
|
8530
|
+
"captionsai-video-captions": buildCaptionsPayload
|
|
8531
|
+
});
|
|
8532
|
+
|
|
8461
8533
|
// src/vendors/catalog/index.ts
|
|
8462
8534
|
var ALL_MODELS = [
|
|
8463
8535
|
...MODELS,
|
|
@@ -8495,7 +8567,8 @@ var ALL_MODELS = [
|
|
|
8495
8567
|
...MODELS33,
|
|
8496
8568
|
...MODELS34,
|
|
8497
8569
|
...MODELS35,
|
|
8498
|
-
...MODELS36
|
|
8570
|
+
...MODELS36,
|
|
8571
|
+
...MODELS37
|
|
8499
8572
|
];
|
|
8500
8573
|
var getModelsByMode = (mode, includeDisabled = false) => ALL_MODELS.filter((m) => m.mode === mode && (includeDisabled || isVisibleForReleases(m)));
|
|
8501
8574
|
|
|
@@ -10587,6 +10660,7 @@ var AsyncFlashV1 = "async-flash-v1";
|
|
|
10587
10660
|
var BytedanceOmnihumanV15 = "bytedance-omnihuman-v1.5";
|
|
10588
10661
|
var BytedanceVideoEnhance = "bytedance-video-enhance";
|
|
10589
10662
|
var BytedanceVideoUpscaler = "bytedance-video-upscaler";
|
|
10663
|
+
var CaptionsaiVideoCaptions = "captionsai-video-captions";
|
|
10590
10664
|
var ClaudeHaiku45 = "claude-haiku-4-5";
|
|
10591
10665
|
var ClaudeOpus48 = "claude-opus-4-8";
|
|
10592
10666
|
var ClaudeSonnet46 = "claude-sonnet-4-6";
|
|
@@ -10716,6 +10790,7 @@ var Qwen = "qwen";
|
|
|
10716
10790
|
var QwenImage2 = "qwen-image-2";
|
|
10717
10791
|
var QwenImage2Pro = "qwen-image-2-pro";
|
|
10718
10792
|
var QwenImage30 = "qwen-image-3.0";
|
|
10793
|
+
var QwenImage30Pro = "qwen-image-3.0-pro";
|
|
10719
10794
|
var RecraftCreativeUpscale = "recraft-creative-upscale";
|
|
10720
10795
|
var RecraftCrispUpscale = "recraft-crisp-upscale";
|
|
10721
10796
|
var RecraftExplore = "recraft-explore";
|
|
@@ -10797,6 +10872,7 @@ var Models = {
|
|
|
10797
10872
|
BytedanceOmnihumanV15,
|
|
10798
10873
|
BytedanceVideoEnhance,
|
|
10799
10874
|
BytedanceVideoUpscaler,
|
|
10875
|
+
CaptionsaiVideoCaptions,
|
|
10800
10876
|
ClaudeHaiku45,
|
|
10801
10877
|
ClaudeOpus48,
|
|
10802
10878
|
ClaudeSonnet46,
|
|
@@ -10926,6 +11002,7 @@ var Models = {
|
|
|
10926
11002
|
QwenImage2,
|
|
10927
11003
|
QwenImage2Pro,
|
|
10928
11004
|
QwenImage30,
|
|
11005
|
+
QwenImage30Pro,
|
|
10929
11006
|
RecraftCreativeUpscale,
|
|
10930
11007
|
RecraftCrispUpscale,
|
|
10931
11008
|
RecraftExplore,
|