@picsart/ai-sdk 6.21.2 → 6.21.4

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 +4 -2
  2. package/index.js +21 -30
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -757,18 +757,20 @@ type ModelInputById = {
757
757
  mask?: string;
758
758
  size?: "auto" | "source" | "2048x2048" | "1440x2880" | "2880x1440" | "1664x2496" | "2496x1664" | "1792x2240" | "2240x1792" | "1440x2560" | "2560x1440" | "1600x2560" | "2560x1600" | "1728x2304" | "2304x1728" | "1296x3168" | "3168x1296" | "1152x2944" | "2944x1152" | "1248x3328" | "3328x1248" | "1280x3072" | "3072x1280" | "1024x3072" | "3072x1024" | "1024x1024" | "896x1120" | "1120x896" | "864x1152" | "1152x864" | "832x1248" | "1248x832" | "800x1280" | "1280x800" | "720x1280" | "1280x720" | "720x1440" | "1440x720" | "512x1536" | "1536x512";
759
759
  magicPrompt?: "auto" | "on" | "off";
760
- quality?: "low" | "medium" | "high";
760
+ quality?: "very_low" | "low" | "medium" | "high";
761
761
  count?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
762
762
  seed?: number;
763
+ enableCopyrightDetection?: boolean;
763
764
  };
764
765
  "ideogram-4-5-precise-edit": {
765
766
  prompt: string;
766
767
  startFrame: string;
767
768
  mask?: string;
768
769
  imageUrls?: string[];
769
- quality?: "low" | "medium" | "high" | "very_high";
770
+ quality?: "very_low" | "low" | "medium" | "high";
770
771
  count?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
771
772
  seed?: number;
773
+ enableCopyrightDetection?: boolean;
772
774
  };
