@picsart/ai-sdk 6.16.0 → 6.17.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/index.d.ts +21 -0
- package/index.js +198 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -725,6 +725,25 @@ type ModelInputById = {
|
|
|
725
725
|
negativePrompt?: string;
|
|
726
726
|
cfgScale?: number;
|
|
727
727
|
};
|
|
728
|
+
"ideogram-4-5": {
|
|
729
|
+
prompt: string;
|
|
730
|
+
imageUrls?: string[];
|
|
731
|
+
mask?: string;
|
|
732
|
+
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";
|
|
733
|
+
magicPrompt?: "auto" | "on" | "off";
|
|
734
|
+
quality?: "low" | "medium" | "high";
|
|
735
|
+
count?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
|
|
736
|
+
seed?: number;
|
|
737
|
+
};
|
|
738
|
+
"ideogram-4-5-precise-edit": {
|
|
739
|
+
prompt: string;
|
|
740
|
+
startFrame: string;
|
|
741
|
+
mask?: string;
|
|
742
|
+
imageUrls?: string[];
|
|
743
|
+
quality?: "low" | "medium" | "high" | "very_high";
|
|
744
|
+
count?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
|
|
745
|
+
seed?: number;
|
|
746
|
+
};
|
|
728
747
|
"ideogram-character": {
|
|
729
748
|
prompt: string;
|
|
730
749
|
resolution?: "1024x1024" | "1344x768" | "768x1344" | "1152x864" | "864x1152" | "832x1248" | "1280x800";
|
|
@@ -3285,6 +3304,8 @@ declare const Models: {
|
|
|
3285
3304
|
readonly HeygenTalkingPhoto: "heygen-talking-photo";
|
|
3286
3305
|
readonly HeygenVideoAvatar: "heygen-video-avatar";
|
|
3287
3306
|
readonly HunyuanV3: "hunyuan-v3";
|
|
3307
|
+
readonly Ideogram45: "ideogram-4-5";
|
|
3308
|
+
readonly Ideogram45PreciseEdit: "ideogram-4-5-precise-edit";
|
|
3288
3309
|
readonly IdeogramCharacter: "ideogram-character";
|
|
3289
3310
|
readonly IdeogramPImage: "ideogram-p-image";
|
|
3290
3311
|
readonly IdeogramV3: "ideogram-v3";
|
package/index.js
CHANGED
|
@@ -7802,7 +7802,138 @@ var buildIdeogramPImagePayload = (ctx) => ({
|
|
|
7802
7802
|
resolution: ctx.resolution ?? "1024x1024",
|
|
7803
7803
|
rendering_speed: ctx.renderingSpeed ?? "medium"
|
|
7804
7804
|
});
|
|
7805
|
+
var IDEOGRAM_45_IMAGE_BOUNDS = {
|
|
7806
|
+
maxBytes: 25 * 1024 * 1024,
|
|
7807
|
+
minAspectRatio: 1 / 6,
|
|
7808
|
+
maxAspectRatio: 6
|
|
7809
|
+
};
|
|
7810
|
+
var IDEOGRAM_45_T2I_SIZES = [
|
|
7811
|
+
"2048x2048",
|
|
7812
|
+
"1440x2880",
|
|
7813
|
+
"2880x1440",
|
|
7814
|
+
"1664x2496",
|
|
7815
|
+
"2496x1664",
|
|
7816
|
+
"1792x2240",
|
|
7817
|
+
"2240x1792",
|
|
7818
|
+
"1440x2560",
|
|
7819
|
+
"2560x1440",
|
|
7820
|
+
"1600x2560",
|
|
7821
|
+
"2560x1600",
|
|
7822
|
+
"1728x2304",
|
|
7823
|
+
"2304x1728",
|
|
7824
|
+
"1296x3168",
|
|
7825
|
+
"3168x1296",
|
|
7826
|
+
"1152x2944",
|
|
7827
|
+
"2944x1152",
|
|
7828
|
+
"1248x3328",
|
|
7829
|
+
"3328x1248",
|
|
7830
|
+
"1280x3072",
|
|
7831
|
+
"3072x1280",
|
|
7832
|
+
"1024x3072",
|
|
7833
|
+
"3072x1024",
|
|
7834
|
+
"1024x1024",
|
|
7835
|
+
"896x1120",
|
|
7836
|
+
"1120x896",
|
|
7837
|
+
"864x1152",
|
|
7838
|
+
"1152x864",
|
|
7839
|
+
"832x1248",
|
|
7840
|
+
"1248x832",
|
|
7841
|
+
"800x1280",
|
|
7842
|
+
"1280x800",
|
|
7843
|
+
"720x1280",
|
|
7844
|
+
"1280x720",
|
|
7845
|
+
"720x1440",
|
|
7846
|
+
"1440x720",
|
|
7847
|
+
"512x1536",
|
|
7848
|
+
"1536x512"
|
|
7849
|
+
];
|
|
7850
|
+
var ideogram45MaskParam = p.file("mask", "image", {
|
|
7851
|
+
label: "Mask",
|
|
7852
|
+
category: "asset",
|
|
7853
|
+
...IDEOGRAM_45_IMAGE_BOUNDS
|
|
7854
|
+
});
|
|
7855
|
+
var ideogram45MagicPromptParam = {
|
|
7856
|
+
magicPrompt: {
|
|
7857
|
+
label: "Magic Prompt",
|
|
7858
|
+
descriptor: {
|
|
7859
|
+
kind: "enum",
|
|
7860
|
+
valueType: "string",
|
|
7861
|
+
options: [
|
|
7862
|
+
{ id: "auto", label: "Auto" },
|
|
7863
|
+
{ id: "on", label: "On" },
|
|
7864
|
+
{ id: "off", label: "Off (verbatim)" }
|
|
7865
|
+
],
|
|
7866
|
+
default: "auto"
|
|
7867
|
+
}
|
|
7868
|
+
}
|
|
7869
|
+
};
|
|
7870
|
+
var IDEOGRAM_45_COUNTS = [1, 2, 3, 4, 5, 6, 7, 8];
|
|
7871
|
+
var ideogram45Constraints = [
|
|
7872
|
+
{ when: { imageUrls: { exists: false } }, then: {
|
|
7873
|
+
size: { allowed: ["auto", ...IDEOGRAM_45_T2I_SIZES] },
|
|
7874
|
+
mask: { disabled: true, reason: "A mask needs a source image." }
|
|
7875
|
+
} },
|
|
7876
|
+
{ when: { imageUrls: { exists: true } }, then: {
|
|
7877
|
+
size: { allowed: ["auto", "source"], reason: 'With input images the size is "auto" or the source image size.' }
|
|
7878
|
+
} },
|
|
7879
|
+
{ when: { mask: { exists: true } }, then: {
|
|
7880
|
+
size: { disabled: true, reason: "A masked edit keeps the source image size." }
|
|
7881
|
+
} }
|
|
7882
|
+
];
|
|
7883
|
+
var ideogram45PreciseEditConstraints = [
|
|
7884
|
+
{ when: { quality: { is: "very_high" } }, then: {
|
|
7885
|
+
count: { allowed: [1, 2, 3, 4], reason: "Very high quality returns at most 4 images." }
|
|
7886
|
+
} }
|
|
7887
|
+
];
|
|
7805
7888
|
var { MODELS: MODELS26 } = defineModels("ideogram", [
|
|
7889
|
+
{
|
|
7890
|
+
id: "ideogram-4-5",
|
|
7891
|
+
name: "Ideogram 4.5",
|
|
7892
|
+
addedAt: "2026-09-28",
|
|
7893
|
+
release: "preview",
|
|
7894
|
+
workflow: "ideogram/v4.5/generate",
|
|
7895
|
+
estimatedTime: 30,
|
|
7896
|
+
mode: "image",
|
|
7897
|
+
inputType: "t2i",
|
|
7898
|
+
description: "Ideogram 4.5 \u2014 text-to-image and drift-free iterative editing with up to 4 reference images and an optional mask.",
|
|
7899
|
+
features: [feat("Reference Images", "input"), feat("Masked Edit", "input"), feat("2K", "resolution")],
|
|
7900
|
+
constraints: ideogram45Constraints,
|
|
7901
|
+
paramConfig: {
|
|
7902
|
+
...params.prompt({ maxLength: 1e4 }),
|
|
7903
|
+
// imageUrls[0] is the source image to edit; the rest are references ("image 2", "image 3"…).
|
|
7904
|
+
// With a mask the vendor allows at most 4 images.
|
|
7905
|
+
...params.imageInput(5, "Images", false, "reference", IDEOGRAM_45_IMAGE_BOUNDS),
|
|
7906
|
+
...ideogram45MaskParam,
|
|
7907
|
+
...p.size(["auto", "source", ...IDEOGRAM_45_T2I_SIZES], "auto"),
|
|
7908
|
+
...ideogram45MagicPromptParam,
|
|
7909
|
+
...p.quality(["low", "medium", "high"], "high"),
|
|
7910
|
+
...params.count(IDEOGRAM_45_COUNTS, 1),
|
|
7911
|
+
...params.seed()
|
|
7912
|
+
}
|
|
7913
|
+
},
|
|
7914
|
+
{
|
|
7915
|
+
id: "ideogram-4-5-precise-edit",
|
|
7916
|
+
name: "Ideogram 4.5 Precise Edit",
|
|
7917
|
+
addedAt: "2026-09-28",
|
|
7918
|
+
release: "preview",
|
|
7919
|
+
workflow: "ideogram/v4.5/precise-edit",
|
|
7920
|
+
estimatedTime: 40,
|
|
7921
|
+
mode: "image",
|
|
7922
|
+
inputType: "i2i",
|
|
7923
|
+
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.",
|
|
7924
|
+
features: [feat("Precise Edit", "input"), feat("Masked Edit", "input"), feat("Reference Images", "input")],
|
|
7925
|
+
constraints: ideogram45PreciseEditConstraints,
|
|
7926
|
+
paramConfig: {
|
|
7927
|
+
...params.prompt({ maxLength: 1e4 }),
|
|
7928
|
+
...params.startFrame("Source Image", true, IDEOGRAM_45_IMAGE_BOUNDS),
|
|
7929
|
+
...ideogram45MaskParam,
|
|
7930
|
+
// With a mask the vendor allows at most 3 references.
|
|
7931
|
+
...params.imageInput(4, "Reference Images", false, "reference", IDEOGRAM_45_IMAGE_BOUNDS),
|
|
7932
|
+
...p.quality(["low", "medium", "high", "very_high"], "high"),
|
|
7933
|
+
...params.count(IDEOGRAM_45_COUNTS, 1),
|
|
7934
|
+
...params.seed()
|
|
7935
|
+
}
|
|
7936
|
+
},
|
|
7806
7937
|
{
|
|
7807
7938
|
id: "ideogram-v4",
|
|
7808
7939
|
name: "Ideogram 4.0",
|
|
@@ -7999,6 +8130,69 @@ var { MODELS: MODELS26 } = defineModels("ideogram", [
|
|
|
7999
8130
|
}
|
|
8000
8131
|
]);
|
|
8001
8132
|
|
|
8133
|
+
// src/vendors/catalog/ideogram.payloads.ts
|
|
8134
|
+
var GENERATE_MAX_IMAGES_WITH_MASK = 4;
|
|
8135
|
+
var PRECISE_EDIT_MAX_REFERENCES_WITH_MASK = 3;
|
|
8136
|
+
var VERY_HIGH_MAX_COUNT = 4;
|
|
8137
|
+
function assertMaskedImageLimit(model, count, max, what) {
|
|
8138
|
+
if (count > max) {
|
|
8139
|
+
throw new ApiError(`${model}: with a mask, use at most ${max} ${what} (got ${count}).`, {
|
|
8140
|
+
status: 400,
|
|
8141
|
+
code: "validation_error"
|
|
8142
|
+
});
|
|
8143
|
+
}
|
|
8144
|
+
}
|
|
8145
|
+
function ideogram45Size(size, hasImages, hasMask) {
|
|
8146
|
+
if (!size || hasMask) return void 0;
|
|
8147
|
+
if (hasImages) return size === "auto" || size === "source" ? size : void 0;
|
|
8148
|
+
return size === "source" ? void 0 : size;
|
|
8149
|
+
}
|
|
8150
|
+
var buildIdeogram45Payload = (input) => {
|
|
8151
|
+
const images = input.imageUrls?.length ? input.imageUrls : void 0;
|
|
8152
|
+
const mask = images && input.mask ? input.mask : void 0;
|
|
8153
|
+
if (mask) assertMaskedImageLimit("Ideogram 4.5", images.length, GENERATE_MAX_IMAGES_WITH_MASK, "images");
|
|
8154
|
+
const size = ideogram45Size(input.size, !!images, !!mask);
|
|
8155
|
+
return {
|
|
8156
|
+
prompt: input.prompt,
|
|
8157
|
+
...images ? { images } : {},
|
|
8158
|
+
...mask ? { mask } : {},
|
|
8159
|
+
...size ? { size } : {},
|
|
8160
|
+
...input.magicPrompt ? { magic_prompt: input.magicPrompt } : {},
|
|
8161
|
+
quality: input.quality ?? "high",
|
|
8162
|
+
num_images: input.count ?? 1,
|
|
8163
|
+
...input.seed != null ? { seed: input.seed } : {}
|
|
8164
|
+
};
|
|
8165
|
+
};
|
|
8166
|
+
var buildIdeogram45PreciseEditPayload = (input) => {
|
|
8167
|
+
if (input.mask) {
|
|
8168
|
+
assertMaskedImageLimit(
|
|
8169
|
+
"Ideogram 4.5 Precise Edit",
|
|
8170
|
+
input.imageUrls?.length ?? 0,
|
|
8171
|
+
PRECISE_EDIT_MAX_REFERENCES_WITH_MASK,
|
|
8172
|
+
"reference images"
|
|
8173
|
+
);
|
|
8174
|
+
}
|
|
8175
|
+
if (input.quality === "very_high" && (input.count ?? 1) > VERY_HIGH_MAX_COUNT) {
|
|
8176
|
+
throw new ApiError(
|
|
8177
|
+
`Ideogram 4.5 Precise Edit: very_high quality returns at most ${VERY_HIGH_MAX_COUNT} images (got ${input.count}).`,
|
|
8178
|
+
{ status: 400, code: "validation_error" }
|
|
8179
|
+
);
|
|
8180
|
+
}
|
|
8181
|
+
return {
|
|
8182
|
+
image: input.startFrame,
|
|
8183
|
+
prompt: input.prompt,
|
|
8184
|
+
...input.mask ? { mask: input.mask } : {},
|
|
8185
|
+
...input.imageUrls?.length ? { reference_images: input.imageUrls } : {},
|
|
8186
|
+
quality: input.quality ?? "high",
|
|
8187
|
+
num_images: input.count ?? 1,
|
|
8188
|
+
...input.seed != null ? { seed: input.seed } : {}
|
|
8189
|
+
};
|
|
8190
|
+
};
|
|
8191
|
+
registerPayloads(MODELS26, {
|
|
8192
|
+
"ideogram-4-5": buildIdeogram45Payload,
|
|
8193
|
+
"ideogram-4-5-precise-edit": buildIdeogram45PreciseEditPayload
|
|
8194
|
+
});
|
|
8195
|
+
|
|
8002
8196
|
// src/vendors/catalog/qwen.ts
|
|
8003
8197
|
var QWEN_V1_SIZES = [
|
|
8004
8198
|
"2048x2048",
|
|
@@ -13113,6 +13307,8 @@ var Happyhorse11T2v = "happyhorse-1.1-t2v";
|
|
|
13113
13307
|
var HeygenTalkingPhoto = "heygen-talking-photo";
|
|
13114
13308
|
var HeygenVideoAvatar = "heygen-video-avatar";
|
|
13115
13309
|
var HunyuanV3 = "hunyuan-v3";
|
|
13310
|
+
var Ideogram45 = "ideogram-4-5";
|
|
13311
|
+
var Ideogram45PreciseEdit = "ideogram-4-5-precise-edit";
|
|
13116
13312
|
var IdeogramCharacter = "ideogram-character";
|
|
13117
13313
|
var IdeogramPImage = "ideogram-p-image";
|
|
13118
13314
|
var IdeogramV3 = "ideogram-v3";
|
|
@@ -13366,6 +13562,8 @@ var Models = {
|
|
|
13366
13562
|
HeygenTalkingPhoto,
|
|
13367
13563
|
HeygenVideoAvatar,
|
|
13368
13564
|
HunyuanV3,
|
|
13565
|
+
Ideogram45,
|
|
13566
|
+
Ideogram45PreciseEdit,
|
|
13369
13567
|
IdeogramCharacter,
|
|
13370
13568
|
IdeogramPImage,
|
|
13371
13569
|
IdeogramV3,
|