@picsart/ai-sdk 5.1.0 → 5.3.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 +32 -0
  2. package/index.js +91 -1
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -1045,6 +1045,34 @@ type ModelInputById = {
1045
1045
  imageUrls?: string[];
1046
1046
  imageWeight?: number;
1047
1047
  };
1048
+ "recraftv4_styles": {
1049
+ prompt: string;
1050
+ aspectRatio?: "1:1" | "4:3" | "3:4" | "3:2" | "2:3" | "16:9" | "9:16" | "2:1" | "1:2";
1051
+ count?: 1 | 2 | 4 | 6;
1052
+ imageUrls?: string[];
1053
+ imageWeight?: number;
1054
+ };
1055
+ "recraftv4_styles_pro": {
1056
+ prompt: string;
1057
+ aspectRatio?: "1:1" | "4:3" | "3:4" | "3:2" | "2:3" | "16:9" | "9:16" | "2:1" | "1:2";
1058
+ count?: 1 | 2 | 4 | 6;
1059
+ imageUrls?: string[];
1060
+ imageWeight?: number;
1061
+ };
1062
+ "recraftv4_styles_pro_vector": {
1063
+ prompt: string;
1064
+ aspectRatio?: "1:1" | "4:3" | "3:4" | "3:2" | "2:3" | "16:9" | "9:16" | "2:1" | "1:2";
1065
+ count?: 1 | 2 | 4 | 6;
1066
+ imageUrls?: string[];
1067
+ imageWeight?: number;
1068
+ };
1069
+ "recraftv4_styles_vector": {
1070
+ prompt: string;
1071
+ aspectRatio?: "1:1" | "4:3" | "3:4" | "3:2" | "2:3" | "16:9" | "9:16" | "2:1" | "1:2";
1072
+ count?: 1 | 2 | 4 | 6;
1073
+ imageUrls?: string[];
1074
+ imageWeight?: number;
1075
+ };
1048
1076
  "recraftv4_vector": {
1049
1077
  prompt: string;
1050
1078
  aspectRatio?: "1:1" | "4:3" | "3:4" | "3:2" | "2:3" | "16:9" | "9:16" | "2:1" | "1:2";
@@ -2476,6 +2504,10 @@ declare const Models: {
2476
2504
  readonly Recraftv41Vector: "recraftv4_1_vector";
2477
2505
  readonly Recraftv4Pro: "recraftv4_pro";
2478
2506
  readonly Recraftv4ProVector: "recraftv4_pro_vector";
2507
+ readonly Recraftv4Styles: "recraftv4_styles";
2508
+ readonly Recraftv4StylesPro: "recraftv4_styles_pro";
2509
+ readonly Recraftv4StylesProVector: "recraftv4_styles_pro_vector";
2510
+ readonly Recraftv4StylesVector: "recraftv4_styles_vector";
2479
2511
  readonly Recraftv4Vector: "recraftv4_vector";
2480
2512
  readonly Reve: "reve";
2481
2513
  readonly RunwayAleph2: "runway-aleph2";
package/index.js CHANGED
@@ -7175,6 +7175,85 @@ var { MODELS: MODELS29 } = defineModels("recraft", [
7175
7175
  ...params.imageWeight(0, 100, 80, 5)
7176
7176
  }
7177
7177
  },
7178
+ // ── V4 Styles family — style-driven via style_id / style_reference_urls ─
7179
+ {
7180
+ id: "recraftv4_styles",
7181
+ name: "Recraft V4 Styles",
7182
+ addedAt: "2026-08-14",
7183
+ workflow: "recraft/v1/images/generations",
7184
+ buildPayload: buildRecraftV4VariantPayload("recraftv4_styles"),
7185
+ estimatedTime: 17,
7186
+ mode: "image",
7187
+ inputType: "t2i",
7188
+ description: "Style-focused raster output with 10K-character prompts.",
7189
+ features: [feat("Image Input", "input"), feat("Text in Image", "characteristic"), feat("10K Prompt", "characteristic")],
7190
+ paramConfig: {
7191
+ ...params.prompt({ maxLength: 1e4 }),
7192
+ ...params.aspectRatio(recraftAspectRatios, "1:1"),
7193
+ ...params.count([1, 2, 4, 6]),
7194
+ ...params.imageInput(1, "Source Image"),
7195
+ ...params.imageWeight(0, 100, 80, 5)
7196
+ }
7197
+ },
7198
+ {
7199
+ id: "recraftv4_styles_vector",
7200
+ name: "Recraft V4 Styles Vector",
7201
+ addedAt: "2026-08-14",
7202
+ workflow: "recraft/v1/images/generations",
7203
+ buildPayload: buildRecraftV4VariantPayload("recraftv4_styles_vector"),
7204
+ estimatedTime: 22,
7205
+ mode: "image",
7206
+ inputType: "t2i",
7207
+ description: "Style-focused SVG vector output with 10K-character prompts.",
7208
+ features: [feat("Image Input", "input"), feat("Vector/SVG", "characteristic"), feat("10K Prompt", "characteristic")],
7209
+ paramConfig: {
7210
+ ...params.prompt({ maxLength: 1e4 }),
7211
+ ...params.aspectRatio(recraftAspectRatios, "1:1"),
7212
+ ...params.count([1, 2, 4, 6]),
7213
+ ...params.imageInput(1, "Source Image"),
7214
+ ...params.imageWeight(0, 100, 80, 5)
7215
+ }
7216
+ },
7217
+ {
7218
+ id: "recraftv4_styles_pro",
7219
+ name: "Recraft V4 Styles Pro",
7220
+ addedAt: "2026-08-14",
7221
+ workflow: "recraft/v1/images/generations",
7222
+ buildPayload: buildRecraftV4VariantPayload("recraftv4_styles_pro"),
7223
+ estimatedTime: 35,
7224
+ mode: "image",
7225
+ inputType: "t2i",
7226
+ badge: ["premium"],
7227
+ description: "Pro-quality style-focused raster output with enhanced detail and 10K-character prompts.",
7228
+ features: [feat("Image Input", "input"), feat("Text in Image", "characteristic"), feat("10K Prompt", "characteristic")],
7229
+ paramConfig: {
7230
+ ...params.prompt({ maxLength: 1e4 }),
7231
+ ...params.aspectRatio(recraftAspectRatios, "1:1"),
7232
+ ...params.count([1, 2, 4, 6]),
7233
+ ...params.imageInput(1, "Source Image"),
7234
+ ...params.imageWeight(0, 100, 80, 5)
7235
+ }
7236
+ },
7237
+ {
7238
+ id: "recraftv4_styles_pro_vector",
7239
+ name: "Recraft V4 Styles Pro Vector",
7240
+ addedAt: "2026-08-14",
7241
+ workflow: "recraft/v1/images/generations",
7242
+ buildPayload: buildRecraftV4VariantPayload("recraftv4_styles_pro_vector"),
7243
+ estimatedTime: 35,
7244
+ mode: "image",
7245
+ inputType: "t2i",
7246
+ badge: ["premium"],
7247
+ description: "Pro-quality style-focused SVG vector output with enhanced detail and 10K-character prompts.",
7248
+ features: [feat("Image Input", "input"), feat("Vector/SVG", "characteristic"), feat("10K Prompt", "characteristic")],
7249
+ paramConfig: {
7250
+ ...params.prompt({ maxLength: 1e4 }),
7251
+ ...params.aspectRatio(recraftAspectRatios, "1:1"),
7252
+ ...params.count([1, 2, 4, 6]),
7253
+ ...params.imageInput(1, "Source Image"),
7254
+ ...params.imageWeight(0, 100, 80, 5)
7255
+ }
7256
+ },
7178
7257
  {
7179
7258
  id: "recraftv3_vector",
7180
7259
  name: "Recraft V3 Vector",
@@ -8724,6 +8803,9 @@ function parseTextResult(completed, model) {
8724
8803
  return { text, model: model.id, handle: completed.handle, raw: completed.raw ?? completed.result };
8725
8804
  }
8726
8805
 
8806
+ // src/core/limits.ts
8807
+ var MAX_DRIVE_PROMPT_LENGTH = 18e3;
8808
+
8727
8809
  // src/client/drive.ts
8728
8810
  var USER_REACTION_ATTR = "userReaction";
8729
8811
  function inferResourceType(mode) {
@@ -8787,7 +8869,7 @@ function parseJsonAttr(raw) {
8787
8869
  var asString = (v) => typeof v === "string" && v.trim() ? v : void 0;
8788
8870
  var asStringArray = (v) => Array.isArray(v) && v.length && v.every((x) => typeof x === "string") ? v : void 0;
8789
8871
  function toSdkPayload(params2) {
8790
- const p2 = { prompt: String(params2.prompt ?? "") };
8872
+ const p2 = { prompt: String(params2.prompt ?? "").slice(0, MAX_DRIVE_PROMPT_LENGTH) };
8791
8873
  for (const [key, value] of Object.entries(params2)) {
8792
8874
  if (key === "prompt") continue;
8793
8875
  if (value === void 0 || value === null || value === "") continue;
@@ -10535,6 +10617,10 @@ var Recraftv41UtilityVector = "recraftv4_1_utility_vector";
10535
10617
  var Recraftv41Vector = "recraftv4_1_vector";
10536
10618
  var Recraftv4Pro = "recraftv4_pro";
10537
10619
  var Recraftv4ProVector = "recraftv4_pro_vector";
10620
+ var Recraftv4Styles = "recraftv4_styles";
10621
+ var Recraftv4StylesPro = "recraftv4_styles_pro";
10622
+ var Recraftv4StylesProVector = "recraftv4_styles_pro_vector";
10623
+ var Recraftv4StylesVector = "recraftv4_styles_vector";
10538
10624
  var Recraftv4Vector = "recraftv4_vector";
10539
10625
  var Reve = "reve";
10540
10626
  var RunwayAleph2 = "runway-aleph2";
@@ -10733,6 +10819,10 @@ var Models = {
10733
10819
  Recraftv41Vector,
10734
10820
  Recraftv4Pro,
10735
10821
  Recraftv4ProVector,
10822
+ Recraftv4Styles,
10823
+ Recraftv4StylesPro,
10824
+ Recraftv4StylesProVector,
10825
+ Recraftv4StylesVector,
10736
10826
  Recraftv4Vector,
10737
10827
  Reve,
10738
10828
  RunwayAleph2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@picsart/ai-sdk",
3
- "version": "5.1.0",
3
+ "version": "5.3.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",