773
775
  "ideogram-character": {
774
776
  prompt: string;
package/index.js CHANGED
@@ -6393,8 +6393,6 @@ var { MODELS: MODELS21 } = defineModels("flux", [
6393
6393
  workflow: "bfl/v1/flux-3-image",
6394
6394
  mode: "image",
6395
6395
  inputType: "t2i",
6396
- // Early-access at the vendor — stage only until it is cleared for prod.
6397
- release: "preview",
6398
6396
  addedAt: "2026-09-22",
6399
6397
  // Deliberately generous. Measured end-to-end against stage at 1k/16:9:
6400
6398
  // 44s for count 1, 68s for count 4 — of which only 3-6s is our pipeline,
@@ -8082,10 +8080,12 @@ var ideogram45MagicPromptParam = {
8082
8080
  }
8083
8081
  };
8084
8082
  var IDEOGRAM_45_COUNTS = [1, 2, 3, 4, 5, 6, 7, 8];
8083
+ var IDEOGRAM_45_QUALITIES = ["very_low", "low", "medium", "high"];
8085
8084
  var ideogram45Constraints = [
8086
8085
  { when: { imageUrls: { exists: false } }, then: {
8087
8086
  size: { allowed: ["auto", ...IDEOGRAM_45_T2I_SIZES] },
8088
- mask: { disabled: true, reason: "A mask needs a source image." }
8087
+ mask: { disabled: true, reason: "A mask needs a source image." },
8088
+ quality: { allowed: ["low", "medium", "high"], reason: "Very low quality needs a source image." }
8089
8089
  } },
8090
8090
  { when: { imageUrls: { exists: true } }, then: {
8091
8091
  size: { allowed: ["auto", "source"], reason: 'With input images the size is "auto" or the source image size.' }
@@ -8094,11 +8094,6 @@ var ideogram45Constraints = [
8094
8094
  size: { disabled: true, reason: "A masked edit keeps the source image size." }
8095
8095
  } }
8096
8096
  ];
8097
- var ideogram45PreciseEditConstraints = [
8098
- { when: { quality: { is: "very_high" } }, then: {
8099
- count: { allowed: [1, 2, 3, 4], reason: "Very high quality returns at most 4 images." }
8100
- } }
8101
- ];
8102
8097
  var { MODELS: MODELS26 } = defineModels("ideogram", [
8103
8098
  {
8104
8099
  id: "ideogram-4-5",
@@ -8119,9 +8114,10 @@ var { MODELS: MODELS26 } = defineModels("ideogram", [
8119
8114
  ...ideogram45MaskParam,
8120
8115
  ...p.size(["auto", "source", ...IDEOGRAM_45_T2I_SIZES], "auto"),
8121
8116
  ...ideogram45MagicPromptParam,
8122
- ...p.quality(["low", "medium", "high"], "high"),
8117
+ ...p.quality(IDEOGRAM_45_QUALITIES, "high"),
8123
8118
  ...params.count(IDEOGRAM_45_COUNTS, 1),
8124
- ...params.seed()
8119
+ ...params.seed(),
8120
+ ...p.boolean("enableCopyrightDetection", false, "Copyright Detection")
8125
8121
  }
8126
8122
  },
8127
8123
  {
@@ -8134,16 +8130,16 @@ var { MODELS: MODELS26 } = defineModels("ideogram", [
8134
8130
  inputType: "i2i",
8135
8131
  description: "Ideogram 4.5 precise edit \u2014 change one area and keep the rest of the image pixel-intact, optionally with a mask and reference images.",
8136
8132
  features: [feat("Precise Edit", "input"), feat("Masked Edit", "input"), feat("Reference Images", "input")],
8137
- constraints: ideogram45PreciseEditConstraints,
8138
8133
  paramConfig: {
8139
8134
  ...params.prompt({ maxLength: 1e4 }),
8140
8135
  ...params.startFrame("Source Image", true, IDEOGRAM_45_IMAGE_BOUNDS),
8141
8136
  ...ideogram45MaskParam,
8142
8137
  // With a mask the vendor allows at most 3 references.
8143
8138
  ...params.imageInput(4, "Reference Images", false, "reference", IDEOGRAM_45_IMAGE_BOUNDS),
8144
- ...p.quality(["low", "medium", "high", "very_high"], "high"),
8139
+ ...p.quality(IDEOGRAM_45_QUALITIES, "medium"),
8145
8140
  ...params.count(IDEOGRAM_45_COUNTS, 1),
8146
- ...params.seed()
8141
+ ...params.seed(),
8142
+ ...p.boolean("enableCopyrightDetection", false, "Copyright Detection")
8147
8143
  }
8148
8144
  },
8149
8145
  {
@@ -8345,14 +8341,11 @@ var { MODELS: MODELS26 } = defineModels("ideogram", [
8345
8341
  // src/vendors/catalog/ideogram.payloads.ts
8346
8342
  var GENERATE_MAX_IMAGES_WITH_MASK = 4;
8347
8343
  var PRECISE_EDIT_MAX_REFERENCES_WITH_MASK = 3;
8348
- var VERY_HIGH_MAX_COUNT = 4;
8349
8344
  function assertMaskedImageLimit(model, count, max, what) {
8350
- if (count > max) {
8351
- throw new ApiError(`${model}: with a mask, use at most ${max} ${what} (got ${count}).`, {
8352
- status: 400,
8353
- code: "validation_error"
8354
- });
8355
- }
8345
+ if (count > max) throw invalid2(`${model}: with a mask, use at most ${max} ${what} (got ${count}).`);
8346
+ }
8347
+ function invalid2(message) {
8348
+ return new ApiError(message, { status: 400, code: "validation_error" });
8356
8349
  }
8357
8350
  function ideogram45Size(size, hasImages, hasMask) {
8358
8351
  if (!size || hasMask) return void 0;
@@ -8364,15 +8357,18 @@ var buildIdeogram45Payload = (input) => {
8364
8357
  const mask = images && input.mask ? input.mask : void 0;
8365
8358
  if (mask) assertMaskedImageLimit("Ideogram 4.5", images.length, GENERATE_MAX_IMAGES_WITH_MASK, "images");
8366
8359
  const size = ideogram45Size(input.size, !!images, !!mask);
8360
+ if (input.quality === "very_low" && !images) throw invalid2("Ideogram 4.5: very_low quality needs a source image.");
8367
8361
  return {
8368
8362
  prompt: input.prompt,
8369
8363
  ...images ? { images } : {},
8370
8364
  ...mask ? { mask } : {},
8371
8365
  ...size ? { size } : {},
8372
8366
  ...input.magicPrompt ? { magic_prompt: input.magicPrompt } : {},
8373
- quality: input.quality ?? "high",
8367
+ // Vendor default: medium with source images, high without.
8368
+ quality: input.quality ?? (images ? "medium" : "high"),
8374
8369
  num_images: input.count ?? 1,
8375
- ...input.seed != null ? { seed: input.seed } : {}
8370
+ ...input.seed != null ? { seed: input.seed } : {},
8371
+ ...input.enableCopyrightDetection ? { enable_copyright_detection: true } : {}
8376
8372
  };
8377
8373
  };
8378
8374
  var buildIdeogram45PreciseEditPayload = (input) => {
@@ -8384,20 +8380,15 @@ var buildIdeogram45PreciseEditPayload = (input) => {
8384
8380
  "reference images"
8385
8381
  );
8386
8382
  }
8387
- if (input.quality === "very_high" && (input.count ?? 1) > VERY_HIGH_MAX_COUNT) {
8388
- throw new ApiError(
8389
- `Ideogram 4.5 Precise Edit: very_high quality returns at most ${VERY_HIGH_MAX_COUNT} images (got ${input.count}).`,
8390
- { status: 400, code: "validation_error" }
8391
- );
8392
- }
8393
8383
  return {
8394
8384
  image: input.startFrame,
8395
8385
  prompt: input.prompt,
8396
8386
  ...input.mask ? { mask: input.mask } : {},
8397
8387
  ...input.imageUrls?.length ? { reference_images: input.imageUrls } : {},
8398
- quality: input.quality ?? "high",
8388
+ quality: input.quality ?? "medium",
8399
8389
  num_images: input.count ?? 1,
8400
- ...input.seed != null ? { seed: input.seed } : {}
8390
+ ...input.seed != null ? { seed: input.seed } : {},
8391
+ ...input.enableCopyrightDetection ? { enable_copyright_detection: true } : {}
8401
8392
  };
8402
8393
  };
8403
8394
  registerPayloads(MODELS26, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@picsart/ai-sdk",
3
- "version": "6.21.2",
3
+ "version": "6.21.4",
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",