@shop-os/modelkit 0.18.2 → 0.19.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/CHANGELOG.md +53 -0
- package/dist/catalog.cjs +279 -18
- package/dist/catalog.cjs.map +1 -1
- package/dist/catalog.d.cts +109 -2
- package/dist/catalog.d.ts +109 -2
- package/dist/catalog.js +279 -18
- package/dist/catalog.js.map +1 -1
- package/dist/index.cjs +324 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +109 -2
- package/dist/index.d.ts +109 -2
- package/dist/index.js +321 -36
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -158,6 +158,7 @@ function isListed(row2) {
|
|
|
158
158
|
var IMAGE_USAGE = { unit: "images" };
|
|
159
159
|
var EXPOSURE = ["cowork", "space_builder"];
|
|
160
160
|
var LOBE = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light";
|
|
161
|
+
var MINIMAX_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
|
|
161
162
|
var SIZED_RATIOS = [
|
|
162
163
|
"1:1",
|
|
163
164
|
"16:9",
|
|
@@ -183,6 +184,36 @@ var RECRAFT_RATIOS = [
|
|
|
183
184
|
"5:4",
|
|
184
185
|
"4:5"
|
|
185
186
|
];
|
|
187
|
+
function minimaxH3ImageRow(row2) {
|
|
188
|
+
return {
|
|
189
|
+
id: row2.id,
|
|
190
|
+
aliases: [],
|
|
191
|
+
label: row2.label,
|
|
192
|
+
type: "image",
|
|
193
|
+
adapter: "fal",
|
|
194
|
+
providerModelId: row2.providerModelId,
|
|
195
|
+
lifecycle: "active",
|
|
196
|
+
exposure: EXPOSURE,
|
|
197
|
+
constraints: {
|
|
198
|
+
aspectRatios: [...SIZED_RATIOS],
|
|
199
|
+
sizes: ["1K", "2K", "4K"],
|
|
200
|
+
references: {
|
|
201
|
+
images: 16,
|
|
202
|
+
imagePixels: { minWidth: 128, minHeight: 128, maxSide: 8192 }
|
|
203
|
+
},
|
|
204
|
+
supports: ["count", "outputFormat"],
|
|
205
|
+
prompt: { referenceSyntax: "numbered", maxChars: 32e3 }
|
|
206
|
+
},
|
|
207
|
+
defaults: { size: "2K", aspectRatio: "1:1", count: 1 },
|
|
208
|
+
usage: { ...IMAGE_USAGE },
|
|
209
|
+
pricingKind: "image_size",
|
|
210
|
+
display: {
|
|
211
|
+
provider: "minimax",
|
|
212
|
+
description: row2.description,
|
|
213
|
+
logo: MINIMAX_LOGO
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
}
|
|
186
217
|
var FAL_IMAGE_MODELS = [
|
|
187
218
|
{
|
|
188
219
|
// krea/v3/text-to-image; references switch to krea/v3/edit (1-8 images). Billed per
|
|
@@ -266,6 +297,22 @@ var FAL_IMAGE_MODELS = [
|
|
|
266
297
|
logo: `${LOBE}/qwen-color.png`
|
|
267
298
|
}
|
|
268
299
|
},
|
|
300
|
+
minimaxH3ImageRow({
|
|
301
|
+
// minimax/h3-image/text-to-image; references switch to minimax/h3-image/edit. Billed on
|
|
302
|
+
// tokens: $2.30/M input text, $1.50/M input image, $3.80/M output image.
|
|
303
|
+
id: "minimax-h3-image",
|
|
304
|
+
label: "MiniMax H3 Image",
|
|
305
|
+
providerModelId: "minimax/h3-image/text-to-image",
|
|
306
|
+
description: "MiniMax H3 Image text-to-image and multi-image editing with precise instruction following; takes a prompt and up to 16 reference images and outputs 1K, 2K or 4K."
|
|
307
|
+
}),
|
|
308
|
+
minimaxH3ImageRow({
|
|
309
|
+
// minimax/h3-image/highspeed/text-to-image; references switch to .../highspeed/edit.
|
|
310
|
+
// Billed on tokens: $2.30/M input text, $3.00/M input image, $7.60/M output image.
|
|
311
|
+
id: "minimax-h3-image-highspeed",
|
|
312
|
+
label: "MiniMax H3 Image Highspeed",
|
|
313
|
+
providerModelId: "minimax/h3-image/highspeed/text-to-image",
|
|
314
|
+
description: "MiniMax H3 Image Highspeed, the faster tier of H3 Image for text-to-image and multi-image editing; takes a prompt and up to 16 reference images and outputs 1K, 2K or 4K."
|
|
315
|
+
}),
|
|
269
316
|
{
|
|
270
317
|
// fal-ai/kling-image/o3/text-to-image; references switch to .../o3/image-to-image (up to
|
|
271
318
|
// 10, "@Image1".."@Image10"). $0.028 per image at 1K and 2K, double at 4K.
|
|
@@ -842,6 +889,46 @@ var IMAGE_MODELS = [
|
|
|
842
889
|
description: "ByteDance Seedream 5.0 Pro text-to-image and multi-reference image-to-image (up to 10 inputs) with region editing; outputs 1K or 2K."
|
|
843
890
|
}
|
|
844
891
|
},
|
|
892
|
+
// Seedream 5.5 (Early Access, 2026-11-11): 1K / 1.5K / 2K, no 4K; exact sizes must total
|
|
893
|
+
// 921,600 to 4,624,220 px, which every SEEDREAM_SIZES 1K and 2K entry does. Up to 10
|
|
894
|
+
// references; `background: "transparent"` returns an RGBA PNG.
|
|
895
|
+
{
|
|
896
|
+
id: "seedream-5.5",
|
|
897
|
+
aliases: [],
|
|
898
|
+
label: "Seedream 5.5",
|
|
899
|
+
type: "image",
|
|
900
|
+
adapter: "ark",
|
|
901
|
+
providerModelId: "dola-seedream-5-5-261028",
|
|
902
|
+
lifecycle: "active",
|
|
903
|
+
exposure: ["cowork", "space_builder"],
|
|
904
|
+
constraints: {
|
|
905
|
+
aspectRatios: [
|
|
906
|
+
"1:1",
|
|
907
|
+
"4:3",
|
|
908
|
+
"3:4",
|
|
909
|
+
"16:9",
|
|
910
|
+
"9:16",
|
|
911
|
+
"3:2",
|
|
912
|
+
"2:3",
|
|
913
|
+
"21:9",
|
|
914
|
+
"9:21",
|
|
915
|
+
"4:5",
|
|
916
|
+
"5:4"
|
|
917
|
+
],
|
|
918
|
+
sizes: ["1K", "2K"],
|
|
919
|
+
references: { images: 10 },
|
|
920
|
+
supports: ["seed", "outputFormat"],
|
|
921
|
+
backgrounds: ["auto", "opaque", "transparent"]
|
|
922
|
+
},
|
|
923
|
+
defaults: { size: "1K", aspectRatio: "1:1" },
|
|
924
|
+
usage: { ...IMAGE_USAGE3 },
|
|
925
|
+
pricingKind: "image_size",
|
|
926
|
+
display: {
|
|
927
|
+
provider: "bytedance",
|
|
928
|
+
logo: "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/3bba5d81-4e57-4e71-911b-cdfa05acca2c_compressed.png",
|
|
929
|
+
description: "ByteDance Seedream 5.5 text-to-image and multi-reference editing (up to 10 inputs): edits that keep what you did not ask to change, transparent PNG output and sharper text; outputs 1K or 2K."
|
|
930
|
+
}
|
|
931
|
+
},
|
|
845
932
|
{
|
|
846
933
|
id: "seedream-4.5",
|
|
847
934
|
aliases: [],
|
|
@@ -3764,7 +3851,7 @@ var MINIMAX_VOICES = [
|
|
|
3764
3851
|
// src/catalog/media-nodes.ts
|
|
3765
3852
|
var ELEVENLABS_LOGO2 = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/elevenlabs.png";
|
|
3766
3853
|
var GOOGLE_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/192485d2-a76a-4657-9c06-930b2c70badd_compressed.png";
|
|
3767
|
-
var
|
|
3854
|
+
var MINIMAX_LOGO2 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
|
|
3768
3855
|
var SYNC_LOGO = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/sync.png";
|
|
3769
3856
|
var PER_CALL3 = { unit: "images" };
|
|
3770
3857
|
var EXPOSURE5 = ["cowork", "space_builder"];
|
|
@@ -3899,7 +3986,7 @@ var MEDIA_NODE_MODELS = [
|
|
|
3899
3986
|
pricingKind: "flat",
|
|
3900
3987
|
display: {
|
|
3901
3988
|
provider: "minimax",
|
|
3902
|
-
logo:
|
|
3989
|
+
logo: MINIMAX_LOGO2,
|
|
3903
3990
|
description: "MiniMax Speech 2.8 HD text to speech; studio-quality narration in over 300 voices, with pause and interjection tags."
|
|
3904
3991
|
},
|
|
3905
3992
|
capabilities: {}
|
|
@@ -4026,7 +4113,7 @@ var MEDIA_NODE_MODELS = [
|
|
|
4026
4113
|
pricingKind: "video_per_second",
|
|
4027
4114
|
display: {
|
|
4028
4115
|
provider: "minimax",
|
|
4029
|
-
logo:
|
|
4116
|
+
logo: MINIMAX_LOGO2,
|
|
4030
4117
|
description: "MiniMax H3 Max lip sync; animates a portrait image into a talking video as long as the speech, up to 2K."
|
|
4031
4118
|
},
|
|
4032
4119
|
capabilities: {}
|
|
@@ -4256,7 +4343,7 @@ var MODEL3D_MODELS = [
|
|
|
4256
4343
|
// src/catalog/other.ts
|
|
4257
4344
|
var GOOGLE_LOGO2 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/192485d2-a76a-4657-9c06-930b2c70badd_compressed.png";
|
|
4258
4345
|
var ELEVENLABS_LOGO3 = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/elevenlabs.png";
|
|
4259
|
-
var
|
|
4346
|
+
var MINIMAX_LOGO3 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
|
|
4260
4347
|
var OTHER_MODELS = [
|
|
4261
4348
|
{
|
|
4262
4349
|
id: "lyria-3-clip-preview",
|
|
@@ -4445,7 +4532,7 @@ var OTHER_MODELS = [
|
|
|
4445
4532
|
pricingKind: "flat",
|
|
4446
4533
|
display: {
|
|
4447
4534
|
provider: "minimax",
|
|
4448
|
-
logo:
|
|
4535
|
+
logo: MINIMAX_LOGO3,
|
|
4449
4536
|
description: "MiniMax Music 3 songs from a style prompt and your lyrics (or instrumental), up to 5 minutes."
|
|
4450
4537
|
},
|
|
4451
4538
|
capabilities: {}
|
|
@@ -5143,7 +5230,7 @@ var TEXT_MODELS = [
|
|
|
5143
5230
|
var VIDEO_USAGE = { unit: "seconds" };
|
|
5144
5231
|
var MB = 1024 * 1024;
|
|
5145
5232
|
var KLING_LOGO = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/kling-color.png";
|
|
5146
|
-
var
|
|
5233
|
+
var MINIMAX_LOGO4 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
|
|
5147
5234
|
var BYTEDANCE_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/3bba5d81-4e57-4e71-911b-cdfa05acca2c_compressed.png";
|
|
5148
5235
|
var XAI_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/858b7fcc-9bd5-411d-aea1-a7b35ecfffab_compressed.png";
|
|
5149
5236
|
var H3_RATIOS = ["21:9", "16:9", "4:3", "1:1", "3:4", "9:16"];
|
|
@@ -5295,7 +5382,8 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5295
5382
|
images: 10,
|
|
5296
5383
|
videos: 5,
|
|
5297
5384
|
videoSeconds: { min: 3, max: 30.05, total: 30 },
|
|
5298
|
-
videoPixels: { minWidth: 700, minHeight: 700 }
|
|
5385
|
+
videoPixels: { minWidth: 700, minHeight: 700 },
|
|
5386
|
+
videoFps: { min: 23.9, max: 60.05 }
|
|
5299
5387
|
},
|
|
5300
5388
|
supports: ["lastFrame"],
|
|
5301
5389
|
prompt: KLING_V4_PROMPT,
|
|
@@ -5461,7 +5549,7 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5461
5549
|
pricingKind: "video_per_second",
|
|
5462
5550
|
display: {
|
|
5463
5551
|
provider: "minimax",
|
|
5464
|
-
logo:
|
|
5552
|
+
logo: MINIMAX_LOGO4,
|
|
5465
5553
|
description: "The fast tier of MiniMax H3 Max: text-to-video and start/end-frame image-to-video with native audio and an optional soundtrack clip, up to 15 seconds at 1080p."
|
|
5466
5554
|
},
|
|
5467
5555
|
capabilities: {}
|
|
@@ -5491,7 +5579,7 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5491
5579
|
pricingKind: "video_per_second",
|
|
5492
5580
|
display: {
|
|
5493
5581
|
provider: "minimax",
|
|
5494
|
-
logo:
|
|
5582
|
+
logo: MINIMAX_LOGO4,
|
|
5495
5583
|
description: "MiniMax H3 Max Insert: generates a new 5-13 second scene inside an existing video from a prompt, reference images or videos, then returns to the original footage."
|
|
5496
5584
|
},
|
|
5497
5585
|
capabilities: { acceptsSourceVideo: true, videoEdit: true }
|
|
@@ -5520,7 +5608,7 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5520
5608
|
pricingKind: "video_per_second",
|
|
5521
5609
|
display: {
|
|
5522
5610
|
provider: "minimax",
|
|
5523
|
-
logo:
|
|
5611
|
+
logo: MINIMAX_LOGO4,
|
|
5524
5612
|
description: "MiniMax H3 Max Recast: replaces the people in a 5-30 second video with up to 4 reference photos, keeping the motion, camera, cuts and soundtrack."
|
|
5525
5613
|
},
|
|
5526
5614
|
capabilities: { acceptsSourceVideo: true, videoEdit: true }
|
|
@@ -5551,7 +5639,7 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5551
5639
|
pricingKind: "video_per_second",
|
|
5552
5640
|
display: {
|
|
5553
5641
|
provider: "minimax",
|
|
5554
|
-
logo:
|
|
5642
|
+
logo: MINIMAX_LOGO4,
|
|
5555
5643
|
description: "MiniMax H3 Max Relight: relights a video of up to 15 seconds from a lighting sphere image, keeping the subjects, motion, camera and audio."
|
|
5556
5644
|
},
|
|
5557
5645
|
capabilities: { acceptsSourceVideo: true, videoEdit: true }
|
|
@@ -5863,6 +5951,11 @@ var SEEDANCE_2_AUDIO = {
|
|
|
5863
5951
|
audioFormats: ["wav", "mp3"],
|
|
5864
5952
|
audioMaxBytes: 15 * 1024 * 1024
|
|
5865
5953
|
};
|
|
5954
|
+
var SEEDANCE_REFERENCE_MEDIA = {
|
|
5955
|
+
videoPixels: { minPixels: 407696, maxPixels: 8295044 },
|
|
5956
|
+
videoFps: { min: 23.8, max: 60 },
|
|
5957
|
+
imagePixels: { minPixels: 9e4 }
|
|
5958
|
+
};
|
|
5866
5959
|
var H3_PROMPT2 = { referenceSyntax: "numbered", maxChars: 5e4 };
|
|
5867
5960
|
var WAN_PROMPT = { referenceSyntax: "numbered", maxChars: 2e4 };
|
|
5868
5961
|
var OMNI_PROMPT = { referenceSyntax: "caption", maxChars: 5e4 };
|
|
@@ -6107,6 +6200,7 @@ var VIDEO_MODELS = [
|
|
|
6107
6200
|
audios: 3,
|
|
6108
6201
|
audioOnly: false,
|
|
6109
6202
|
videoSeconds: { min: 2, max: 15, total: 15 },
|
|
6203
|
+
...SEEDANCE_REFERENCE_MEDIA,
|
|
6110
6204
|
...SEEDANCE_2_AUDIO
|
|
6111
6205
|
},
|
|
6112
6206
|
sourceVideoSeconds: { min: 2, max: 15, inReferenceTotal: true },
|
|
@@ -6150,6 +6244,7 @@ var VIDEO_MODELS = [
|
|
|
6150
6244
|
audios: 3,
|
|
6151
6245
|
audioOnly: false,
|
|
6152
6246
|
videoSeconds: { min: 2, max: 15, total: 15 },
|
|
6247
|
+
...SEEDANCE_REFERENCE_MEDIA,
|
|
6153
6248
|
...SEEDANCE_2_AUDIO
|
|
6154
6249
|
},
|
|
6155
6250
|
sourceVideoSeconds: { min: 2, max: 15, inReferenceTotal: true },
|
|
@@ -6193,6 +6288,7 @@ var VIDEO_MODELS = [
|
|
|
6193
6288
|
videos: 10,
|
|
6194
6289
|
audios: 10,
|
|
6195
6290
|
videoSeconds: { min: 2, max: 30, total: 30, editMin: 4 },
|
|
6291
|
+
...SEEDANCE_REFERENCE_MEDIA,
|
|
6196
6292
|
// BytePlus: 2-30 s per clip, 30 s in all, wav/mp3, 15 MB each.
|
|
6197
6293
|
audioSeconds: { min: 2, max: 30, total: 30 },
|
|
6198
6294
|
audioFormats: ["wav", "mp3"],
|
|
@@ -8011,7 +8107,14 @@ var VideoSecondsLimitsSchema = z3.looseObject({
|
|
|
8011
8107
|
});
|
|
8012
8108
|
var VideoPixelLimitsSchema = z3.looseObject({
|
|
8013
8109
|
minWidth: z3.number().int().positive().optional(),
|
|
8014
|
-
minHeight: z3.number().int().positive().optional()
|
|
8110
|
+
minHeight: z3.number().int().positive().optional(),
|
|
8111
|
+
minPixels: z3.number().int().positive().optional(),
|
|
8112
|
+
maxPixels: z3.number().int().positive().optional(),
|
|
8113
|
+
maxSide: z3.number().int().positive().optional()
|
|
8114
|
+
});
|
|
8115
|
+
var VideoFpsLimitsSchema = z3.looseObject({
|
|
8116
|
+
min: z3.number().positive().optional(),
|
|
8117
|
+
max: z3.number().positive().optional()
|
|
8015
8118
|
});
|
|
8016
8119
|
var ReferenceLimitsSchema = z3.looseObject({
|
|
8017
8120
|
images: z3.number().optional(),
|
|
@@ -8022,6 +8125,13 @@ var ReferenceLimitsSchema = z3.looseObject({
|
|
|
8022
8125
|
audioOnly: z3.boolean().optional(),
|
|
8023
8126
|
videoSeconds: VideoSecondsLimitsSchema.optional(),
|
|
8024
8127
|
videoPixels: VideoPixelLimitsSchema.optional(),
|
|
8128
|
+
videoFps: VideoFpsLimitsSchema.optional(),
|
|
8129
|
+
videoMaxBytes: z3.number().positive().optional(),
|
|
8130
|
+
imagePixels: VideoPixelLimitsSchema.optional(),
|
|
8131
|
+
imageAspect: z3.looseObject({
|
|
8132
|
+
min: z3.number().positive().optional(),
|
|
8133
|
+
max: z3.number().positive().optional()
|
|
8134
|
+
}).optional(),
|
|
8025
8135
|
audioSeconds: z3.looseObject({
|
|
8026
8136
|
min: z3.number().optional(),
|
|
8027
8137
|
max: z3.number().optional(),
|
|
@@ -9121,6 +9231,19 @@ async function generateSeedreamImage(req, ctx) {
|
|
|
9121
9231
|
}
|
|
9122
9232
|
body.output_format = req.outputFormat === "jpeg" ? "jpeg" : "png";
|
|
9123
9233
|
}
|
|
9234
|
+
if (req.background !== void 0) {
|
|
9235
|
+
body.background = req.background;
|
|
9236
|
+
if (req.background === "transparent" && body.output_format === "jpeg") {
|
|
9237
|
+
ctx.warnings.push({
|
|
9238
|
+
code: "option_ignored",
|
|
9239
|
+
field: "outputFormat",
|
|
9240
|
+
from: "jpeg",
|
|
9241
|
+
to: "png",
|
|
9242
|
+
message: `${modelId} returns a transparent background only as png; using png`
|
|
9243
|
+
});
|
|
9244
|
+
body.output_format = "png";
|
|
9245
|
+
}
|
|
9246
|
+
}
|
|
9124
9247
|
const firstRef = refs[0];
|
|
9125
9248
|
if (refs.length === 1 && firstRef !== void 0) body.image = firstRef;
|
|
9126
9249
|
else if (refs.length > 1) body.image = refs;
|
|
@@ -10339,6 +10462,27 @@ var QWEN_EXACT = {
|
|
|
10339
10462
|
maxArea: 2048 * 2048,
|
|
10340
10463
|
multipleOf: 1
|
|
10341
10464
|
};
|
|
10465
|
+
var MINIMAX_H3_IMAGE_EXACT = {
|
|
10466
|
+
minSide: 1,
|
|
10467
|
+
maxSide: 14142,
|
|
10468
|
+
minArea: 655360,
|
|
10469
|
+
maxArea: 4096 * 4096,
|
|
10470
|
+
multipleOf: 1,
|
|
10471
|
+
maxAspect: 3,
|
|
10472
|
+
topTier: "4K"
|
|
10473
|
+
};
|
|
10474
|
+
function minimaxH3ImageSpec(label) {
|
|
10475
|
+
return {
|
|
10476
|
+
label,
|
|
10477
|
+
maxReferences: 16,
|
|
10478
|
+
maxCount: 10,
|
|
10479
|
+
outputFormats: ALL_FORMATS,
|
|
10480
|
+
promptMax: 32e3,
|
|
10481
|
+
promptRequired: true,
|
|
10482
|
+
aspectRatios: WIDE_RATIOS,
|
|
10483
|
+
exactSize: MINIMAX_H3_IMAGE_EXACT
|
|
10484
|
+
};
|
|
10485
|
+
}
|
|
10342
10486
|
var FAL_IMAGE_SPECS = /* @__PURE__ */ new Map([
|
|
10343
10487
|
[
|
|
10344
10488
|
"krea/v3/text-to-image",
|
|
@@ -10380,6 +10524,8 @@ var FAL_IMAGE_SPECS = /* @__PURE__ */ new Map([
|
|
|
10380
10524
|
exactSize: QWEN_EXACT
|
|
10381
10525
|
}
|
|
10382
10526
|
],
|
|
10527
|
+
["minimax/h3-image/text-to-image", minimaxH3ImageSpec("MiniMax H3 Image")],
|
|
10528
|
+
["minimax/h3-image/highspeed/text-to-image", minimaxH3ImageSpec("MiniMax H3 Image Highspeed")],
|
|
10383
10529
|
[
|
|
10384
10530
|
"fal-ai/kling-image/o3/text-to-image",
|
|
10385
10531
|
{
|
|
@@ -10443,6 +10589,7 @@ function falImageSpec(providerModelId) {
|
|
|
10443
10589
|
return FAL_IMAGE_SPECS.get(providerModelId.toLowerCase());
|
|
10444
10590
|
}
|
|
10445
10591
|
var AREA_1K = 1024 * 1024;
|
|
10592
|
+
var AREA_2K = 2048 * 2048;
|
|
10446
10593
|
function checkExactSize(exact, b) {
|
|
10447
10594
|
const match = /^(\d+)x(\d+)$/.exec(exact);
|
|
10448
10595
|
if (match === null) {
|
|
@@ -10454,14 +10601,21 @@ function checkExactSize(exact, b) {
|
|
|
10454
10601
|
const sideOk = [width, height].every(
|
|
10455
10602
|
(side) => side >= b.minSide && side <= b.maxSide && side % b.multipleOf === 0
|
|
10456
10603
|
);
|
|
10457
|
-
|
|
10604
|
+
const aspectOk = b.maxAspect === void 0 || Math.max(width, height) <= b.maxAspect * Math.min(width, height);
|
|
10605
|
+
if (!sideOk || !aspectOk || area < b.minArea || area > b.maxArea) {
|
|
10458
10606
|
const step = b.multipleOf > 1 ? `, multiples of ${b.multipleOf}` : "";
|
|
10607
|
+
const aspectLimit = b.maxAspect === void 0 ? "" : `, at most ${b.maxAspect}:1,`;
|
|
10459
10608
|
return {
|
|
10460
10609
|
ok: false,
|
|
10461
|
-
message: `takes an exactSize with sides of ${b.minSide} to ${b.maxSide} px${step} and ${b.minArea} to ${b.maxArea} px in total; got ${exact}`
|
|
10610
|
+
message: `takes an exactSize with sides of ${b.minSide} to ${b.maxSide} px${step}${aspectLimit} and ${b.minArea} to ${b.maxArea} px in total; got ${exact}`
|
|
10462
10611
|
};
|
|
10463
10612
|
}
|
|
10464
|
-
return { ok: true, size: { width, height, tier: area
|
|
10613
|
+
return { ok: true, size: { width, height, tier: exactTier(area, b) } };
|
|
10614
|
+
}
|
|
10615
|
+
function exactTier(area, b) {
|
|
10616
|
+
if (area <= AREA_1K) return "1K";
|
|
10617
|
+
if (b.topTier === void 0 || area <= AREA_2K) return "2K";
|
|
10618
|
+
return b.topTier;
|
|
10465
10619
|
}
|
|
10466
10620
|
function unsupported(message) {
|
|
10467
10621
|
return { code: "unsupported_option", message };
|
|
@@ -10667,17 +10821,17 @@ function pick(model, label, field, value, table) {
|
|
|
10667
10821
|
}
|
|
10668
10822
|
return mapped;
|
|
10669
10823
|
}
|
|
10670
|
-
function familyImageSize(model, call) {
|
|
10671
|
-
if (call.exact === void 0) return { dims: sizedDimensions(model, call) };
|
|
10824
|
+
function familyImageSize(model, call, areas = TIER_AREAS) {
|
|
10825
|
+
if (call.exact === void 0) return { dims: sizedDimensions(model, call, areas) };
|
|
10672
10826
|
const { width, height, tier } = call.exact;
|
|
10673
10827
|
return { dims: { width, height }, imageSize: tier };
|
|
10674
10828
|
}
|
|
10675
|
-
function sizedDimensions(model, { label, req }) {
|
|
10829
|
+
function sizedDimensions(model, { label, req }, areas) {
|
|
10676
10830
|
const aspectRatio = req.aspectRatio ?? "1:1";
|
|
10677
10831
|
const size = req.size ?? "1K";
|
|
10678
|
-
pick(model, label, "size", size,
|
|
10832
|
+
pick(model, label, "size", size, areas);
|
|
10679
10833
|
const dims = dimensionsFor(
|
|
10680
|
-
{ field: "image_size", areas: { ...
|
|
10834
|
+
{ field: "image_size", areas: { ...areas }, multipleOf: 16 },
|
|
10681
10835
|
{ prompt: req.prompt, aspectRatio, size }
|
|
10682
10836
|
);
|
|
10683
10837
|
if (dims === void 0) throw fail2(model, `${label} has no size for ${aspectRatio}`);
|
|
@@ -10690,8 +10844,8 @@ function withCommon(input, req, opts) {
|
|
|
10690
10844
|
return input;
|
|
10691
10845
|
}
|
|
10692
10846
|
var AREA_1K2 = 1024 * 1024;
|
|
10693
|
-
var
|
|
10694
|
-
var TIER_AREAS = { "1K": AREA_1K2, "2K":
|
|
10847
|
+
var AREA_2K2 = 2048 * 2048;
|
|
10848
|
+
var TIER_AREAS = { "1K": AREA_1K2, "2K": AREA_2K2 };
|
|
10695
10849
|
var KREA = {
|
|
10696
10850
|
editEndpoint: "krea/v3/edit",
|
|
10697
10851
|
build(call, model) {
|
|
@@ -10749,6 +10903,24 @@ var QWEN = {
|
|
|
10749
10903
|
};
|
|
10750
10904
|
}
|
|
10751
10905
|
};
|
|
10906
|
+
function minimaxH3Image(editEndpoint) {
|
|
10907
|
+
return {
|
|
10908
|
+
editEndpoint,
|
|
10909
|
+
build(call, model) {
|
|
10910
|
+
const { req, refs } = call;
|
|
10911
|
+
const size = familyImageSize(model, call, H3_IMAGE_AREAS);
|
|
10912
|
+
const input = { prompt: req.prompt, image_size: { ...size.dims } };
|
|
10913
|
+
if (refs.length > 0) input["image_urls"] = refs;
|
|
10914
|
+
return {
|
|
10915
|
+
input: withCommon(input, req, { count: true, seed: false }),
|
|
10916
|
+
...size.imageSize !== void 0 && { imageSize: size.imageSize }
|
|
10917
|
+
};
|
|
10918
|
+
}
|
|
10919
|
+
};
|
|
10920
|
+
}
|
|
10921
|
+
var H3_IMAGE_AREAS = { ...TIER_AREAS, "4K": 4096 * 4096 };
|
|
10922
|
+
var MINIMAX_H3_IMAGE = minimaxH3Image("minimax/h3-image/edit");
|
|
10923
|
+
var MINIMAX_H3_IMAGE_HIGHSPEED = minimaxH3Image("minimax/h3-image/highspeed/edit");
|
|
10752
10924
|
function klingImage(editEndpoint, sizes, field) {
|
|
10753
10925
|
return {
|
|
10754
10926
|
editEndpoint,
|
|
@@ -10830,6 +11002,8 @@ var FAMILIES = /* @__PURE__ */ new Map([
|
|
|
10830
11002
|
["krea/v3/text-to-image", KREA],
|
|
10831
11003
|
["xai/grok-imagine-image/v2.0/text-to-image", GROK],
|
|
10832
11004
|
["alibaba/qwen-image-3/text-to-image", QWEN],
|
|
11005
|
+
["minimax/h3-image/text-to-image", MINIMAX_H3_IMAGE],
|
|
11006
|
+
["minimax/h3-image/highspeed/text-to-image", MINIMAX_H3_IMAGE_HIGHSPEED],
|
|
10833
11007
|
["fal-ai/kling-image/o3/text-to-image", KLING_O3],
|
|
10834
11008
|
["fal-ai/kling-image/v3/text-to-image", KLING_V3],
|
|
10835
11009
|
["recraft/v4.1/flash/text-to-image", RECRAFT_FLASH],
|
|
@@ -15703,8 +15877,8 @@ function checkGenerateSeconds(req, ctx) {
|
|
|
15703
15877
|
}
|
|
15704
15878
|
var MAX_PLAUSIBLE_SECONDS = 60;
|
|
15705
15879
|
function editedSeconds(req, bytes) {
|
|
15706
|
-
const
|
|
15707
|
-
const length =
|
|
15880
|
+
const measured2 = mp4DurationSeconds(bytes);
|
|
15881
|
+
const length = measured2 !== void 0 && measured2 > 0 && measured2 <= MAX_PLAUSIBLE_SECONDS ? measured2 : req.sourceVideo?.durationSeconds;
|
|
15708
15882
|
return Math.max(length ?? 0, GENERATE_SECONDS);
|
|
15709
15883
|
}
|
|
15710
15884
|
function videoUsage4(ctx, req, mode, seconds3) {
|
|
@@ -16074,15 +16248,6 @@ var openaiImageAdapter = {
|
|
|
16074
16248
|
});
|
|
16075
16249
|
outputFormat = "png";
|
|
16076
16250
|
}
|
|
16077
|
-
if (isEdit && outputFormat === "svg") {
|
|
16078
|
-
throw new ModelKitError({
|
|
16079
|
-
code: "unsupported_option",
|
|
16080
|
-
message: `${ctx.model.id} cannot make an SVG from reference images`,
|
|
16081
|
-
provider: "openai-image",
|
|
16082
|
-
model: ctx.model.id,
|
|
16083
|
-
retryable: false
|
|
16084
|
-
});
|
|
16085
|
-
}
|
|
16086
16251
|
const svgModel = ctx.model.constraints.svgModel;
|
|
16087
16252
|
if (outputFormat === "svg" && !svgModel) {
|
|
16088
16253
|
throw new ModelKitError({
|
|
@@ -17858,9 +18023,6 @@ function applyImageOutputRules(model, req, onUnsupported, warnings) {
|
|
|
17858
18023
|
}
|
|
17859
18024
|
if (req.outputFormat === "svg") {
|
|
17860
18025
|
if (!c.svgModel) refuse(model, `${model.id} names no svgModel to write the SVG`);
|
|
17861
|
-
if ((req.references ?? []).length > 0) {
|
|
17862
|
-
refuse(model, `${model.label} cannot make an SVG from reference images`);
|
|
17863
|
-
}
|
|
17864
18026
|
if ((req.count ?? 1) > 1) {
|
|
17865
18027
|
if (onUnsupported === "error") {
|
|
17866
18028
|
refuse(model, `${model.label} makes one SVG per call`);
|
|
@@ -18832,6 +18994,126 @@ function resolveVoiceDesignOptions(model, request, onUnsupported = "error") {
|
|
|
18832
18994
|
return { request: resolved, warnings };
|
|
18833
18995
|
}
|
|
18834
18996
|
|
|
18997
|
+
// src/reference-video-conform.ts
|
|
18998
|
+
var REFERENCE_VIDEO_CONFORM_PROFILE = "model-safe-v1";
|
|
18999
|
+
var SHRINK_MARGIN = 0.998;
|
|
19000
|
+
var GROW_MARGIN = 1.002;
|
|
19001
|
+
var LOW_FPS_TARGET = 24;
|
|
19002
|
+
var HIGH_FPS_TARGET = 30;
|
|
19003
|
+
function measured(value) {
|
|
19004
|
+
return value !== void 0 && Number.isFinite(value) && value > 0;
|
|
19005
|
+
}
|
|
19006
|
+
function evenDown(value) {
|
|
19007
|
+
return Math.max(2, Math.floor(value / 2) * 2);
|
|
19008
|
+
}
|
|
19009
|
+
function evenUp(value) {
|
|
19010
|
+
return Math.max(2, Math.ceil(value / 2) * 2);
|
|
19011
|
+
}
|
|
19012
|
+
function sizeFix(limits, width, height) {
|
|
19013
|
+
if (!limits) return null;
|
|
19014
|
+
const pixels = width * height;
|
|
19015
|
+
const long = Math.max(width, height);
|
|
19016
|
+
const shrink = [];
|
|
19017
|
+
const grow = [];
|
|
19018
|
+
const reasons = [];
|
|
19019
|
+
if (limits.maxPixels !== void 0 && pixels > limits.maxPixels) {
|
|
19020
|
+
shrink.push(Math.sqrt(limits.maxPixels / pixels) * SHRINK_MARGIN);
|
|
19021
|
+
reasons.push("pixels_over");
|
|
19022
|
+
}
|
|
19023
|
+
if (limits.maxSide !== void 0 && long > limits.maxSide) {
|
|
19024
|
+
shrink.push(limits.maxSide / long * SHRINK_MARGIN);
|
|
19025
|
+
reasons.push("side_over");
|
|
19026
|
+
}
|
|
19027
|
+
if (shrink.length > 0) return { scale: Math.min(...shrink), up: false, reasons };
|
|
19028
|
+
if (limits.minPixels !== void 0 && pixels < limits.minPixels) {
|
|
19029
|
+
grow.push(Math.sqrt(limits.minPixels / pixels) * GROW_MARGIN);
|
|
19030
|
+
reasons.push("pixels_under");
|
|
19031
|
+
}
|
|
19032
|
+
const sideUnder = [
|
|
19033
|
+
limits.minWidth !== void 0 && width < limits.minWidth ? limits.minWidth / width * GROW_MARGIN : 0,
|
|
19034
|
+
limits.minHeight !== void 0 && height < limits.minHeight ? limits.minHeight / height * GROW_MARGIN : 0
|
|
19035
|
+
].filter((scale) => scale > 0);
|
|
19036
|
+
if (sideUnder.length > 0) {
|
|
19037
|
+
grow.push(...sideUnder);
|
|
19038
|
+
reasons.push("side_under");
|
|
19039
|
+
}
|
|
19040
|
+
if (grow.length > 0) return { scale: Math.max(...grow), up: true, reasons };
|
|
19041
|
+
return null;
|
|
19042
|
+
}
|
|
19043
|
+
function fpsFix(model, fps) {
|
|
19044
|
+
const limits = model.constraints.references?.videoFps;
|
|
19045
|
+
if (!limits || !measured(fps)) return void 0;
|
|
19046
|
+
const inRange = (rate) => (limits.min === void 0 || rate >= limits.min) && (limits.max === void 0 || rate <= limits.max);
|
|
19047
|
+
if (limits.min !== void 0 && fps < limits.min) {
|
|
19048
|
+
const target = inRange(LOW_FPS_TARGET) ? LOW_FPS_TARGET : Math.ceil(limits.min);
|
|
19049
|
+
return { fps: target, reason: "fps_under" };
|
|
19050
|
+
}
|
|
19051
|
+
if (limits.max !== void 0 && fps > limits.max) {
|
|
19052
|
+
const target = inRange(HIGH_FPS_TARGET) ? HIGH_FPS_TARGET : Math.floor(limits.max);
|
|
19053
|
+
return { fps: target, reason: "fps_over" };
|
|
19054
|
+
}
|
|
19055
|
+
return void 0;
|
|
19056
|
+
}
|
|
19057
|
+
function referenceVideoConformPlan(model, probe) {
|
|
19058
|
+
const rate = fpsFix(model, probe.fps);
|
|
19059
|
+
const maxBytes = model.constraints.references?.videoMaxBytes;
|
|
19060
|
+
const overBytes = maxBytes !== void 0 && measured(probe.bytes) && probe.bytes > maxBytes;
|
|
19061
|
+
const { width: probedWidth, height: probedHeight } = probe;
|
|
19062
|
+
if (!measured(probedWidth) || !measured(probedHeight)) return null;
|
|
19063
|
+
const width = Math.round(probedWidth);
|
|
19064
|
+
const height = Math.round(probedHeight);
|
|
19065
|
+
const size = sizeFix(model.constraints.references?.videoPixels, width, height);
|
|
19066
|
+
if (!size && !rate && !overBytes) return null;
|
|
19067
|
+
const round = size?.up ? evenUp : evenDown;
|
|
19068
|
+
const scale = size?.scale ?? 1;
|
|
19069
|
+
const reasons = [...size?.reasons ?? []];
|
|
19070
|
+
if (rate) reasons.push(rate.reason);
|
|
19071
|
+
if (overBytes) reasons.push("bytes_over");
|
|
19072
|
+
const plan4 = {
|
|
19073
|
+
width: round(width * scale),
|
|
19074
|
+
height: round(height * scale),
|
|
19075
|
+
reasons
|
|
19076
|
+
};
|
|
19077
|
+
if (rate) plan4.fps = rate.fps;
|
|
19078
|
+
if (maxBytes !== void 0) plan4.maxBytes = maxBytes;
|
|
19079
|
+
return plan4;
|
|
19080
|
+
}
|
|
19081
|
+
function referenceImageConformPlan(model, probe) {
|
|
19082
|
+
const { width: probedWidth, height: probedHeight } = probe;
|
|
19083
|
+
if (!measured(probedWidth) || !measured(probedHeight)) return null;
|
|
19084
|
+
const references = model.constraints.references;
|
|
19085
|
+
const width = Math.round(probedWidth);
|
|
19086
|
+
const height = Math.round(probedHeight);
|
|
19087
|
+
const reasons = [];
|
|
19088
|
+
let frameWidth = width;
|
|
19089
|
+
let frameHeight = height;
|
|
19090
|
+
const aspect = references?.imageAspect;
|
|
19091
|
+
if (aspect?.min !== void 0 && width / height < aspect.min) {
|
|
19092
|
+
frameWidth = Math.ceil(height * aspect.min);
|
|
19093
|
+
reasons.push("aspect");
|
|
19094
|
+
} else if (aspect?.max !== void 0 && width / height > aspect.max) {
|
|
19095
|
+
frameHeight = Math.ceil(width / aspect.max);
|
|
19096
|
+
reasons.push("aspect");
|
|
19097
|
+
}
|
|
19098
|
+
const size = sizeFix(references?.imagePixels, frameWidth, frameHeight);
|
|
19099
|
+
if (!size && reasons.length === 0) return null;
|
|
19100
|
+
if (size) reasons.push(...size.reasons);
|
|
19101
|
+
const scale = size?.scale ?? 1;
|
|
19102
|
+
const round = size?.up ? Math.ceil : Math.floor;
|
|
19103
|
+
const frame = {
|
|
19104
|
+
width: Math.max(1, round(frameWidth * scale)),
|
|
19105
|
+
height: Math.max(1, round(frameHeight * scale))
|
|
19106
|
+
};
|
|
19107
|
+
const image = frameWidth > width ? {
|
|
19108
|
+
width: Math.max(1, Math.round(frame.height * width / height)),
|
|
19109
|
+
height: frame.height
|
|
19110
|
+
} : frameHeight > height ? {
|
|
19111
|
+
width: frame.width,
|
|
19112
|
+
height: Math.max(1, Math.round(frame.width * height / width))
|
|
19113
|
+
} : { ...frame };
|
|
19114
|
+
return { ...frame, image, reasons };
|
|
19115
|
+
}
|
|
19116
|
+
|
|
18835
19117
|
// src/keys.ts
|
|
18836
19118
|
var ADAPTER_KEYS = {
|
|
18837
19119
|
"ai-sdk-text": [],
|
|
@@ -20321,6 +20603,7 @@ export {
|
|
|
20321
20603
|
MODEL3D_MODELS,
|
|
20322
20604
|
MODELS,
|
|
20323
20605
|
ModelKitError,
|
|
20606
|
+
REFERENCE_VIDEO_CONFORM_PROFILE,
|
|
20324
20607
|
SURFACES2 as SURFACES,
|
|
20325
20608
|
SurfaceSchema,
|
|
20326
20609
|
VIDEO_INPUT_SPEC_KEYS,
|
|
@@ -20388,6 +20671,8 @@ export {
|
|
|
20388
20671
|
primeCatalog,
|
|
20389
20672
|
prodiaAdapter,
|
|
20390
20673
|
readErrorBody,
|
|
20674
|
+
referenceImageConformPlan,
|
|
20675
|
+
referenceVideoConformPlan,
|
|
20391
20676
|
replicateAdapter,
|
|
20392
20677
|
resetLiveCatalog,
|
|
20393
20678
|
resolutionTier,
|