@picsart/ai-sdk 6.21.1 → 6.21.3
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 +4 -2
- package/index.js +21 -30
- 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?: "
|
|
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
|
@@ -8082,10 +8082,12 @@ var ideogram45MagicPromptParam = {
|
|
|
8082
8082
|
}
|
|
8083
8083
|
};
|
|
8084
8084
|
var IDEOGRAM_45_COUNTS = [1, 2, 3, 4, 5, 6, 7, 8];
|
|
8085
|
+
var IDEOGRAM_45_QUALITIES = ["very_low", "low", "medium", "high"];
|
|
8085
8086
|
var ideogram45Constraints = [
|
|
8086
8087
|
{ when: { imageUrls: { exists: false } }, then: {
|
|
8087
8088
|
size: { allowed: ["auto", ...IDEOGRAM_45_T2I_SIZES] },
|
|
8088
|
-
mask: { disabled: true, reason: "A mask needs a source image." }
|
|
8089
|
+
mask: { disabled: true, reason: "A mask needs a source image." },
|
|
8090
|
+
quality: { allowed: ["low", "medium", "high"], reason: "Very low quality needs a source image." }
|
|
8089
8091
|
} },
|
|
8090
8092
|
{ when: { imageUrls: { exists: true } }, then: {
|
|
8091
8093
|
size: { allowed: ["auto", "source"], reason: 'With input images the size is "auto" or the source image size.' }
|
|
@@ -8094,17 +8096,11 @@ var ideogram45Constraints = [
|
|
|
8094
8096
|
size: { disabled: true, reason: "A masked edit keeps the source image size." }
|
|
8095
8097
|
} }
|
|
8096
8098
|
];
|
|
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
8099
|
var { MODELS: MODELS26 } = defineModels("ideogram", [
|
|
8103
8100
|
{
|
|
8104
8101
|
id: "ideogram-4-5",
|
|
8105
8102
|
name: "Ideogram 4.5",
|
|
8106
8103
|
addedAt: "2026-09-28",
|
|
8107
|
-
release: "preview",
|
|
8108
8104
|
workflow: "ideogram/v4.5/generate",
|
|
8109
8105
|
estimatedTime: 30,
|
|
8110
8106
|
mode: "image",
|
|
@@ -8120,32 +8116,32 @@ var { MODELS: MODELS26 } = defineModels("ideogram", [
|
|
|
8120
8116
|
...ideogram45MaskParam,
|
|
8121
8117
|
...p.size(["auto", "source", ...IDEOGRAM_45_T2I_SIZES], "auto"),
|
|
8122
8118
|
...ideogram45MagicPromptParam,
|
|
8123
|
-
...p.quality(
|
|
8119
|
+
...p.quality(IDEOGRAM_45_QUALITIES, "high"),
|
|
8124
8120
|
...params.count(IDEOGRAM_45_COUNTS, 1),
|
|
8125
|
-
...params.seed()
|
|
8121
|
+
...params.seed(),
|
|
8122
|
+
...p.boolean("enableCopyrightDetection", false, "Copyright Detection")
|
|
8126
8123
|
}
|
|
8127
8124
|
},
|
|
8128
8125
|
{
|
|
8129
8126
|
id: "ideogram-4-5-precise-edit",
|
|
8130
8127
|
name: "Ideogram 4.5 Precise Edit",
|
|
8131
8128
|
addedAt: "2026-09-28",
|
|
8132
|
-
release: "preview",
|
|
8133
8129
|
workflow: "ideogram/v4.5/precise-edit",
|
|
8134
8130
|
estimatedTime: 40,
|
|
8135
8131
|
mode: "image",
|
|
8136
8132
|
inputType: "i2i",
|
|
8137
8133
|
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.",
|
|
8138
8134
|
features: [feat("Precise Edit", "input"), feat("Masked Edit", "input"), feat("Reference Images", "input")],
|
|
8139
|
-
constraints: ideogram45PreciseEditConstraints,
|
|
8140
8135
|
paramConfig: {
|
|
8141
8136
|
...params.prompt({ maxLength: 1e4 }),
|
|
8142
8137
|
...params.startFrame("Source Image", true, IDEOGRAM_45_IMAGE_BOUNDS),
|
|
8143
8138
|
...ideogram45MaskParam,
|
|
8144
8139
|
// With a mask the vendor allows at most 3 references.
|
|
8145
8140
|
...params.imageInput(4, "Reference Images", false, "reference", IDEOGRAM_45_IMAGE_BOUNDS),
|
|
8146
|
-
...p.quality(
|
|
8141
|
+
...p.quality(IDEOGRAM_45_QUALITIES, "medium"),
|
|
8147
8142
|
...params.count(IDEOGRAM_45_COUNTS, 1),
|
|
8148
|
-
...params.seed()
|
|
8143
|
+
...params.seed(),
|
|
8144
|
+
...p.boolean("enableCopyrightDetection", false, "Copyright Detection")
|
|
8149
8145
|
}
|
|
8150
8146
|
},
|
|
8151
8147
|
{
|
|
@@ -8347,14 +8343,11 @@ var { MODELS: MODELS26 } = defineModels("ideogram", [
|
|
|
8347
8343
|
// src/vendors/catalog/ideogram.payloads.ts
|
|
8348
8344
|
var GENERATE_MAX_IMAGES_WITH_MASK = 4;
|
|
8349
8345
|
var PRECISE_EDIT_MAX_REFERENCES_WITH_MASK = 3;
|
|
8350
|
-
var VERY_HIGH_MAX_COUNT = 4;
|
|
8351
8346
|
function assertMaskedImageLimit(model, count, max, what) {
|
|
8352
|
-
if (count > max) {
|
|
8353
|
-
|
|
8354
|
-
|
|
8355
|
-
|
|
8356
|
-
});
|
|
8357
|
-
}
|
|
8347
|
+
if (count > max) throw invalid2(`${model}: with a mask, use at most ${max} ${what} (got ${count}).`);
|
|
8348
|
+
}
|
|
8349
|
+
function invalid2(message) {
|
|
8350
|
+
return new ApiError(message, { status: 400, code: "validation_error" });
|
|
8358
8351
|
}
|
|
8359
8352
|
function ideogram45Size(size, hasImages, hasMask) {
|
|
8360
8353
|
if (!size || hasMask) return void 0;
|
|
@@ -8366,15 +8359,18 @@ var buildIdeogram45Payload = (input) => {
|
|
|
8366
8359
|
const mask = images && input.mask ? input.mask : void 0;
|
|
8367
8360
|
if (mask) assertMaskedImageLimit("Ideogram 4.5", images.length, GENERATE_MAX_IMAGES_WITH_MASK, "images");
|
|
8368
8361
|
const size = ideogram45Size(input.size, !!images, !!mask);
|
|
8362
|
+
if (input.quality === "very_low" && !images) throw invalid2("Ideogram 4.5: very_low quality needs a source image.");
|
|
8369
8363
|
return {
|
|
8370
8364
|
prompt: input.prompt,
|
|
8371
8365
|
...images ? { images } : {},
|
|
8372
8366
|
...mask ? { mask } : {},
|
|
8373
8367
|
...size ? { size } : {},
|
|
8374
8368
|
...input.magicPrompt ? { magic_prompt: input.magicPrompt } : {},
|
|
8375
|
-
|
|
8369
|
+
// Vendor default: medium with source images, high without.
|
|
8370
|
+
quality: input.quality ?? (images ? "medium" : "high"),
|
|
8376
8371
|
num_images: input.count ?? 1,
|
|
8377
|
-
...input.seed != null ? { seed: input.seed } : {}
|
|
8372
|
+
...input.seed != null ? { seed: input.seed } : {},
|
|
8373
|
+
...input.enableCopyrightDetection ? { enable_copyright_detection: true } : {}
|
|
8378
8374
|
};
|
|
8379
8375
|
};
|
|
8380
8376
|
var buildIdeogram45PreciseEditPayload = (input) => {
|
|
@@ -8386,20 +8382,15 @@ var buildIdeogram45PreciseEditPayload = (input) => {
|
|
|
8386
8382
|
"reference images"
|
|
8387
8383
|
);
|
|
8388
8384
|
}
|
|
8389
|
-
if (input.quality === "very_high" && (input.count ?? 1) > VERY_HIGH_MAX_COUNT) {
|
|
8390
|
-
throw new ApiError(
|
|
8391
|
-
`Ideogram 4.5 Precise Edit: very_high quality returns at most ${VERY_HIGH_MAX_COUNT} images (got ${input.count}).`,
|
|
8392
|
-
{ status: 400, code: "validation_error" }
|
|
8393
|
-
);
|
|
8394
|
-
}
|
|
8395
8385
|
return {
|
|
8396
8386
|
image: input.startFrame,
|
|
8397
8387
|
prompt: input.prompt,
|
|
8398
8388
|
...input.mask ? { mask: input.mask } : {},
|
|
8399
8389
|
...input.imageUrls?.length ? { reference_images: input.imageUrls } : {},
|
|
8400
|
-
quality: input.quality ?? "
|
|
8390
|
+
quality: input.quality ?? "medium",
|
|
8401
8391
|
num_images: input.count ?? 1,
|
|
8402
|
-
...input.seed != null ? { seed: input.seed } : {}
|
|
8392
|
+
...input.seed != null ? { seed: input.seed } : {},
|
|
8393
|
+
...input.enableCopyrightDetection ? { enable_copyright_detection: true } : {}
|
|
8403
8394
|
};
|
|
8404
8395
|
};
|
|
8405
8396
|
registerPayloads(MODELS26, {
|