@picsart/ai-sdk 5.6.0 → 5.6.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 +7 -8
- package/index.js +35 -20
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1059,31 +1059,27 @@ type ModelInputById = {
|
|
|
1059
1059
|
};
|
|
1060
1060
|
"recraftv4_styles": {
|
|
1061
1061
|
prompt: string;
|
|
1062
|
+
styleReferenceUrls: [string, ...string[]];
|
|
1062
1063
|
aspectRatio?: "1:1" | "4:3" | "3:4" | "3:2" | "2:3" | "16:9" | "9:16" | "2:1" | "1:2";
|
|
1063
1064
|
count?: 1 | 2 | 4 | 6;
|
|
1064
|
-
imageUrls?: string[];
|
|
1065
|
-
imageWeight?: number;
|
|
1066
1065
|
};
|
|
1067
1066
|
"recraftv4_styles_pro": {
|
|
1068
1067
|
prompt: string;
|
|
1068
|
+
styleReferenceUrls: [string, ...string[]];
|
|
1069
1069
|
aspectRatio?: "1:1" | "4:3" | "3:4" | "3:2" | "2:3" | "16:9" | "9:16" | "2:1" | "1:2";
|
|
1070
1070
|
count?: 1 | 2 | 4 | 6;
|
|
1071
|
-
imageUrls?: string[];
|
|
1072
|
-
imageWeight?: number;
|
|
1073
1071
|
};
|
|
1074
1072
|
"recraftv4_styles_pro_vector": {
|
|
1075
1073
|
prompt: string;
|
|
1074
|
+
styleReferenceUrls: [string, ...string[]];
|
|
1076
1075
|
aspectRatio?: "1:1" | "4:3" | "3:4" | "3:2" | "2:3" | "16:9" | "9:16" | "2:1" | "1:2";
|
|
1077
1076
|
count?: 1 | 2 | 4 | 6;
|
|
1078
|
-
imageUrls?: string[];
|
|
1079
|
-
imageWeight?: number;
|
|
1080
1077
|
};
|
|
1081
1078
|
"recraftv4_styles_vector": {
|
|
1082
1079
|
prompt: string;
|
|
1080
|
+
styleReferenceUrls: [string, ...string[]];
|
|
1083
1081
|
aspectRatio?: "1:1" | "4:3" | "3:4" | "3:2" | "2:3" | "16:9" | "9:16" | "2:1" | "1:2";
|
|
1084
1082
|
count?: 1 | 2 | 4 | 6;
|
|
1085
|
-
imageUrls?: string[];
|
|
1086
|
-
imageWeight?: number;
|
|
1087
1083
|
};
|
|
1088
1084
|
"recraftv4_vector": {
|
|
1089
1085
|
prompt: string;
|
|
@@ -2010,6 +2006,9 @@ interface GenerationContext {
|
|
|
2010
2006
|
language?: string;
|
|
2011
2007
|
accent?: string;
|
|
2012
2008
|
style?: string;
|
|
2009
|
+
/** Recraft V4 Styles — style-reference image URLs (max 5, t2i only).
|
|
2010
|
+
* Required: the V4 Styles API rejects requests without a style. */
|
|
2011
|
+
styleReferenceUrls?: string[];
|
|
2013
2012
|
quality?: string;
|
|
2014
2013
|
size?: string;
|
|
2015
2014
|
negativePrompt?: string;
|
package/index.js
CHANGED
|
@@ -6999,6 +6999,18 @@ var buildRecraftUtilityPayload = (includePrompt) => (ctx) => ({
|
|
|
6999
6999
|
image_url: ctx.imageUrls?.[0],
|
|
7000
7000
|
...includePrompt && ctx.prompt ? { prompt: ctx.prompt } : {}
|
|
7001
7001
|
});
|
|
7002
|
+
var buildRecraftV4StylesPayload = (apiModel) => (ctx) => {
|
|
7003
|
+
if (!ctx.styleReferenceUrls?.length) {
|
|
7004
|
+
throw new Error("V4 Styles models require styleReferenceUrls");
|
|
7005
|
+
}
|
|
7006
|
+
return {
|
|
7007
|
+
prompt: ctx.prompt,
|
|
7008
|
+
model: apiModel,
|
|
7009
|
+
n: ctx.count ?? 1,
|
|
7010
|
+
...ctx.aspectRatio ? { size: ctx.aspectRatio } : {},
|
|
7011
|
+
style_reference_urls: ctx.styleReferenceUrls
|
|
7012
|
+
};
|
|
7013
|
+
};
|
|
7002
7014
|
var buildRecraftV4VariantPayload = (apiModel) => (ctx) => ({
|
|
7003
7015
|
prompt: ctx.prompt,
|
|
7004
7016
|
model: apiModel,
|
|
@@ -7015,6 +7027,13 @@ var buildRecraftExploreSimilarPayload = (ctx) => ({
|
|
|
7015
7027
|
similarity: ctx.similarity ?? 3,
|
|
7016
7028
|
...ctx.aspectRatio ? { size: ctx.aspectRatio } : {}
|
|
7017
7029
|
});
|
|
7030
|
+
var v4StylesParams = p.file("styleReferenceUrls", "image", {
|
|
7031
|
+
label: "Style References",
|
|
7032
|
+
required: true,
|
|
7033
|
+
array: { min: 1, max: 5 },
|
|
7034
|
+
category: "reference",
|
|
7035
|
+
maxBytes: 10 * 1024 * 1024
|
|
7036
|
+
});
|
|
7018
7037
|
var { MODELS: MODELS29 } = defineModels("recraft", [
|
|
7019
7038
|
// ── V4.1 family (raster only — vector variants exist in API but not exposed here) ─
|
|
7020
7039
|
{
|
|
@@ -7314,18 +7333,17 @@ var { MODELS: MODELS29 } = defineModels("recraft", [
|
|
|
7314
7333
|
name: "Recraft V4 Styles",
|
|
7315
7334
|
addedAt: "2026-08-14",
|
|
7316
7335
|
workflow: "recraft/v1/images/generations",
|
|
7317
|
-
buildPayload:
|
|
7336
|
+
buildPayload: buildRecraftV4StylesPayload("recraftv4_styles"),
|
|
7318
7337
|
estimatedTime: 17,
|
|
7319
7338
|
mode: "image",
|
|
7320
7339
|
inputType: "t2i",
|
|
7321
7340
|
description: "Style-focused raster output with 10K-character prompts.",
|
|
7322
|
-
features: [feat("
|
|
7341
|
+
features: [feat("Style References", "style"), feat("Text in Image", "characteristic"), feat("10K Prompt", "characteristic")],
|
|
7323
7342
|
paramConfig: {
|
|
7324
7343
|
...params.prompt({ maxLength: 1e4 }),
|
|
7344
|
+
...v4StylesParams,
|
|
7325
7345
|
...params.aspectRatio(recraftAspectRatios, "1:1"),
|
|
7326
|
-
...params.count([1, 2, 4, 6])
|
|
7327
|
-
...params.imageInput(1, "Source Image"),
|
|
7328
|
-
...params.imageWeight(0, 100, 80, 5)
|
|
7346
|
+
...params.count([1, 2, 4, 6])
|
|
7329
7347
|
}
|
|
7330
7348
|
},
|
|
7331
7349
|
{
|
|
@@ -7333,18 +7351,17 @@ var { MODELS: MODELS29 } = defineModels("recraft", [
|
|
|
7333
7351
|
name: "Recraft V4 Styles Vector",
|
|
7334
7352
|
addedAt: "2026-08-14",
|
|
7335
7353
|
workflow: "recraft/v1/images/generations",
|
|
7336
|
-
buildPayload:
|
|
7354
|
+
buildPayload: buildRecraftV4StylesPayload("recraftv4_styles_vector"),
|
|
7337
7355
|
estimatedTime: 22,
|
|
7338
7356
|
mode: "image",
|
|
7339
7357
|
inputType: "t2i",
|
|
7340
7358
|
description: "Style-focused SVG vector output with 10K-character prompts.",
|
|
7341
|
-
features: [feat("
|
|
7359
|
+
features: [feat("Style References", "style"), feat("Vector/SVG", "characteristic"), feat("10K Prompt", "characteristic")],
|
|
7342
7360
|
paramConfig: {
|
|
7343
7361
|
...params.prompt({ maxLength: 1e4 }),
|
|
7362
|
+
...v4StylesParams,
|
|
7344
7363
|
...params.aspectRatio(recraftAspectRatios, "1:1"),
|
|
7345
|
-
...params.count([1, 2, 4, 6])
|
|
7346
|
-
...params.imageInput(1, "Source Image"),
|
|
7347
|
-
...params.imageWeight(0, 100, 80, 5)
|
|
7364
|
+
...params.count([1, 2, 4, 6])
|
|
7348
7365
|
}
|
|
7349
7366
|
},
|
|
7350
7367
|
{
|
|
@@ -7352,19 +7369,18 @@ var { MODELS: MODELS29 } = defineModels("recraft", [
|
|
|
7352
7369
|
name: "Recraft V4 Styles Pro",
|
|
7353
7370
|
addedAt: "2026-08-14",
|
|
7354
7371
|
workflow: "recraft/v1/images/generations",
|
|
7355
|
-
buildPayload:
|
|
7372
|
+
buildPayload: buildRecraftV4StylesPayload("recraftv4_styles_pro"),
|
|
7356
7373
|
estimatedTime: 35,
|
|
7357
7374
|
mode: "image",
|
|
7358
7375
|
inputType: "t2i",
|
|
7359
7376
|
badge: ["premium"],
|
|
7360
7377
|
description: "Pro-quality style-focused raster output with enhanced detail and 10K-character prompts.",
|
|
7361
|
-
features: [feat("
|
|
7378
|
+
features: [feat("Style References", "style"), feat("Text in Image", "characteristic"), feat("10K Prompt", "characteristic")],
|
|
7362
7379
|
paramConfig: {
|
|
7363
7380
|
...params.prompt({ maxLength: 1e4 }),
|
|
7381
|
+
...v4StylesParams,
|
|
7364
7382
|
...params.aspectRatio(recraftAspectRatios, "1:1"),
|
|
7365
|
-
...params.count([1, 2, 4, 6])
|
|
7366
|
-
...params.imageInput(1, "Source Image"),
|
|
7367
|
-
...params.imageWeight(0, 100, 80, 5)
|
|
7383
|
+
...params.count([1, 2, 4, 6])
|
|
7368
7384
|
}
|
|
7369
7385
|
},
|
|
7370
7386
|
{
|
|
@@ -7372,19 +7388,18 @@ var { MODELS: MODELS29 } = defineModels("recraft", [
|
|
|
7372
7388
|
name: "Recraft V4 Styles Pro Vector",
|
|
7373
7389
|
addedAt: "2026-08-14",
|
|
7374
7390
|
workflow: "recraft/v1/images/generations",
|
|
7375
|
-
buildPayload:
|
|
7391
|
+
buildPayload: buildRecraftV4StylesPayload("recraftv4_styles_pro_vector"),
|
|
7376
7392
|
estimatedTime: 35,
|
|
7377
7393
|
mode: "image",
|
|
7378
7394
|
inputType: "t2i",
|
|
7379
7395
|
badge: ["premium"],
|
|
7380
7396
|
description: "Pro-quality style-focused SVG vector output with enhanced detail and 10K-character prompts.",
|
|
7381
|
-
features: [feat("
|
|
7397
|
+
features: [feat("Style References", "style"), feat("Vector/SVG", "characteristic"), feat("10K Prompt", "characteristic")],
|
|
7382
7398
|
paramConfig: {
|
|
7383
7399
|
...params.prompt({ maxLength: 1e4 }),
|
|
7400
|
+
...v4StylesParams,
|
|
7384
7401
|
...params.aspectRatio(recraftAspectRatios, "1:1"),
|
|
7385
|
-
...params.count([1, 2, 4, 6])
|
|
7386
|
-
...params.imageInput(1, "Source Image"),
|
|
7387
|
-
...params.imageWeight(0, 100, 80, 5)
|
|
7402
|
+
...params.count([1, 2, 4, 6])
|
|
7388
7403
|
}
|
|
7389
7404
|
},
|
|
7390
7405
|
{
|