@picsart/ai-sdk 5.30.0 → 5.32.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/_vendor/workflows-types/index.d.ts +1404 -1347
- package/index.d.ts +31 -4
- package/index.js +83 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -383,6 +383,24 @@ type ModelInputById = {
|
|
|
383
383
|
count?: 1 | 2 | 4 | 6 | 8 | 10;
|
|
384
384
|
imageUrls?: string[];
|
|
385
385
|
};
|
|
386
|
+
"gpt-image-2.5-flare": {
|
|
387
|
+
prompt: string;
|
|
388
|
+
aspectRatio?: "1:1" | "3:2" | "2:3" | "16:9" | "9:16" | "4:3" | "3:4" | "auto";
|
|
389
|
+
quality?: "max" | "xhigh" | "high" | "medium" | "low";
|
|
390
|
+
background?: "opaque" | "transparent";
|
|
391
|
+
outputFormat?: "png" | "jpeg" | "webp";
|
|
392
|
+
count?: 1 | 2 | 4 | 6 | 8 | 10;
|
|
393
|
+
imageUrls?: string[];
|
|
394
|
+
};
|
|
395
|
+
"gpt-image-2.5-sunburst": {
|
|
396
|
+
prompt: string;
|
|
397
|
+
aspectRatio?: "1:1" | "3:2" | "2:3" | "16:9" | "9:16" | "4:3" | "3:4" | "auto";
|
|
398
|
+
quality?: "max" | "xhigh" | "high" | "medium" | "low";
|
|
399
|
+
background?: "opaque" | "transparent";
|
|
400
|
+
outputFormat?: "png" | "jpeg" | "webp";
|
|
401
|
+
count?: 1 | 2 | 4 | 6 | 8 | 10;
|
|
402
|
+
imageUrls?: string[];
|
|
403
|
+
};
|
|
386
404
|
"grok-edit-video": {
|
|
387
405
|
prompt: string;
|
|
388
406
|
videoUrl: string;
|
|
@@ -2482,6 +2500,11 @@ interface ClientConfig {
|
|
|
2482
2500
|
apiUrl: string;
|
|
2483
2501
|
/** Enable Drive integration — auto-save generations to a Drive folder. */
|
|
2484
2502
|
drive?: DriveConfig;
|
|
2503
|
+
/**
|
|
2504
|
+
* Input-transformation defaults applied to every generation. A per-call
|
|
2505
|
+
* `options.inputsTransformation` overrides this field by field.
|
|
2506
|
+
*/
|
|
2507
|
+
inputsTransformation?: PayloadInputsTransformationOptions;
|
|
2485
2508
|
/**
|
|
2486
2509
|
* Voice/avatar catalog behavior. `{ preload: true }` loads the first page
|
|
2487
2510
|
* of every catalog-bound param in the background at client creation.
|
|
@@ -2527,8 +2550,9 @@ interface PayloadInputsTransformationOptions {
|
|
|
2527
2550
|
/**
|
|
2528
2551
|
* Downscale input images that exceed the vendor's download size cap
|
|
2529
2552
|
* (e.g. ByteDance's 30 MiB) and retry the generation once, instead of
|
|
2530
|
-
* failing with an input-limit error.
|
|
2531
|
-
* input
|
|
2553
|
+
* failing with an input-limit error. Opt-in — defaults to false, so an
|
|
2554
|
+
* oversized input fails fast unless you set this; workers without input
|
|
2555
|
+
* transformation ignore it.
|
|
2532
2556
|
*/
|
|
2533
2557
|
downscaleOversizedImages?: boolean;
|
|
2534
2558
|
}
|
|
@@ -2550,8 +2574,9 @@ interface GenerateOptions {
|
|
|
2550
2574
|
folder?: DriveFolder;
|
|
2551
2575
|
/** Save result to Picsart Drive via backend. Injected into the workflow payload. */
|
|
2552
2576
|
drive?: PayloadDriveOptions;
|
|
2553
|
-
/** Input-transformation settings
|
|
2554
|
-
*
|
|
2577
|
+
/** Input-transformation settings for this call — overrides the client-level
|
|
2578
|
+
* `inputsTransformation`. When neither is set, oversized-image downscaling
|
|
2579
|
+
* stays off (opt-in). */
|
|
2555
2580
|
inputsTransformation?: PayloadInputsTransformationOptions;
|
|
2556
2581
|
/**
|
|
2557
2582
|
* App identity stamped onto the saved generation (appId/appType).
|
|
@@ -2679,6 +2704,8 @@ declare const Models: {
|
|
|
2679
2704
|
readonly GptImage1: "gpt-image-1";
|
|
2680
2705
|
readonly GptImage15: "gpt-image-1.5";
|
|
2681
2706
|
readonly GptImage2: "gpt-image-2";
|
|
2707
|
+
readonly GptImage25Flare: "gpt-image-2.5-flare";
|
|
2708
|
+
readonly GptImage25Sunburst: "gpt-image-2.5-sunburst";
|
|
2682
2709
|
readonly GrokEditVideo: "grok-edit-video";
|
|
2683
2710
|
readonly GrokExtendVideo: "grok-extend-video";
|
|
2684
2711
|
readonly GrokImagineImage: "grok-imagine-image";
|
package/index.js
CHANGED
|
@@ -6163,6 +6163,9 @@ var buildGptImage2EditPayload = (ctx) => ({
|
|
|
6163
6163
|
...ctx.outputFormat ? { output_format: ctx.outputFormat } : {}
|
|
6164
6164
|
});
|
|
6165
6165
|
var GPT_IMAGE_PROMPT_MAX = 32e3;
|
|
6166
|
+
var GPT_IMAGE_25_QUALITIES = ["max", "xhigh", "high", "medium", "low"];
|
|
6167
|
+
var GPT_IMAGE_25_ASPECT_RATIOS = ["1:1", "3:2", "2:3", "16:9", "9:16", "4:3", "3:4", "auto"];
|
|
6168
|
+
var GPT_IMAGE_25_MAX_INPUT_IMAGES = 16;
|
|
6166
6169
|
var gptImage2Constraints = [
|
|
6167
6170
|
{
|
|
6168
6171
|
when: { imageUrls: { exists: true } },
|
|
@@ -6181,6 +6184,50 @@ var gptImageBgConstraints = [
|
|
|
6181
6184
|
];
|
|
6182
6185
|
var { MODELS: MODELS23 } = defineModels("openai", [
|
|
6183
6186
|
// ── Image ─────────────────────────────────────────
|
|
6187
|
+
{
|
|
6188
|
+
id: "gpt-image-2.5-sunburst",
|
|
6189
|
+
name: "GPT Image 2.5 Sunburst",
|
|
6190
|
+
addedAt: "2026-09-09",
|
|
6191
|
+
workflow: "openai-images-generate",
|
|
6192
|
+
editWorkflow: "openai-image-editing",
|
|
6193
|
+
estimatedTime: 60,
|
|
6194
|
+
mode: "image",
|
|
6195
|
+
inputType: "t2i",
|
|
6196
|
+
description: "Most capable GPT Image tier \u2014 premium edits and campaign-grade output, with longer generation times.",
|
|
6197
|
+
features: [feat("Multi-Image Input", "input"), feat("High Quality", "quality")],
|
|
6198
|
+
paramConfig: {
|
|
6199
|
+
...params.prompt({ maxLength: GPT_IMAGE_PROMPT_MAX }),
|
|
6200
|
+
...params.aspectRatio(GPT_IMAGE_25_ASPECT_RATIOS, "1:1"),
|
|
6201
|
+
...p.quality(GPT_IMAGE_25_QUALITIES, "high"),
|
|
6202
|
+
...p.enum("background", ["opaque", "transparent"], "opaque", { label: "Background" }),
|
|
6203
|
+
...p.enum("outputFormat", ["png", "jpeg", "webp"], "png", { label: "Format" }),
|
|
6204
|
+
...params.count(),
|
|
6205
|
+
...params.imageInput(GPT_IMAGE_25_MAX_INPUT_IMAGES, "Source Images")
|
|
6206
|
+
},
|
|
6207
|
+
constraints: gptImageBgConstraints
|
|
6208
|
+
},
|
|
6209
|
+
{
|
|
6210
|
+
id: "gpt-image-2.5-flare",
|
|
6211
|
+
name: "GPT Image 2.5 Flare",
|
|
6212
|
+
addedAt: "2026-09-09",
|
|
6213
|
+
workflow: "openai-images-generate",
|
|
6214
|
+
editWorkflow: "openai-image-editing",
|
|
6215
|
+
estimatedTime: 25,
|
|
6216
|
+
mode: "image",
|
|
6217
|
+
inputType: "t2i",
|
|
6218
|
+
description: "Fast GPT Image tier \u2014 everyday generation at roughly half the latency of GPT Image 2.",
|
|
6219
|
+
features: [feat("Multi-Image Input", "input"), feat("Fast", "characteristic")],
|
|
6220
|
+
paramConfig: {
|
|
6221
|
+
...params.prompt({ maxLength: GPT_IMAGE_PROMPT_MAX }),
|
|
6222
|
+
...params.aspectRatio(GPT_IMAGE_25_ASPECT_RATIOS, "1:1"),
|
|
6223
|
+
...p.quality(GPT_IMAGE_25_QUALITIES, "high"),
|
|
6224
|
+
...p.enum("background", ["opaque", "transparent"], "opaque", { label: "Background" }),
|
|
6225
|
+
...p.enum("outputFormat", ["png", "jpeg", "webp"], "png", { label: "Format" }),
|
|
6226
|
+
...params.count(),
|
|
6227
|
+
...params.imageInput(GPT_IMAGE_25_MAX_INPUT_IMAGES, "Source Images")
|
|
6228
|
+
},
|
|
6229
|
+
constraints: gptImageBgConstraints
|
|
6230
|
+
},
|
|
6184
6231
|
{
|
|
6185
6232
|
id: "gpt-image-2",
|
|
6186
6233
|
name: "GPT Image 2",
|
|
@@ -6261,6 +6308,36 @@ var { MODELS: MODELS23 } = defineModels("openai", [
|
|
|
6261
6308
|
}
|
|
6262
6309
|
]);
|
|
6263
6310
|
|
|
6311
|
+
// src/vendors/catalog/openai.payloads.ts
|
|
6312
|
+
var resolveSize = (aspectRatio, fallback) => aspectRatio === "auto" ? "auto" : GPT_IMAGE_2_AR_TO_SIZE[aspectRatio ?? ""] ?? fallback;
|
|
6313
|
+
var generateFor = (model) => (input) => ({
|
|
6314
|
+
prompt: input.prompt,
|
|
6315
|
+
model,
|
|
6316
|
+
n: input.count ?? 1,
|
|
6317
|
+
size: resolveSize(input.aspectRatio, "1024x1024"),
|
|
6318
|
+
quality: input.quality ?? "high",
|
|
6319
|
+
...input.background ? { background: input.background } : {},
|
|
6320
|
+
...input.outputFormat ? { output_format: input.outputFormat } : {}
|
|
6321
|
+
});
|
|
6322
|
+
var editFor = (model) => (input) => ({
|
|
6323
|
+
prompt: input.prompt,
|
|
6324
|
+
model,
|
|
6325
|
+
images: input.imageUrls ?? [],
|
|
6326
|
+
n: input.count ?? 1,
|
|
6327
|
+
size: resolveSize(input.aspectRatio, "auto"),
|
|
6328
|
+
quality: input.quality ?? "high",
|
|
6329
|
+
...input.background ? { background: input.background } : {},
|
|
6330
|
+
...input.outputFormat ? { output_format: input.outputFormat } : {}
|
|
6331
|
+
});
|
|
6332
|
+
registerPayloads(MODELS23, {
|
|
6333
|
+
"gpt-image-2.5-flare": generateFor("gpt-image-2.5-flare"),
|
|
6334
|
+
"gpt-image-2.5-sunburst": generateFor("gpt-image-2.5-sunburst")
|
|
6335
|
+
});
|
|
6336
|
+
registerEditPayloads(MODELS23, {
|
|
6337
|
+
"gpt-image-2.5-flare": editFor("gpt-image-2.5-flare"),
|
|
6338
|
+
"gpt-image-2.5-sunburst": editFor("gpt-image-2.5-sunburst")
|
|
6339
|
+
});
|
|
6340
|
+
|
|
6264
6341
|
// src/vendors/catalog/elevenlabs.ts
|
|
6265
6342
|
var buildElevenLabsTTSPayload = (modelId) => (ctx) => ({
|
|
6266
6343
|
text: ctx.prompt,
|
|
@@ -10712,6 +10789,7 @@ function createClient(config) {
|
|
|
10712
10789
|
const supportsSubmit = typeof transport.submit === "function";
|
|
10713
10790
|
const apis = createApis(isConfig ? config : null);
|
|
10714
10791
|
const catalogs = createCatalogs(transport, isConfig ? config.catalogs : void 0);
|
|
10792
|
+
const inputsTransformationConfig = isConfig ? config.inputsTransformation : void 0;
|
|
10715
10793
|
const driveConfig = isConfig ? config.drive : void 0;
|
|
10716
10794
|
const driveClient = isConfig && driveConfig ? createDriveClient(resolveFetch(config), config.apiUrl, driveConfig.folder) : null;
|
|
10717
10795
|
async function executeModel(model, workflow, payload, options) {
|
|
@@ -10754,7 +10832,7 @@ function createClient(config) {
|
|
|
10754
10832
|
options: {
|
|
10755
10833
|
...existing,
|
|
10756
10834
|
inputs_transformation: {
|
|
10757
|
-
downscale_oversized_images: inputsTransformation?.downscaleOversizedImages ??
|
|
10835
|
+
downscale_oversized_images: inputsTransformation?.downscaleOversizedImages ?? inputsTransformationConfig?.downscaleOversizedImages ?? false
|
|
10758
10836
|
},
|
|
10759
10837
|
...drive ? { drive } : {}
|
|
10760
10838
|
}
|
|
@@ -11390,6 +11468,8 @@ var Gpt6Astra = "gpt-6-astra";
|
|
|
11390
11468
|
var GptImage1 = "gpt-image-1";
|
|
11391
11469
|
var GptImage15 = "gpt-image-1.5";
|
|
11392
11470
|
var GptImage2 = "gpt-image-2";
|
|
11471
|
+
var GptImage25Flare = "gpt-image-2.5-flare";
|
|
11472
|
+
var GptImage25Sunburst = "gpt-image-2.5-sunburst";
|
|
11393
11473
|
var GrokEditVideo = "grok-edit-video";
|
|
11394
11474
|
var GrokExtendVideo = "grok-extend-video";
|
|
11395
11475
|
var GrokImagineImage = "grok-imagine-image";
|
|
@@ -11613,6 +11693,8 @@ var Models = {
|
|
|
11613
11693
|
GptImage1,
|
|
11614
11694
|
GptImage15,
|
|
11615
11695
|
GptImage2,
|
|
11696
|
+
GptImage25Flare,
|
|
11697
|
+
GptImage25Sunburst,
|
|
11616
11698
|
GrokEditVideo,
|
|
11617
11699
|
GrokExtendVideo,
|
|
11618
11700
|
GrokImagineImage,
|