@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.cjs
CHANGED
|
@@ -51,6 +51,7 @@ __export(index_exports, {
|
|
|
51
51
|
MODEL3D_MODELS: () => MODEL3D_MODELS,
|
|
52
52
|
MODELS: () => MODELS,
|
|
53
53
|
ModelKitError: () => ModelKitError,
|
|
54
|
+
REFERENCE_VIDEO_CONFORM_PROFILE: () => REFERENCE_VIDEO_CONFORM_PROFILE,
|
|
54
55
|
SURFACES: () => SURFACES2,
|
|
55
56
|
SurfaceSchema: () => SurfaceSchema,
|
|
56
57
|
VIDEO_INPUT_SPEC_KEYS: () => VIDEO_INPUT_SPEC_KEYS,
|
|
@@ -118,6 +119,8 @@ __export(index_exports, {
|
|
|
118
119
|
primeCatalog: () => primeCatalog,
|
|
119
120
|
prodiaAdapter: () => prodiaAdapter,
|
|
120
121
|
readErrorBody: () => readErrorBody,
|
|
122
|
+
referenceImageConformPlan: () => referenceImageConformPlan,
|
|
123
|
+
referenceVideoConformPlan: () => referenceVideoConformPlan,
|
|
121
124
|
replicateAdapter: () => replicateAdapter,
|
|
122
125
|
resetLiveCatalog: () => resetLiveCatalog,
|
|
123
126
|
resolutionTier: () => resolutionTier,
|
|
@@ -308,6 +311,7 @@ function isListed(row2) {
|
|
|
308
311
|
var IMAGE_USAGE = { unit: "images" };
|
|
309
312
|
var EXPOSURE = ["cowork", "space_builder"];
|
|
310
313
|
var LOBE = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light";
|
|
314
|
+
var MINIMAX_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
|
|
311
315
|
var SIZED_RATIOS = [
|
|
312
316
|
"1:1",
|
|
313
317
|
"16:9",
|
|
@@ -333,6 +337,36 @@ var RECRAFT_RATIOS = [
|
|
|
333
337
|
"5:4",
|
|
334
338
|
"4:5"
|
|
335
339
|
];
|
|
340
|
+
function minimaxH3ImageRow(row2) {
|
|
341
|
+
return {
|
|
342
|
+
id: row2.id,
|
|
343
|
+
aliases: [],
|
|
344
|
+
label: row2.label,
|
|
345
|
+
type: "image",
|
|
346
|
+
adapter: "fal",
|
|
347
|
+
providerModelId: row2.providerModelId,
|
|
348
|
+
lifecycle: "active",
|
|
349
|
+
exposure: EXPOSURE,
|
|
350
|
+
constraints: {
|
|
351
|
+
aspectRatios: [...SIZED_RATIOS],
|
|
352
|
+
sizes: ["1K", "2K", "4K"],
|
|
353
|
+
references: {
|
|
354
|
+
images: 16,
|
|
355
|
+
imagePixels: { minWidth: 128, minHeight: 128, maxSide: 8192 }
|
|
356
|
+
},
|
|
357
|
+
supports: ["count", "outputFormat"],
|
|
358
|
+
prompt: { referenceSyntax: "numbered", maxChars: 32e3 }
|
|
359
|
+
},
|
|
360
|
+
defaults: { size: "2K", aspectRatio: "1:1", count: 1 },
|
|
361
|
+
usage: { ...IMAGE_USAGE },
|
|
362
|
+
pricingKind: "image_size",
|
|
363
|
+
display: {
|
|
364
|
+
provider: "minimax",
|
|
365
|
+
description: row2.description,
|
|
366
|
+
logo: MINIMAX_LOGO
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
}
|
|
336
370
|
var FAL_IMAGE_MODELS = [
|
|
337
371
|
{
|
|
338
372
|
// krea/v3/text-to-image; references switch to krea/v3/edit (1-8 images). Billed per
|
|
@@ -416,6 +450,22 @@ var FAL_IMAGE_MODELS = [
|
|
|
416
450
|
logo: `${LOBE}/qwen-color.png`
|
|
417
451
|
}
|
|
418
452
|
},
|
|
453
|
+
minimaxH3ImageRow({
|
|
454
|
+
// minimax/h3-image/text-to-image; references switch to minimax/h3-image/edit. Billed on
|
|
455
|
+
// tokens: $2.30/M input text, $1.50/M input image, $3.80/M output image.
|
|
456
|
+
id: "minimax-h3-image",
|
|
457
|
+
label: "MiniMax H3 Image",
|
|
458
|
+
providerModelId: "minimax/h3-image/text-to-image",
|
|
459
|
+
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."
|
|
460
|
+
}),
|
|
461
|
+
minimaxH3ImageRow({
|
|
462
|
+
// minimax/h3-image/highspeed/text-to-image; references switch to .../highspeed/edit.
|
|
463
|
+
// Billed on tokens: $2.30/M input text, $3.00/M input image, $7.60/M output image.
|
|
464
|
+
id: "minimax-h3-image-highspeed",
|
|
465
|
+
label: "MiniMax H3 Image Highspeed",
|
|
466
|
+
providerModelId: "minimax/h3-image/highspeed/text-to-image",
|
|
467
|
+
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."
|
|
468
|
+
}),
|
|
419
469
|
{
|
|
420
470
|
// fal-ai/kling-image/o3/text-to-image; references switch to .../o3/image-to-image (up to
|
|
421
471
|
// 10, "@Image1".."@Image10"). $0.028 per image at 1K and 2K, double at 4K.
|
|
@@ -992,6 +1042,46 @@ var IMAGE_MODELS = [
|
|
|
992
1042
|
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."
|
|
993
1043
|
}
|
|
994
1044
|
},
|
|
1045
|
+
// Seedream 5.5 (Early Access, 2026-11-11): 1K / 1.5K / 2K, no 4K; exact sizes must total
|
|
1046
|
+
// 921,600 to 4,624,220 px, which every SEEDREAM_SIZES 1K and 2K entry does. Up to 10
|
|
1047
|
+
// references; `background: "transparent"` returns an RGBA PNG.
|
|
1048
|
+
{
|
|
1049
|
+
id: "seedream-5.5",
|
|
1050
|
+
aliases: [],
|
|
1051
|
+
label: "Seedream 5.5",
|
|
1052
|
+
type: "image",
|
|
1053
|
+
adapter: "ark",
|
|
1054
|
+
providerModelId: "dola-seedream-5-5-261028",
|
|
1055
|
+
lifecycle: "active",
|
|
1056
|
+
exposure: ["cowork", "space_builder"],
|
|
1057
|
+
constraints: {
|
|
1058
|
+
aspectRatios: [
|
|
1059
|
+
"1:1",
|
|
1060
|
+
"4:3",
|
|
1061
|
+
"3:4",
|
|
1062
|
+
"16:9",
|
|
1063
|
+
"9:16",
|
|
1064
|
+
"3:2",
|
|
1065
|
+
"2:3",
|
|
1066
|
+
"21:9",
|
|
1067
|
+
"9:21",
|
|
1068
|
+
"4:5",
|
|
1069
|
+
"5:4"
|
|
1070
|
+
],
|
|
1071
|
+
sizes: ["1K", "2K"],
|
|
1072
|
+
references: { images: 10 },
|
|
1073
|
+
supports: ["seed", "outputFormat"],
|
|
1074
|
+
backgrounds: ["auto", "opaque", "transparent"]
|
|
1075
|
+
},
|
|
1076
|
+
defaults: { size: "1K", aspectRatio: "1:1" },
|
|
1077
|
+
usage: { ...IMAGE_USAGE3 },
|
|
1078
|
+
pricingKind: "image_size",
|
|
1079
|
+
display: {
|
|
1080
|
+
provider: "bytedance",
|
|
1081
|
+
logo: "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/3bba5d81-4e57-4e71-911b-cdfa05acca2c_compressed.png",
|
|
1082
|
+
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."
|
|
1083
|
+
}
|
|
1084
|
+
},
|
|
995
1085
|
{
|
|
996
1086
|
id: "seedream-4.5",
|
|
997
1087
|
aliases: [],
|
|
@@ -3914,7 +4004,7 @@ var MINIMAX_VOICES = [
|
|
|
3914
4004
|
// src/catalog/media-nodes.ts
|
|
3915
4005
|
var ELEVENLABS_LOGO2 = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/elevenlabs.png";
|
|
3916
4006
|
var GOOGLE_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/192485d2-a76a-4657-9c06-930b2c70badd_compressed.png";
|
|
3917
|
-
var
|
|
4007
|
+
var MINIMAX_LOGO2 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
|
|
3918
4008
|
var SYNC_LOGO = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/sync.png";
|
|
3919
4009
|
var PER_CALL3 = { unit: "images" };
|
|
3920
4010
|
var EXPOSURE5 = ["cowork", "space_builder"];
|
|
@@ -4049,7 +4139,7 @@ var MEDIA_NODE_MODELS = [
|
|
|
4049
4139
|
pricingKind: "flat",
|
|
4050
4140
|
display: {
|
|
4051
4141
|
provider: "minimax",
|
|
4052
|
-
logo:
|
|
4142
|
+
logo: MINIMAX_LOGO2,
|
|
4053
4143
|
description: "MiniMax Speech 2.8 HD text to speech; studio-quality narration in over 300 voices, with pause and interjection tags."
|
|
4054
4144
|
},
|
|
4055
4145
|
capabilities: {}
|
|
@@ -4176,7 +4266,7 @@ var MEDIA_NODE_MODELS = [
|
|
|
4176
4266
|
pricingKind: "video_per_second",
|
|
4177
4267
|
display: {
|
|
4178
4268
|
provider: "minimax",
|
|
4179
|
-
logo:
|
|
4269
|
+
logo: MINIMAX_LOGO2,
|
|
4180
4270
|
description: "MiniMax H3 Max lip sync; animates a portrait image into a talking video as long as the speech, up to 2K."
|
|
4181
4271
|
},
|
|
4182
4272
|
capabilities: {}
|
|
@@ -4406,7 +4496,7 @@ var MODEL3D_MODELS = [
|
|
|
4406
4496
|
// src/catalog/other.ts
|
|
4407
4497
|
var GOOGLE_LOGO2 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/192485d2-a76a-4657-9c06-930b2c70badd_compressed.png";
|
|
4408
4498
|
var ELEVENLABS_LOGO3 = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/elevenlabs.png";
|
|
4409
|
-
var
|
|
4499
|
+
var MINIMAX_LOGO3 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
|
|
4410
4500
|
var OTHER_MODELS = [
|
|
4411
4501
|
{
|
|
4412
4502
|
id: "lyria-3-clip-preview",
|
|
@@ -4595,7 +4685,7 @@ var OTHER_MODELS = [
|
|
|
4595
4685
|
pricingKind: "flat",
|
|
4596
4686
|
display: {
|
|
4597
4687
|
provider: "minimax",
|
|
4598
|
-
logo:
|
|
4688
|
+
logo: MINIMAX_LOGO3,
|
|
4599
4689
|
description: "MiniMax Music 3 songs from a style prompt and your lyrics (or instrumental), up to 5 minutes."
|
|
4600
4690
|
},
|
|
4601
4691
|
capabilities: {}
|
|
@@ -5293,7 +5383,7 @@ var TEXT_MODELS = [
|
|
|
5293
5383
|
var VIDEO_USAGE = { unit: "seconds" };
|
|
5294
5384
|
var MB = 1024 * 1024;
|
|
5295
5385
|
var KLING_LOGO = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/kling-color.png";
|
|
5296
|
-
var
|
|
5386
|
+
var MINIMAX_LOGO4 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
|
|
5297
5387
|
var BYTEDANCE_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/3bba5d81-4e57-4e71-911b-cdfa05acca2c_compressed.png";
|
|
5298
5388
|
var XAI_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/858b7fcc-9bd5-411d-aea1-a7b35ecfffab_compressed.png";
|
|
5299
5389
|
var H3_RATIOS = ["21:9", "16:9", "4:3", "1:1", "3:4", "9:16"];
|
|
@@ -5445,7 +5535,8 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5445
5535
|
images: 10,
|
|
5446
5536
|
videos: 5,
|
|
5447
5537
|
videoSeconds: { min: 3, max: 30.05, total: 30 },
|
|
5448
|
-
videoPixels: { minWidth: 700, minHeight: 700 }
|
|
5538
|
+
videoPixels: { minWidth: 700, minHeight: 700 },
|
|
5539
|
+
videoFps: { min: 23.9, max: 60.05 }
|
|
5449
5540
|
},
|
|
5450
5541
|
supports: ["lastFrame"],
|
|
5451
5542
|
prompt: KLING_V4_PROMPT,
|
|
@@ -5611,7 +5702,7 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5611
5702
|
pricingKind: "video_per_second",
|
|
5612
5703
|
display: {
|
|
5613
5704
|
provider: "minimax",
|
|
5614
|
-
logo:
|
|
5705
|
+
logo: MINIMAX_LOGO4,
|
|
5615
5706
|
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."
|
|
5616
5707
|
},
|
|
5617
5708
|
capabilities: {}
|
|
@@ -5641,7 +5732,7 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5641
5732
|
pricingKind: "video_per_second",
|
|
5642
5733
|
display: {
|
|
5643
5734
|
provider: "minimax",
|
|
5644
|
-
logo:
|
|
5735
|
+
logo: MINIMAX_LOGO4,
|
|
5645
5736
|
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."
|
|
5646
5737
|
},
|
|
5647
5738
|
capabilities: { acceptsSourceVideo: true, videoEdit: true }
|
|
@@ -5670,7 +5761,7 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5670
5761
|
pricingKind: "video_per_second",
|
|
5671
5762
|
display: {
|
|
5672
5763
|
provider: "minimax",
|
|
5673
|
-
logo:
|
|
5764
|
+
logo: MINIMAX_LOGO4,
|
|
5674
5765
|
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."
|
|
5675
5766
|
},
|
|
5676
5767
|
capabilities: { acceptsSourceVideo: true, videoEdit: true }
|
|
@@ -5701,7 +5792,7 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5701
5792
|
pricingKind: "video_per_second",
|
|
5702
5793
|
display: {
|
|
5703
5794
|
provider: "minimax",
|
|
5704
|
-
logo:
|
|
5795
|
+
logo: MINIMAX_LOGO4,
|
|
5705
5796
|
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."
|
|
5706
5797
|
},
|
|
5707
5798
|
capabilities: { acceptsSourceVideo: true, videoEdit: true }
|
|
@@ -6013,6 +6104,11 @@ var SEEDANCE_2_AUDIO = {
|
|
|
6013
6104
|
audioFormats: ["wav", "mp3"],
|
|
6014
6105
|
audioMaxBytes: 15 * 1024 * 1024
|
|
6015
6106
|
};
|
|
6107
|
+
var SEEDANCE_REFERENCE_MEDIA = {
|
|
6108
|
+
videoPixels: { minPixels: 407696, maxPixels: 8295044 },
|
|
6109
|
+
videoFps: { min: 23.8, max: 60 },
|
|
6110
|
+
imagePixels: { minPixels: 9e4 }
|
|
6111
|
+
};
|
|
6016
6112
|
var H3_PROMPT2 = { referenceSyntax: "numbered", maxChars: 5e4 };
|
|
6017
6113
|
var WAN_PROMPT = { referenceSyntax: "numbered", maxChars: 2e4 };
|
|
6018
6114
|
var OMNI_PROMPT = { referenceSyntax: "caption", maxChars: 5e4 };
|
|
@@ -6257,6 +6353,7 @@ var VIDEO_MODELS = [
|
|
|
6257
6353
|
audios: 3,
|
|
6258
6354
|
audioOnly: false,
|
|
6259
6355
|
videoSeconds: { min: 2, max: 15, total: 15 },
|
|
6356
|
+
...SEEDANCE_REFERENCE_MEDIA,
|
|
6260
6357
|
...SEEDANCE_2_AUDIO
|
|
6261
6358
|
},
|
|
6262
6359
|
sourceVideoSeconds: { min: 2, max: 15, inReferenceTotal: true },
|
|
@@ -6300,6 +6397,7 @@ var VIDEO_MODELS = [
|
|
|
6300
6397
|
audios: 3,
|
|
6301
6398
|
audioOnly: false,
|
|
6302
6399
|
videoSeconds: { min: 2, max: 15, total: 15 },
|
|
6400
|
+
...SEEDANCE_REFERENCE_MEDIA,
|
|
6303
6401
|
...SEEDANCE_2_AUDIO
|
|
6304
6402
|
},
|
|
6305
6403
|
sourceVideoSeconds: { min: 2, max: 15, inReferenceTotal: true },
|
|
@@ -6343,6 +6441,7 @@ var VIDEO_MODELS = [
|
|
|
6343
6441
|
videos: 10,
|
|
6344
6442
|
audios: 10,
|
|
6345
6443
|
videoSeconds: { min: 2, max: 30, total: 30, editMin: 4 },
|
|
6444
|
+
...SEEDANCE_REFERENCE_MEDIA,
|
|
6346
6445
|
// BytePlus: 2-30 s per clip, 30 s in all, wav/mp3, 15 MB each.
|
|
6347
6446
|
audioSeconds: { min: 2, max: 30, total: 30 },
|
|
6348
6447
|
audioFormats: ["wav", "mp3"],
|
|
@@ -8161,7 +8260,14 @@ var VideoSecondsLimitsSchema = import_zod3.z.looseObject({
|
|
|
8161
8260
|
});
|
|
8162
8261
|
var VideoPixelLimitsSchema = import_zod3.z.looseObject({
|
|
8163
8262
|
minWidth: import_zod3.z.number().int().positive().optional(),
|
|
8164
|
-
minHeight: import_zod3.z.number().int().positive().optional()
|
|
8263
|
+
minHeight: import_zod3.z.number().int().positive().optional(),
|
|
8264
|
+
minPixels: import_zod3.z.number().int().positive().optional(),
|
|
8265
|
+
maxPixels: import_zod3.z.number().int().positive().optional(),
|
|
8266
|
+
maxSide: import_zod3.z.number().int().positive().optional()
|
|
8267
|
+
});
|
|
8268
|
+
var VideoFpsLimitsSchema = import_zod3.z.looseObject({
|
|
8269
|
+
min: import_zod3.z.number().positive().optional(),
|
|
8270
|
+
max: import_zod3.z.number().positive().optional()
|
|
8165
8271
|
});
|
|
8166
8272
|
var ReferenceLimitsSchema = import_zod3.z.looseObject({
|
|
8167
8273
|
images: import_zod3.z.number().optional(),
|
|
@@ -8172,6 +8278,13 @@ var ReferenceLimitsSchema = import_zod3.z.looseObject({
|
|
|
8172
8278
|
audioOnly: import_zod3.z.boolean().optional(),
|
|
8173
8279
|
videoSeconds: VideoSecondsLimitsSchema.optional(),
|
|
8174
8280
|
videoPixels: VideoPixelLimitsSchema.optional(),
|
|
8281
|
+
videoFps: VideoFpsLimitsSchema.optional(),
|
|
8282
|
+
videoMaxBytes: import_zod3.z.number().positive().optional(),
|
|
8283
|
+
imagePixels: VideoPixelLimitsSchema.optional(),
|
|
8284
|
+
imageAspect: import_zod3.z.looseObject({
|
|
8285
|
+
min: import_zod3.z.number().positive().optional(),
|
|
8286
|
+
max: import_zod3.z.number().positive().optional()
|
|
8287
|
+
}).optional(),
|
|
8175
8288
|
audioSeconds: import_zod3.z.looseObject({
|
|
8176
8289
|
min: import_zod3.z.number().optional(),
|
|
8177
8290
|
max: import_zod3.z.number().optional(),
|
|
@@ -9271,6 +9384,19 @@ async function generateSeedreamImage(req, ctx) {
|
|
|
9271
9384
|
}
|
|
9272
9385
|
body.output_format = req.outputFormat === "jpeg" ? "jpeg" : "png";
|
|
9273
9386
|
}
|
|
9387
|
+
if (req.background !== void 0) {
|
|
9388
|
+
body.background = req.background;
|
|
9389
|
+
if (req.background === "transparent" && body.output_format === "jpeg") {
|
|
9390
|
+
ctx.warnings.push({
|
|
9391
|
+
code: "option_ignored",
|
|
9392
|
+
field: "outputFormat",
|
|
9393
|
+
from: "jpeg",
|
|
9394
|
+
to: "png",
|
|
9395
|
+
message: `${modelId} returns a transparent background only as png; using png`
|
|
9396
|
+
});
|
|
9397
|
+
body.output_format = "png";
|
|
9398
|
+
}
|
|
9399
|
+
}
|
|
9274
9400
|
const firstRef = refs[0];
|
|
9275
9401
|
if (refs.length === 1 && firstRef !== void 0) body.image = firstRef;
|
|
9276
9402
|
else if (refs.length > 1) body.image = refs;
|
|
@@ -10489,6 +10615,27 @@ var QWEN_EXACT = {
|
|
|
10489
10615
|
maxArea: 2048 * 2048,
|
|
10490
10616
|
multipleOf: 1
|
|
10491
10617
|
};
|
|
10618
|
+
var MINIMAX_H3_IMAGE_EXACT = {
|
|
10619
|
+
minSide: 1,
|
|
10620
|
+
maxSide: 14142,
|
|
10621
|
+
minArea: 655360,
|
|
10622
|
+
maxArea: 4096 * 4096,
|
|
10623
|
+
multipleOf: 1,
|
|
10624
|
+
maxAspect: 3,
|
|
10625
|
+
topTier: "4K"
|
|
10626
|
+
};
|
|
10627
|
+
function minimaxH3ImageSpec(label) {
|
|
10628
|
+
return {
|
|
10629
|
+
label,
|
|
10630
|
+
maxReferences: 16,
|
|
10631
|
+
maxCount: 10,
|
|
10632
|
+
outputFormats: ALL_FORMATS,
|
|
10633
|
+
promptMax: 32e3,
|
|
10634
|
+
promptRequired: true,
|
|
10635
|
+
aspectRatios: WIDE_RATIOS,
|
|
10636
|
+
exactSize: MINIMAX_H3_IMAGE_EXACT
|
|
10637
|
+
};
|
|
10638
|
+
}
|
|
10492
10639
|
var FAL_IMAGE_SPECS = /* @__PURE__ */ new Map([
|
|
10493
10640
|
[
|
|
10494
10641
|
"krea/v3/text-to-image",
|
|
@@ -10530,6 +10677,8 @@ var FAL_IMAGE_SPECS = /* @__PURE__ */ new Map([
|
|
|
10530
10677
|
exactSize: QWEN_EXACT
|
|
10531
10678
|
}
|
|
10532
10679
|
],
|
|
10680
|
+
["minimax/h3-image/text-to-image", minimaxH3ImageSpec("MiniMax H3 Image")],
|
|
10681
|
+
["minimax/h3-image/highspeed/text-to-image", minimaxH3ImageSpec("MiniMax H3 Image Highspeed")],
|
|
10533
10682
|
[
|
|
10534
10683
|
"fal-ai/kling-image/o3/text-to-image",
|
|
10535
10684
|
{
|
|
@@ -10593,6 +10742,7 @@ function falImageSpec(providerModelId) {
|
|
|
10593
10742
|
return FAL_IMAGE_SPECS.get(providerModelId.toLowerCase());
|
|
10594
10743
|
}
|
|
10595
10744
|
var AREA_1K = 1024 * 1024;
|
|
10745
|
+
var AREA_2K = 2048 * 2048;
|
|
10596
10746
|
function checkExactSize(exact, b) {
|
|
10597
10747
|
const match = /^(\d+)x(\d+)$/.exec(exact);
|
|
10598
10748
|
if (match === null) {
|
|
@@ -10604,14 +10754,21 @@ function checkExactSize(exact, b) {
|
|
|
10604
10754
|
const sideOk = [width, height].every(
|
|
10605
10755
|
(side) => side >= b.minSide && side <= b.maxSide && side % b.multipleOf === 0
|
|
10606
10756
|
);
|
|
10607
|
-
|
|
10757
|
+
const aspectOk = b.maxAspect === void 0 || Math.max(width, height) <= b.maxAspect * Math.min(width, height);
|
|
10758
|
+
if (!sideOk || !aspectOk || area < b.minArea || area > b.maxArea) {
|
|
10608
10759
|
const step = b.multipleOf > 1 ? `, multiples of ${b.multipleOf}` : "";
|
|
10760
|
+
const aspectLimit = b.maxAspect === void 0 ? "" : `, at most ${b.maxAspect}:1,`;
|
|
10609
10761
|
return {
|
|
10610
10762
|
ok: false,
|
|
10611
|
-
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}`
|
|
10763
|
+
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}`
|
|
10612
10764
|
};
|
|
10613
10765
|
}
|
|
10614
|
-
return { ok: true, size: { width, height, tier: area
|
|
10766
|
+
return { ok: true, size: { width, height, tier: exactTier(area, b) } };
|
|
10767
|
+
}
|
|
10768
|
+
function exactTier(area, b) {
|
|
10769
|
+
if (area <= AREA_1K) return "1K";
|
|
10770
|
+
if (b.topTier === void 0 || area <= AREA_2K) return "2K";
|
|
10771
|
+
return b.topTier;
|
|
10615
10772
|
}
|
|
10616
10773
|
function unsupported(message) {
|
|
10617
10774
|
return { code: "unsupported_option", message };
|
|
@@ -10817,17 +10974,17 @@ function pick(model, label, field, value, table) {
|
|
|
10817
10974
|
}
|
|
10818
10975
|
return mapped;
|
|
10819
10976
|
}
|
|
10820
|
-
function familyImageSize(model, call) {
|
|
10821
|
-
if (call.exact === void 0) return { dims: sizedDimensions(model, call) };
|
|
10977
|
+
function familyImageSize(model, call, areas = TIER_AREAS) {
|
|
10978
|
+
if (call.exact === void 0) return { dims: sizedDimensions(model, call, areas) };
|
|
10822
10979
|
const { width, height, tier } = call.exact;
|
|
10823
10980
|
return { dims: { width, height }, imageSize: tier };
|
|
10824
10981
|
}
|
|
10825
|
-
function sizedDimensions(model, { label, req }) {
|
|
10982
|
+
function sizedDimensions(model, { label, req }, areas) {
|
|
10826
10983
|
const aspectRatio = req.aspectRatio ?? "1:1";
|
|
10827
10984
|
const size = req.size ?? "1K";
|
|
10828
|
-
pick(model, label, "size", size,
|
|
10985
|
+
pick(model, label, "size", size, areas);
|
|
10829
10986
|
const dims = dimensionsFor(
|
|
10830
|
-
{ field: "image_size", areas: { ...
|
|
10987
|
+
{ field: "image_size", areas: { ...areas }, multipleOf: 16 },
|
|
10831
10988
|
{ prompt: req.prompt, aspectRatio, size }
|
|
10832
10989
|
);
|
|
10833
10990
|
if (dims === void 0) throw fail2(model, `${label} has no size for ${aspectRatio}`);
|
|
@@ -10840,8 +10997,8 @@ function withCommon(input, req, opts) {
|
|
|
10840
10997
|
return input;
|
|
10841
10998
|
}
|
|
10842
10999
|
var AREA_1K2 = 1024 * 1024;
|
|
10843
|
-
var
|
|
10844
|
-
var TIER_AREAS = { "1K": AREA_1K2, "2K":
|
|
11000
|
+
var AREA_2K2 = 2048 * 2048;
|
|
11001
|
+
var TIER_AREAS = { "1K": AREA_1K2, "2K": AREA_2K2 };
|
|
10845
11002
|
var KREA = {
|
|
10846
11003
|
editEndpoint: "krea/v3/edit",
|
|
10847
11004
|
build(call, model) {
|
|
@@ -10899,6 +11056,24 @@ var QWEN = {
|
|
|
10899
11056
|
};
|
|
10900
11057
|
}
|
|
10901
11058
|
};
|
|
11059
|
+
function minimaxH3Image(editEndpoint) {
|
|
11060
|
+
return {
|
|
11061
|
+
editEndpoint,
|
|
11062
|
+
build(call, model) {
|
|
11063
|
+
const { req, refs } = call;
|
|
11064
|
+
const size = familyImageSize(model, call, H3_IMAGE_AREAS);
|
|
11065
|
+
const input = { prompt: req.prompt, image_size: { ...size.dims } };
|
|
11066
|
+
if (refs.length > 0) input["image_urls"] = refs;
|
|
11067
|
+
return {
|
|
11068
|
+
input: withCommon(input, req, { count: true, seed: false }),
|
|
11069
|
+
...size.imageSize !== void 0 && { imageSize: size.imageSize }
|
|
11070
|
+
};
|
|
11071
|
+
}
|
|
11072
|
+
};
|
|
11073
|
+
}
|
|
11074
|
+
var H3_IMAGE_AREAS = { ...TIER_AREAS, "4K": 4096 * 4096 };
|
|
11075
|
+
var MINIMAX_H3_IMAGE = minimaxH3Image("minimax/h3-image/edit");
|
|
11076
|
+
var MINIMAX_H3_IMAGE_HIGHSPEED = minimaxH3Image("minimax/h3-image/highspeed/edit");
|
|
10902
11077
|
function klingImage(editEndpoint, sizes, field) {
|
|
10903
11078
|
return {
|
|
10904
11079
|
editEndpoint,
|
|
@@ -10980,6 +11155,8 @@ var FAMILIES = /* @__PURE__ */ new Map([
|
|
|
10980
11155
|
["krea/v3/text-to-image", KREA],
|
|
10981
11156
|
["xai/grok-imagine-image/v2.0/text-to-image", GROK],
|
|
10982
11157
|
["alibaba/qwen-image-3/text-to-image", QWEN],
|
|
11158
|
+
["minimax/h3-image/text-to-image", MINIMAX_H3_IMAGE],
|
|
11159
|
+
["minimax/h3-image/highspeed/text-to-image", MINIMAX_H3_IMAGE_HIGHSPEED],
|
|
10983
11160
|
["fal-ai/kling-image/o3/text-to-image", KLING_O3],
|
|
10984
11161
|
["fal-ai/kling-image/v3/text-to-image", KLING_V3],
|
|
10985
11162
|
["recraft/v4.1/flash/text-to-image", RECRAFT_FLASH],
|
|
@@ -15851,8 +16028,8 @@ function checkGenerateSeconds(req, ctx) {
|
|
|
15851
16028
|
}
|
|
15852
16029
|
var MAX_PLAUSIBLE_SECONDS = 60;
|
|
15853
16030
|
function editedSeconds(req, bytes) {
|
|
15854
|
-
const
|
|
15855
|
-
const length =
|
|
16031
|
+
const measured2 = mp4DurationSeconds(bytes);
|
|
16032
|
+
const length = measured2 !== void 0 && measured2 > 0 && measured2 <= MAX_PLAUSIBLE_SECONDS ? measured2 : req.sourceVideo?.durationSeconds;
|
|
15856
16033
|
return Math.max(length ?? 0, GENERATE_SECONDS);
|
|
15857
16034
|
}
|
|
15858
16035
|
function videoUsage4(ctx, req, mode, seconds3) {
|
|
@@ -16222,15 +16399,6 @@ var openaiImageAdapter = {
|
|
|
16222
16399
|
});
|
|
16223
16400
|
outputFormat = "png";
|
|
16224
16401
|
}
|
|
16225
|
-
if (isEdit && outputFormat === "svg") {
|
|
16226
|
-
throw new ModelKitError({
|
|
16227
|
-
code: "unsupported_option",
|
|
16228
|
-
message: `${ctx.model.id} cannot make an SVG from reference images`,
|
|
16229
|
-
provider: "openai-image",
|
|
16230
|
-
model: ctx.model.id,
|
|
16231
|
-
retryable: false
|
|
16232
|
-
});
|
|
16233
|
-
}
|
|
16234
16402
|
const svgModel = ctx.model.constraints.svgModel;
|
|
16235
16403
|
if (outputFormat === "svg" && !svgModel) {
|
|
16236
16404
|
throw new ModelKitError({
|
|
@@ -18006,9 +18174,6 @@ function applyImageOutputRules(model, req, onUnsupported, warnings) {
|
|
|
18006
18174
|
}
|
|
18007
18175
|
if (req.outputFormat === "svg") {
|
|
18008
18176
|
if (!c.svgModel) refuse(model, `${model.id} names no svgModel to write the SVG`);
|
|
18009
|
-
if ((req.references ?? []).length > 0) {
|
|
18010
|
-
refuse(model, `${model.label} cannot make an SVG from reference images`);
|
|
18011
|
-
}
|
|
18012
18177
|
if ((req.count ?? 1) > 1) {
|
|
18013
18178
|
if (onUnsupported === "error") {
|
|
18014
18179
|
refuse(model, `${model.label} makes one SVG per call`);
|
|
@@ -18980,6 +19145,126 @@ function resolveVoiceDesignOptions(model, request, onUnsupported = "error") {
|
|
|
18980
19145
|
return { request: resolved, warnings };
|
|
18981
19146
|
}
|
|
18982
19147
|
|
|
19148
|
+
// src/reference-video-conform.ts
|
|
19149
|
+
var REFERENCE_VIDEO_CONFORM_PROFILE = "model-safe-v1";
|
|
19150
|
+
var SHRINK_MARGIN = 0.998;
|
|
19151
|
+
var GROW_MARGIN = 1.002;
|
|
19152
|
+
var LOW_FPS_TARGET = 24;
|
|
19153
|
+
var HIGH_FPS_TARGET = 30;
|
|
19154
|
+
function measured(value) {
|
|
19155
|
+
return value !== void 0 && Number.isFinite(value) && value > 0;
|
|
19156
|
+
}
|
|
19157
|
+
function evenDown(value) {
|
|
19158
|
+
return Math.max(2, Math.floor(value / 2) * 2);
|
|
19159
|
+
}
|
|
19160
|
+
function evenUp(value) {
|
|
19161
|
+
return Math.max(2, Math.ceil(value / 2) * 2);
|
|
19162
|
+
}
|
|
19163
|
+
function sizeFix(limits, width, height) {
|
|
19164
|
+
if (!limits) return null;
|
|
19165
|
+
const pixels = width * height;
|
|
19166
|
+
const long = Math.max(width, height);
|
|
19167
|
+
const shrink = [];
|
|
19168
|
+
const grow = [];
|
|
19169
|
+
const reasons = [];
|
|
19170
|
+
if (limits.maxPixels !== void 0 && pixels > limits.maxPixels) {
|
|
19171
|
+
shrink.push(Math.sqrt(limits.maxPixels / pixels) * SHRINK_MARGIN);
|
|
19172
|
+
reasons.push("pixels_over");
|
|
19173
|
+
}
|
|
19174
|
+
if (limits.maxSide !== void 0 && long > limits.maxSide) {
|
|
19175
|
+
shrink.push(limits.maxSide / long * SHRINK_MARGIN);
|
|
19176
|
+
reasons.push("side_over");
|
|
19177
|
+
}
|
|
19178
|
+
if (shrink.length > 0) return { scale: Math.min(...shrink), up: false, reasons };
|
|
19179
|
+
if (limits.minPixels !== void 0 && pixels < limits.minPixels) {
|
|
19180
|
+
grow.push(Math.sqrt(limits.minPixels / pixels) * GROW_MARGIN);
|
|
19181
|
+
reasons.push("pixels_under");
|
|
19182
|
+
}
|
|
19183
|
+
const sideUnder = [
|
|
19184
|
+
limits.minWidth !== void 0 && width < limits.minWidth ? limits.minWidth / width * GROW_MARGIN : 0,
|
|
19185
|
+
limits.minHeight !== void 0 && height < limits.minHeight ? limits.minHeight / height * GROW_MARGIN : 0
|
|
19186
|
+
].filter((scale) => scale > 0);
|
|
19187
|
+
if (sideUnder.length > 0) {
|
|
19188
|
+
grow.push(...sideUnder);
|
|
19189
|
+
reasons.push("side_under");
|
|
19190
|
+
}
|
|
19191
|
+
if (grow.length > 0) return { scale: Math.max(...grow), up: true, reasons };
|
|
19192
|
+
return null;
|
|
19193
|
+
}
|
|
19194
|
+
function fpsFix(model, fps) {
|
|
19195
|
+
const limits = model.constraints.references?.videoFps;
|
|
19196
|
+
if (!limits || !measured(fps)) return void 0;
|
|
19197
|
+
const inRange = (rate) => (limits.min === void 0 || rate >= limits.min) && (limits.max === void 0 || rate <= limits.max);
|
|
19198
|
+
if (limits.min !== void 0 && fps < limits.min) {
|
|
19199
|
+
const target = inRange(LOW_FPS_TARGET) ? LOW_FPS_TARGET : Math.ceil(limits.min);
|
|
19200
|
+
return { fps: target, reason: "fps_under" };
|
|
19201
|
+
}
|
|
19202
|
+
if (limits.max !== void 0 && fps > limits.max) {
|
|
19203
|
+
const target = inRange(HIGH_FPS_TARGET) ? HIGH_FPS_TARGET : Math.floor(limits.max);
|
|
19204
|
+
return { fps: target, reason: "fps_over" };
|
|
19205
|
+
}
|
|
19206
|
+
return void 0;
|
|
19207
|
+
}
|
|
19208
|
+
function referenceVideoConformPlan(model, probe) {
|
|
19209
|
+
const rate = fpsFix(model, probe.fps);
|
|
19210
|
+
const maxBytes = model.constraints.references?.videoMaxBytes;
|
|
19211
|
+
const overBytes = maxBytes !== void 0 && measured(probe.bytes) && probe.bytes > maxBytes;
|
|
19212
|
+
const { width: probedWidth, height: probedHeight } = probe;
|
|
19213
|
+
if (!measured(probedWidth) || !measured(probedHeight)) return null;
|
|
19214
|
+
const width = Math.round(probedWidth);
|
|
19215
|
+
const height = Math.round(probedHeight);
|
|
19216
|
+
const size = sizeFix(model.constraints.references?.videoPixels, width, height);
|
|
19217
|
+
if (!size && !rate && !overBytes) return null;
|
|
19218
|
+
const round = size?.up ? evenUp : evenDown;
|
|
19219
|
+
const scale = size?.scale ?? 1;
|
|
19220
|
+
const reasons = [...size?.reasons ?? []];
|
|
19221
|
+
if (rate) reasons.push(rate.reason);
|
|
19222
|
+
if (overBytes) reasons.push("bytes_over");
|
|
19223
|
+
const plan4 = {
|
|
19224
|
+
width: round(width * scale),
|
|
19225
|
+
height: round(height * scale),
|
|
19226
|
+
reasons
|
|
19227
|
+
};
|
|
19228
|
+
if (rate) plan4.fps = rate.fps;
|
|
19229
|
+
if (maxBytes !== void 0) plan4.maxBytes = maxBytes;
|
|
19230
|
+
return plan4;
|
|
19231
|
+
}
|
|
19232
|
+
function referenceImageConformPlan(model, probe) {
|
|
19233
|
+
const { width: probedWidth, height: probedHeight } = probe;
|
|
19234
|
+
if (!measured(probedWidth) || !measured(probedHeight)) return null;
|
|
19235
|
+
const references = model.constraints.references;
|
|
19236
|
+
const width = Math.round(probedWidth);
|
|
19237
|
+
const height = Math.round(probedHeight);
|
|
19238
|
+
const reasons = [];
|
|
19239
|
+
let frameWidth = width;
|
|
19240
|
+
let frameHeight = height;
|
|
19241
|
+
const aspect = references?.imageAspect;
|
|
19242
|
+
if (aspect?.min !== void 0 && width / height < aspect.min) {
|
|
19243
|
+
frameWidth = Math.ceil(height * aspect.min);
|
|
19244
|
+
reasons.push("aspect");
|
|
19245
|
+
} else if (aspect?.max !== void 0 && width / height > aspect.max) {
|
|
19246
|
+
frameHeight = Math.ceil(width / aspect.max);
|
|
19247
|
+
reasons.push("aspect");
|
|
19248
|
+
}
|
|
19249
|
+
const size = sizeFix(references?.imagePixels, frameWidth, frameHeight);
|
|
19250
|
+
if (!size && reasons.length === 0) return null;
|
|
19251
|
+
if (size) reasons.push(...size.reasons);
|
|
19252
|
+
const scale = size?.scale ?? 1;
|
|
19253
|
+
const round = size?.up ? Math.ceil : Math.floor;
|
|
19254
|
+
const frame = {
|
|
19255
|
+
width: Math.max(1, round(frameWidth * scale)),
|
|
19256
|
+
height: Math.max(1, round(frameHeight * scale))
|
|
19257
|
+
};
|
|
19258
|
+
const image = frameWidth > width ? {
|
|
19259
|
+
width: Math.max(1, Math.round(frame.height * width / height)),
|
|
19260
|
+
height: frame.height
|
|
19261
|
+
} : frameHeight > height ? {
|
|
19262
|
+
width: frame.width,
|
|
19263
|
+
height: Math.max(1, Math.round(frame.width * height / width))
|
|
19264
|
+
} : { ...frame };
|
|
19265
|
+
return { ...frame, image, reasons };
|
|
19266
|
+
}
|
|
19267
|
+
|
|
18983
19268
|
// src/keys.ts
|
|
18984
19269
|
var ADAPTER_KEYS = {
|
|
18985
19270
|
"ai-sdk-text": [],
|
|
@@ -20463,6 +20748,7 @@ var describe = (modelId) => createDefaultModelKit().describe(modelId);
|
|
|
20463
20748
|
MODEL3D_MODELS,
|
|
20464
20749
|
MODELS,
|
|
20465
20750
|
ModelKitError,
|
|
20751
|
+
REFERENCE_VIDEO_CONFORM_PROFILE,
|
|
20466
20752
|
SURFACES,
|
|
20467
20753
|
SurfaceSchema,
|
|
20468
20754
|
VIDEO_INPUT_SPEC_KEYS,
|
|
@@ -20530,6 +20816,8 @@ var describe = (modelId) => createDefaultModelKit().describe(modelId);
|
|
|
20530
20816
|
primeCatalog,
|
|
20531
20817
|
prodiaAdapter,
|
|
20532
20818
|
readErrorBody,
|
|
20819
|
+
referenceImageConformPlan,
|
|
20820
|
+
referenceVideoConformPlan,
|
|
20533
20821
|
replicateAdapter,
|
|
20534
20822
|
resetLiveCatalog,
|
|
20535
20823
|
resolutionTier,
|