@shop-os/modelkit 0.18.1 → 0.19.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/CHANGELOG.md +54 -0
- package/dist/catalog.cjs +246 -19
- 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 +246 -19
- package/dist/catalog.js.map +1 -1
- package/dist/index.cjs +278 -37
- 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 +275 -37
- 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.
|
|
@@ -3914,7 +3964,7 @@ var MINIMAX_VOICES = [
|
|
|
3914
3964
|
// src/catalog/media-nodes.ts
|
|
3915
3965
|
var ELEVENLABS_LOGO2 = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/elevenlabs.png";
|
|
3916
3966
|
var GOOGLE_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/192485d2-a76a-4657-9c06-930b2c70badd_compressed.png";
|
|
3917
|
-
var
|
|
3967
|
+
var MINIMAX_LOGO2 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
|
|
3918
3968
|
var SYNC_LOGO = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/sync.png";
|
|
3919
3969
|
var PER_CALL3 = { unit: "images" };
|
|
3920
3970
|
var EXPOSURE5 = ["cowork", "space_builder"];
|
|
@@ -4049,7 +4099,7 @@ var MEDIA_NODE_MODELS = [
|
|
|
4049
4099
|
pricingKind: "flat",
|
|
4050
4100
|
display: {
|
|
4051
4101
|
provider: "minimax",
|
|
4052
|
-
logo:
|
|
4102
|
+
logo: MINIMAX_LOGO2,
|
|
4053
4103
|
description: "MiniMax Speech 2.8 HD text to speech; studio-quality narration in over 300 voices, with pause and interjection tags."
|
|
4054
4104
|
},
|
|
4055
4105
|
capabilities: {}
|
|
@@ -4176,7 +4226,7 @@ var MEDIA_NODE_MODELS = [
|
|
|
4176
4226
|
pricingKind: "video_per_second",
|
|
4177
4227
|
display: {
|
|
4178
4228
|
provider: "minimax",
|
|
4179
|
-
logo:
|
|
4229
|
+
logo: MINIMAX_LOGO2,
|
|
4180
4230
|
description: "MiniMax H3 Max lip sync; animates a portrait image into a talking video as long as the speech, up to 2K."
|
|
4181
4231
|
},
|
|
4182
4232
|
capabilities: {}
|
|
@@ -4406,7 +4456,7 @@ var MODEL3D_MODELS = [
|
|
|
4406
4456
|
// src/catalog/other.ts
|
|
4407
4457
|
var GOOGLE_LOGO2 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/192485d2-a76a-4657-9c06-930b2c70badd_compressed.png";
|
|
4408
4458
|
var ELEVENLABS_LOGO3 = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/elevenlabs.png";
|
|
4409
|
-
var
|
|
4459
|
+
var MINIMAX_LOGO3 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
|
|
4410
4460
|
var OTHER_MODELS = [
|
|
4411
4461
|
{
|
|
4412
4462
|
id: "lyria-3-clip-preview",
|
|
@@ -4595,7 +4645,7 @@ var OTHER_MODELS = [
|
|
|
4595
4645
|
pricingKind: "flat",
|
|
4596
4646
|
display: {
|
|
4597
4647
|
provider: "minimax",
|
|
4598
|
-
logo:
|
|
4648
|
+
logo: MINIMAX_LOGO3,
|
|
4599
4649
|
description: "MiniMax Music 3 songs from a style prompt and your lyrics (or instrumental), up to 5 minutes."
|
|
4600
4650
|
},
|
|
4601
4651
|
capabilities: {}
|
|
@@ -5013,6 +5063,7 @@ var TEXT_MODELS = [
|
|
|
5013
5063
|
description: "Anthropic Claude Fable 5 (legacy) model for demanding reasoning and long-horizon agentic work; text and image input, 1M-token context."
|
|
5014
5064
|
},
|
|
5015
5065
|
capabilities: {
|
|
5066
|
+
reasoning: true,
|
|
5016
5067
|
vision: true,
|
|
5017
5068
|
contextWindow: 1e6
|
|
5018
5069
|
}
|
|
@@ -5292,7 +5343,7 @@ var TEXT_MODELS = [
|
|
|
5292
5343
|
var VIDEO_USAGE = { unit: "seconds" };
|
|
5293
5344
|
var MB = 1024 * 1024;
|
|
5294
5345
|
var KLING_LOGO = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/kling-color.png";
|
|
5295
|
-
var
|
|
5346
|
+
var MINIMAX_LOGO4 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
|
|
5296
5347
|
var BYTEDANCE_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/3bba5d81-4e57-4e71-911b-cdfa05acca2c_compressed.png";
|
|
5297
5348
|
var XAI_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/858b7fcc-9bd5-411d-aea1-a7b35ecfffab_compressed.png";
|
|
5298
5349
|
var H3_RATIOS = ["21:9", "16:9", "4:3", "1:1", "3:4", "9:16"];
|
|
@@ -5444,7 +5495,8 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5444
5495
|
images: 10,
|
|
5445
5496
|
videos: 5,
|
|
5446
5497
|
videoSeconds: { min: 3, max: 30.05, total: 30 },
|
|
5447
|
-
videoPixels: { minWidth: 700, minHeight: 700 }
|
|
5498
|
+
videoPixels: { minWidth: 700, minHeight: 700 },
|
|
5499
|
+
videoFps: { min: 23.9, max: 60.05 }
|
|
5448
5500
|
},
|
|
5449
5501
|
supports: ["lastFrame"],
|
|
5450
5502
|
prompt: KLING_V4_PROMPT,
|
|
@@ -5610,7 +5662,7 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5610
5662
|
pricingKind: "video_per_second",
|
|
5611
5663
|
display: {
|
|
5612
5664
|
provider: "minimax",
|
|
5613
|
-
logo:
|
|
5665
|
+
logo: MINIMAX_LOGO4,
|
|
5614
5666
|
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."
|
|
5615
5667
|
},
|
|
5616
5668
|
capabilities: {}
|
|
@@ -5640,7 +5692,7 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5640
5692
|
pricingKind: "video_per_second",
|
|
5641
5693
|
display: {
|
|
5642
5694
|
provider: "minimax",
|
|
5643
|
-
logo:
|
|
5695
|
+
logo: MINIMAX_LOGO4,
|
|
5644
5696
|
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."
|
|
5645
5697
|
},
|
|
5646
5698
|
capabilities: { acceptsSourceVideo: true, videoEdit: true }
|
|
@@ -5669,7 +5721,7 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5669
5721
|
pricingKind: "video_per_second",
|
|
5670
5722
|
display: {
|
|
5671
5723
|
provider: "minimax",
|
|
5672
|
-
logo:
|
|
5724
|
+
logo: MINIMAX_LOGO4,
|
|
5673
5725
|
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."
|
|
5674
5726
|
},
|
|
5675
5727
|
capabilities: { acceptsSourceVideo: true, videoEdit: true }
|
|
@@ -5700,7 +5752,7 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5700
5752
|
pricingKind: "video_per_second",
|
|
5701
5753
|
display: {
|
|
5702
5754
|
provider: "minimax",
|
|
5703
|
-
logo:
|
|
5755
|
+
logo: MINIMAX_LOGO4,
|
|
5704
5756
|
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."
|
|
5705
5757
|
},
|
|
5706
5758
|
capabilities: { acceptsSourceVideo: true, videoEdit: true }
|
|
@@ -6012,6 +6064,11 @@ var SEEDANCE_2_AUDIO = {
|
|
|
6012
6064
|
audioFormats: ["wav", "mp3"],
|
|
6013
6065
|
audioMaxBytes: 15 * 1024 * 1024
|
|
6014
6066
|
};
|
|
6067
|
+
var SEEDANCE_REFERENCE_MEDIA = {
|
|
6068
|
+
videoPixels: { minPixels: 407696, maxPixels: 8295044 },
|
|
6069
|
+
videoFps: { min: 23.8, max: 60 },
|
|
6070
|
+
imagePixels: { minPixels: 9e4 }
|
|
6071
|
+
};
|
|
6015
6072
|
var H3_PROMPT2 = { referenceSyntax: "numbered", maxChars: 5e4 };
|
|
6016
6073
|
var WAN_PROMPT = { referenceSyntax: "numbered", maxChars: 2e4 };
|
|
6017
6074
|
var OMNI_PROMPT = { referenceSyntax: "caption", maxChars: 5e4 };
|
|
@@ -6256,6 +6313,7 @@ var VIDEO_MODELS = [
|
|
|
6256
6313
|
audios: 3,
|
|
6257
6314
|
audioOnly: false,
|
|
6258
6315
|
videoSeconds: { min: 2, max: 15, total: 15 },
|
|
6316
|
+
...SEEDANCE_REFERENCE_MEDIA,
|
|
6259
6317
|
...SEEDANCE_2_AUDIO
|
|
6260
6318
|
},
|
|
6261
6319
|
sourceVideoSeconds: { min: 2, max: 15, inReferenceTotal: true },
|
|
@@ -6299,6 +6357,7 @@ var VIDEO_MODELS = [
|
|
|
6299
6357
|
audios: 3,
|
|
6300
6358
|
audioOnly: false,
|
|
6301
6359
|
videoSeconds: { min: 2, max: 15, total: 15 },
|
|
6360
|
+
...SEEDANCE_REFERENCE_MEDIA,
|
|
6302
6361
|
...SEEDANCE_2_AUDIO
|
|
6303
6362
|
},
|
|
6304
6363
|
sourceVideoSeconds: { min: 2, max: 15, inReferenceTotal: true },
|
|
@@ -6342,6 +6401,7 @@ var VIDEO_MODELS = [
|
|
|
6342
6401
|
videos: 10,
|
|
6343
6402
|
audios: 10,
|
|
6344
6403
|
videoSeconds: { min: 2, max: 30, total: 30, editMin: 4 },
|
|
6404
|
+
...SEEDANCE_REFERENCE_MEDIA,
|
|
6345
6405
|
// BytePlus: 2-30 s per clip, 30 s in all, wav/mp3, 15 MB each.
|
|
6346
6406
|
audioSeconds: { min: 2, max: 30, total: 30 },
|
|
6347
6407
|
audioFormats: ["wav", "mp3"],
|
|
@@ -6490,7 +6550,12 @@ var VIDEO_MODELS = [
|
|
|
6490
6550
|
prompt: KLING_PROMPT2,
|
|
6491
6551
|
audio: "optional"
|
|
6492
6552
|
},
|
|
6493
|
-
defaults: {
|
|
6553
|
+
defaults: {
|
|
6554
|
+
durationSeconds: 5,
|
|
6555
|
+
aspectRatio: "16:9",
|
|
6556
|
+
generateAudio: true,
|
|
6557
|
+
mode: "standard"
|
|
6558
|
+
},
|
|
6494
6559
|
usage: { ...VIDEO_USAGE3 },
|
|
6495
6560
|
pricingKind: "video_per_second",
|
|
6496
6561
|
display: {
|
|
@@ -8155,7 +8220,14 @@ var VideoSecondsLimitsSchema = import_zod3.z.looseObject({
|
|
|
8155
8220
|
});
|
|
8156
8221
|
var VideoPixelLimitsSchema = import_zod3.z.looseObject({
|
|
8157
8222
|
minWidth: import_zod3.z.number().int().positive().optional(),
|
|
8158
|
-
minHeight: import_zod3.z.number().int().positive().optional()
|
|
8223
|
+
minHeight: import_zod3.z.number().int().positive().optional(),
|
|
8224
|
+
minPixels: import_zod3.z.number().int().positive().optional(),
|
|
8225
|
+
maxPixels: import_zod3.z.number().int().positive().optional(),
|
|
8226
|
+
maxSide: import_zod3.z.number().int().positive().optional()
|
|
8227
|
+
});
|
|
8228
|
+
var VideoFpsLimitsSchema = import_zod3.z.looseObject({
|
|
8229
|
+
min: import_zod3.z.number().positive().optional(),
|
|
8230
|
+
max: import_zod3.z.number().positive().optional()
|
|
8159
8231
|
});
|
|
8160
8232
|
var ReferenceLimitsSchema = import_zod3.z.looseObject({
|
|
8161
8233
|
images: import_zod3.z.number().optional(),
|
|
@@ -8166,6 +8238,13 @@ var ReferenceLimitsSchema = import_zod3.z.looseObject({
|
|
|
8166
8238
|
audioOnly: import_zod3.z.boolean().optional(),
|
|
8167
8239
|
videoSeconds: VideoSecondsLimitsSchema.optional(),
|
|
8168
8240
|
videoPixels: VideoPixelLimitsSchema.optional(),
|
|
8241
|
+
videoFps: VideoFpsLimitsSchema.optional(),
|
|
8242
|
+
videoMaxBytes: import_zod3.z.number().positive().optional(),
|
|
8243
|
+
imagePixels: VideoPixelLimitsSchema.optional(),
|
|
8244
|
+
imageAspect: import_zod3.z.looseObject({
|
|
8245
|
+
min: import_zod3.z.number().positive().optional(),
|
|
8246
|
+
max: import_zod3.z.number().positive().optional()
|
|
8247
|
+
}).optional(),
|
|
8169
8248
|
audioSeconds: import_zod3.z.looseObject({
|
|
8170
8249
|
min: import_zod3.z.number().optional(),
|
|
8171
8250
|
max: import_zod3.z.number().optional(),
|
|
@@ -10483,6 +10562,27 @@ var QWEN_EXACT = {
|
|
|
10483
10562
|
maxArea: 2048 * 2048,
|
|
10484
10563
|
multipleOf: 1
|
|
10485
10564
|
};
|
|
10565
|
+
var MINIMAX_H3_IMAGE_EXACT = {
|
|
10566
|
+
minSide: 1,
|
|
10567
|
+
maxSide: 14142,
|
|
10568
|
+
minArea: 655360,
|
|
10569
|
+
maxArea: 4096 * 4096,
|
|
10570
|
+
multipleOf: 1,
|
|
10571
|
+
maxAspect: 3,
|
|
10572
|
+
topTier: "4K"
|
|
10573
|
+
};
|
|
10574
|
+
function minimaxH3ImageSpec(label) {
|
|
10575
|
+
return {
|
|
10576
|
+
label,
|
|
10577
|
+
maxReferences: 16,
|
|
10578
|
+
maxCount: 10,
|
|
10579
|
+
outputFormats: ALL_FORMATS,
|
|
10580
|
+
promptMax: 32e3,
|
|
10581
|
+
promptRequired: true,
|
|
10582
|
+
aspectRatios: WIDE_RATIOS,
|
|
10583
|
+
exactSize: MINIMAX_H3_IMAGE_EXACT
|
|
10584
|
+
};
|
|
10585
|
+
}
|
|
10486
10586
|
var FAL_IMAGE_SPECS = /* @__PURE__ */ new Map([
|
|
10487
10587
|
[
|
|
10488
10588
|
"krea/v3/text-to-image",
|
|
@@ -10524,6 +10624,8 @@ var FAL_IMAGE_SPECS = /* @__PURE__ */ new Map([
|
|
|
10524
10624
|
exactSize: QWEN_EXACT
|
|
10525
10625
|
}
|
|
10526
10626
|
],
|
|
10627
|
+
["minimax/h3-image/text-to-image", minimaxH3ImageSpec("MiniMax H3 Image")],
|
|
10628
|
+
["minimax/h3-image/highspeed/text-to-image", minimaxH3ImageSpec("MiniMax H3 Image Highspeed")],
|
|
10527
10629
|
[
|
|
10528
10630
|
"fal-ai/kling-image/o3/text-to-image",
|
|
10529
10631
|
{
|
|
@@ -10587,6 +10689,7 @@ function falImageSpec(providerModelId) {
|
|
|
10587
10689
|
return FAL_IMAGE_SPECS.get(providerModelId.toLowerCase());
|
|
10588
10690
|
}
|
|
10589
10691
|
var AREA_1K = 1024 * 1024;
|
|
10692
|
+
var AREA_2K = 2048 * 2048;
|
|
10590
10693
|
function checkExactSize(exact, b) {
|
|
10591
10694
|
const match = /^(\d+)x(\d+)$/.exec(exact);
|
|
10592
10695
|
if (match === null) {
|
|
@@ -10598,14 +10701,21 @@ function checkExactSize(exact, b) {
|
|
|
10598
10701
|
const sideOk = [width, height].every(
|
|
10599
10702
|
(side) => side >= b.minSide && side <= b.maxSide && side % b.multipleOf === 0
|
|
10600
10703
|
);
|
|
10601
|
-
|
|
10704
|
+
const aspectOk = b.maxAspect === void 0 || Math.max(width, height) <= b.maxAspect * Math.min(width, height);
|
|
10705
|
+
if (!sideOk || !aspectOk || area < b.minArea || area > b.maxArea) {
|
|
10602
10706
|
const step = b.multipleOf > 1 ? `, multiples of ${b.multipleOf}` : "";
|
|
10707
|
+
const aspectLimit = b.maxAspect === void 0 ? "" : `, at most ${b.maxAspect}:1,`;
|
|
10603
10708
|
return {
|
|
10604
10709
|
ok: false,
|
|
10605
|
-
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}`
|
|
10710
|
+
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}`
|
|
10606
10711
|
};
|
|
10607
10712
|
}
|
|
10608
|
-
return { ok: true, size: { width, height, tier: area
|
|
10713
|
+
return { ok: true, size: { width, height, tier: exactTier(area, b) } };
|
|
10714
|
+
}
|
|
10715
|
+
function exactTier(area, b) {
|
|
10716
|
+
if (area <= AREA_1K) return "1K";
|
|
10717
|
+
if (b.topTier === void 0 || area <= AREA_2K) return "2K";
|
|
10718
|
+
return b.topTier;
|
|
10609
10719
|
}
|
|
10610
10720
|
function unsupported(message) {
|
|
10611
10721
|
return { code: "unsupported_option", message };
|
|
@@ -10811,17 +10921,17 @@ function pick(model, label, field, value, table) {
|
|
|
10811
10921
|
}
|
|
10812
10922
|
return mapped;
|
|
10813
10923
|
}
|
|
10814
|
-
function familyImageSize(model, call) {
|
|
10815
|
-
if (call.exact === void 0) return { dims: sizedDimensions(model, call) };
|
|
10924
|
+
function familyImageSize(model, call, areas = TIER_AREAS) {
|
|
10925
|
+
if (call.exact === void 0) return { dims: sizedDimensions(model, call, areas) };
|
|
10816
10926
|
const { width, height, tier } = call.exact;
|
|
10817
10927
|
return { dims: { width, height }, imageSize: tier };
|
|
10818
10928
|
}
|
|
10819
|
-
function sizedDimensions(model, { label, req }) {
|
|
10929
|
+
function sizedDimensions(model, { label, req }, areas) {
|
|
10820
10930
|
const aspectRatio = req.aspectRatio ?? "1:1";
|
|
10821
10931
|
const size = req.size ?? "1K";
|
|
10822
|
-
pick(model, label, "size", size,
|
|
10932
|
+
pick(model, label, "size", size, areas);
|
|
10823
10933
|
const dims = dimensionsFor(
|
|
10824
|
-
{ field: "image_size", areas: { ...
|
|
10934
|
+
{ field: "image_size", areas: { ...areas }, multipleOf: 16 },
|
|
10825
10935
|
{ prompt: req.prompt, aspectRatio, size }
|
|
10826
10936
|
);
|
|
10827
10937
|
if (dims === void 0) throw fail2(model, `${label} has no size for ${aspectRatio}`);
|
|
@@ -10834,8 +10944,8 @@ function withCommon(input, req, opts) {
|
|
|
10834
10944
|
return input;
|
|
10835
10945
|
}
|
|
10836
10946
|
var AREA_1K2 = 1024 * 1024;
|
|
10837
|
-
var
|
|
10838
|
-
var TIER_AREAS = { "1K": AREA_1K2, "2K":
|
|
10947
|
+
var AREA_2K2 = 2048 * 2048;
|
|
10948
|
+
var TIER_AREAS = { "1K": AREA_1K2, "2K": AREA_2K2 };
|
|
10839
10949
|
var KREA = {
|
|
10840
10950
|
editEndpoint: "krea/v3/edit",
|
|
10841
10951
|
build(call, model) {
|
|
@@ -10893,6 +11003,24 @@ var QWEN = {
|
|
|
10893
11003
|
};
|
|
10894
11004
|
}
|
|
10895
11005
|
};
|
|
11006
|
+
function minimaxH3Image(editEndpoint) {
|
|
11007
|
+
return {
|
|
11008
|
+
editEndpoint,
|
|
11009
|
+
build(call, model) {
|
|
11010
|
+
const { req, refs } = call;
|
|
11011
|
+
const size = familyImageSize(model, call, H3_IMAGE_AREAS);
|
|
11012
|
+
const input = { prompt: req.prompt, image_size: { ...size.dims } };
|
|
11013
|
+
if (refs.length > 0) input["image_urls"] = refs;
|
|
11014
|
+
return {
|
|
11015
|
+
input: withCommon(input, req, { count: true, seed: false }),
|
|
11016
|
+
...size.imageSize !== void 0 && { imageSize: size.imageSize }
|
|
11017
|
+
};
|
|
11018
|
+
}
|
|
11019
|
+
};
|
|
11020
|
+
}
|
|
11021
|
+
var H3_IMAGE_AREAS = { ...TIER_AREAS, "4K": 4096 * 4096 };
|
|
11022
|
+
var MINIMAX_H3_IMAGE = minimaxH3Image("minimax/h3-image/edit");
|
|
11023
|
+
var MINIMAX_H3_IMAGE_HIGHSPEED = minimaxH3Image("minimax/h3-image/highspeed/edit");
|
|
10896
11024
|
function klingImage(editEndpoint, sizes, field) {
|
|
10897
11025
|
return {
|
|
10898
11026
|
editEndpoint,
|
|
@@ -10974,6 +11102,8 @@ var FAMILIES = /* @__PURE__ */ new Map([
|
|
|
10974
11102
|
["krea/v3/text-to-image", KREA],
|
|
10975
11103
|
["xai/grok-imagine-image/v2.0/text-to-image", GROK],
|
|
10976
11104
|
["alibaba/qwen-image-3/text-to-image", QWEN],
|
|
11105
|
+
["minimax/h3-image/text-to-image", MINIMAX_H3_IMAGE],
|
|
11106
|
+
["minimax/h3-image/highspeed/text-to-image", MINIMAX_H3_IMAGE_HIGHSPEED],
|
|
10977
11107
|
["fal-ai/kling-image/o3/text-to-image", KLING_O3],
|
|
10978
11108
|
["fal-ai/kling-image/v3/text-to-image", KLING_V3],
|
|
10979
11109
|
["recraft/v4.1/flash/text-to-image", RECRAFT_FLASH],
|
|
@@ -15845,8 +15975,8 @@ function checkGenerateSeconds(req, ctx) {
|
|
|
15845
15975
|
}
|
|
15846
15976
|
var MAX_PLAUSIBLE_SECONDS = 60;
|
|
15847
15977
|
function editedSeconds(req, bytes) {
|
|
15848
|
-
const
|
|
15849
|
-
const length =
|
|
15978
|
+
const measured2 = mp4DurationSeconds(bytes);
|
|
15979
|
+
const length = measured2 !== void 0 && measured2 > 0 && measured2 <= MAX_PLAUSIBLE_SECONDS ? measured2 : req.sourceVideo?.durationSeconds;
|
|
15850
15980
|
return Math.max(length ?? 0, GENERATE_SECONDS);
|
|
15851
15981
|
}
|
|
15852
15982
|
function videoUsage4(ctx, req, mode, seconds3) {
|
|
@@ -16216,15 +16346,6 @@ var openaiImageAdapter = {
|
|
|
16216
16346
|
});
|
|
16217
16347
|
outputFormat = "png";
|
|
16218
16348
|
}
|
|
16219
|
-
if (isEdit && outputFormat === "svg") {
|
|
16220
|
-
throw new ModelKitError({
|
|
16221
|
-
code: "unsupported_option",
|
|
16222
|
-
message: `${ctx.model.id} cannot make an SVG from reference images`,
|
|
16223
|
-
provider: "openai-image",
|
|
16224
|
-
model: ctx.model.id,
|
|
16225
|
-
retryable: false
|
|
16226
|
-
});
|
|
16227
|
-
}
|
|
16228
16349
|
const svgModel = ctx.model.constraints.svgModel;
|
|
16229
16350
|
if (outputFormat === "svg" && !svgModel) {
|
|
16230
16351
|
throw new ModelKitError({
|
|
@@ -18000,9 +18121,6 @@ function applyImageOutputRules(model, req, onUnsupported, warnings) {
|
|
|
18000
18121
|
}
|
|
18001
18122
|
if (req.outputFormat === "svg") {
|
|
18002
18123
|
if (!c.svgModel) refuse(model, `${model.id} names no svgModel to write the SVG`);
|
|
18003
|
-
if ((req.references ?? []).length > 0) {
|
|
18004
|
-
refuse(model, `${model.label} cannot make an SVG from reference images`);
|
|
18005
|
-
}
|
|
18006
18124
|
if ((req.count ?? 1) > 1) {
|
|
18007
18125
|
if (onUnsupported === "error") {
|
|
18008
18126
|
refuse(model, `${model.label} makes one SVG per call`);
|
|
@@ -18974,6 +19092,126 @@ function resolveVoiceDesignOptions(model, request, onUnsupported = "error") {
|
|
|
18974
19092
|
return { request: resolved, warnings };
|
|
18975
19093
|
}
|
|
18976
19094
|
|
|
19095
|
+
// src/reference-video-conform.ts
|
|
19096
|
+
var REFERENCE_VIDEO_CONFORM_PROFILE = "model-safe-v1";
|
|
19097
|
+
var SHRINK_MARGIN = 0.998;
|
|
19098
|
+
var GROW_MARGIN = 1.002;
|
|
19099
|
+
var LOW_FPS_TARGET = 24;
|
|
19100
|
+
var HIGH_FPS_TARGET = 30;
|
|
19101
|
+
function measured(value) {
|
|
19102
|
+
return value !== void 0 && Number.isFinite(value) && value > 0;
|
|
19103
|
+
}
|
|
19104
|
+
function evenDown(value) {
|
|
19105
|
+
return Math.max(2, Math.floor(value / 2) * 2);
|
|
19106
|
+
}
|
|
19107
|
+
function evenUp(value) {
|
|
19108
|
+
return Math.max(2, Math.ceil(value / 2) * 2);
|
|
19109
|
+
}
|
|
19110
|
+
function sizeFix(limits, width, height) {
|
|
19111
|
+
if (!limits) return null;
|
|
19112
|
+
const pixels = width * height;
|
|
19113
|
+
const long = Math.max(width, height);
|
|
19114
|
+
const shrink = [];
|
|
19115
|
+
const grow = [];
|
|
19116
|
+
const reasons = [];
|
|
19117
|
+
if (limits.maxPixels !== void 0 && pixels > limits.maxPixels) {
|
|
19118
|
+
shrink.push(Math.sqrt(limits.maxPixels / pixels) * SHRINK_MARGIN);
|
|
19119
|
+
reasons.push("pixels_over");
|
|
19120
|
+
}
|
|
19121
|
+
if (limits.maxSide !== void 0 && long > limits.maxSide) {
|
|
19122
|
+
shrink.push(limits.maxSide / long * SHRINK_MARGIN);
|
|
19123
|
+
reasons.push("side_over");
|
|
19124
|
+
}
|
|
19125
|
+
if (shrink.length > 0) return { scale: Math.min(...shrink), up: false, reasons };
|
|
19126
|
+
if (limits.minPixels !== void 0 && pixels < limits.minPixels) {
|
|
19127
|
+
grow.push(Math.sqrt(limits.minPixels / pixels) * GROW_MARGIN);
|
|
19128
|
+
reasons.push("pixels_under");
|
|
19129
|
+
}
|
|
19130
|
+
const sideUnder = [
|
|
19131
|
+
limits.minWidth !== void 0 && width < limits.minWidth ? limits.minWidth / width * GROW_MARGIN : 0,
|
|
19132
|
+
limits.minHeight !== void 0 && height < limits.minHeight ? limits.minHeight / height * GROW_MARGIN : 0
|
|
19133
|
+
].filter((scale) => scale > 0);
|
|
19134
|
+
if (sideUnder.length > 0) {
|
|
19135
|
+
grow.push(...sideUnder);
|
|
19136
|
+
reasons.push("side_under");
|
|
19137
|
+
}
|
|
19138
|
+
if (grow.length > 0) return { scale: Math.max(...grow), up: true, reasons };
|
|
19139
|
+
return null;
|
|
19140
|
+
}
|
|
19141
|
+
function fpsFix(model, fps) {
|
|
19142
|
+
const limits = model.constraints.references?.videoFps;
|
|
19143
|
+
if (!limits || !measured(fps)) return void 0;
|
|
19144
|
+
const inRange = (rate) => (limits.min === void 0 || rate >= limits.min) && (limits.max === void 0 || rate <= limits.max);
|
|
19145
|
+
if (limits.min !== void 0 && fps < limits.min) {
|
|
19146
|
+
const target = inRange(LOW_FPS_TARGET) ? LOW_FPS_TARGET : Math.ceil(limits.min);
|
|
19147
|
+
return { fps: target, reason: "fps_under" };
|
|
19148
|
+
}
|
|
19149
|
+
if (limits.max !== void 0 && fps > limits.max) {
|
|
19150
|
+
const target = inRange(HIGH_FPS_TARGET) ? HIGH_FPS_TARGET : Math.floor(limits.max);
|
|
19151
|
+
return { fps: target, reason: "fps_over" };
|
|
19152
|
+
}
|
|
19153
|
+
return void 0;
|
|
19154
|
+
}
|
|
19155
|
+
function referenceVideoConformPlan(model, probe) {
|
|
19156
|
+
const rate = fpsFix(model, probe.fps);
|
|
19157
|
+
const maxBytes = model.constraints.references?.videoMaxBytes;
|
|
19158
|
+
const overBytes = maxBytes !== void 0 && measured(probe.bytes) && probe.bytes > maxBytes;
|
|
19159
|
+
const { width: probedWidth, height: probedHeight } = probe;
|
|
19160
|
+
if (!measured(probedWidth) || !measured(probedHeight)) return null;
|
|
19161
|
+
const width = Math.round(probedWidth);
|
|
19162
|
+
const height = Math.round(probedHeight);
|
|
19163
|
+
const size = sizeFix(model.constraints.references?.videoPixels, width, height);
|
|
19164
|
+
if (!size && !rate && !overBytes) return null;
|
|
19165
|
+
const round = size?.up ? evenUp : evenDown;
|
|
19166
|
+
const scale = size?.scale ?? 1;
|
|
19167
|
+
const reasons = [...size?.reasons ?? []];
|
|
19168
|
+
if (rate) reasons.push(rate.reason);
|
|
19169
|
+
if (overBytes) reasons.push("bytes_over");
|
|
19170
|
+
const plan4 = {
|
|
19171
|
+
width: round(width * scale),
|
|
19172
|
+
height: round(height * scale),
|
|
19173
|
+
reasons
|
|
19174
|
+
};
|
|
19175
|
+
if (rate) plan4.fps = rate.fps;
|
|
19176
|
+
if (maxBytes !== void 0) plan4.maxBytes = maxBytes;
|
|
19177
|
+
return plan4;
|
|
19178
|
+
}
|
|
19179
|
+
function referenceImageConformPlan(model, probe) {
|
|
19180
|
+
const { width: probedWidth, height: probedHeight } = probe;
|
|
19181
|
+
if (!measured(probedWidth) || !measured(probedHeight)) return null;
|
|
19182
|
+
const references = model.constraints.references;
|
|
19183
|
+
const width = Math.round(probedWidth);
|
|
19184
|
+
const height = Math.round(probedHeight);
|
|
19185
|
+
const reasons = [];
|
|
19186
|
+
let frameWidth = width;
|
|
19187
|
+
let frameHeight = height;
|
|
19188
|
+
const aspect = references?.imageAspect;
|
|
19189
|
+
if (aspect?.min !== void 0 && width / height < aspect.min) {
|
|
19190
|
+
frameWidth = Math.ceil(height * aspect.min);
|
|
19191
|
+
reasons.push("aspect");
|
|
19192
|
+
} else if (aspect?.max !== void 0 && width / height > aspect.max) {
|
|
19193
|
+
frameHeight = Math.ceil(width / aspect.max);
|
|
19194
|
+
reasons.push("aspect");
|
|
19195
|
+
}
|
|
19196
|
+
const size = sizeFix(references?.imagePixels, frameWidth, frameHeight);
|
|
19197
|
+
if (!size && reasons.length === 0) return null;
|
|
19198
|
+
if (size) reasons.push(...size.reasons);
|
|
19199
|
+
const scale = size?.scale ?? 1;
|
|
19200
|
+
const round = size?.up ? Math.ceil : Math.floor;
|
|
19201
|
+
const frame = {
|
|
19202
|
+
width: Math.max(1, round(frameWidth * scale)),
|
|
19203
|
+
height: Math.max(1, round(frameHeight * scale))
|
|
19204
|
+
};
|
|
19205
|
+
const image = frameWidth > width ? {
|
|
19206
|
+
width: Math.max(1, Math.round(frame.height * width / height)),
|
|
19207
|
+
height: frame.height
|
|
19208
|
+
} : frameHeight > height ? {
|
|
19209
|
+
width: frame.width,
|
|
19210
|
+
height: Math.max(1, Math.round(frame.width * height / width))
|
|
19211
|
+
} : { ...frame };
|
|
19212
|
+
return { ...frame, image, reasons };
|
|
19213
|
+
}
|
|
19214
|
+
|
|
18977
19215
|
// src/keys.ts
|
|
18978
19216
|
var ADAPTER_KEYS = {
|
|
18979
19217
|
"ai-sdk-text": [],
|
|
@@ -20457,6 +20695,7 @@ var describe = (modelId) => createDefaultModelKit().describe(modelId);
|
|
|
20457
20695
|
MODEL3D_MODELS,
|
|
20458
20696
|
MODELS,
|
|
20459
20697
|
ModelKitError,
|
|
20698
|
+
REFERENCE_VIDEO_CONFORM_PROFILE,
|
|
20460
20699
|
SURFACES,
|
|
20461
20700
|
SurfaceSchema,
|
|
20462
20701
|
VIDEO_INPUT_SPEC_KEYS,
|
|
@@ -20524,6 +20763,8 @@ var describe = (modelId) => createDefaultModelKit().describe(modelId);
|
|
|
20524
20763
|
primeCatalog,
|
|
20525
20764
|
prodiaAdapter,
|
|
20526
20765
|
readErrorBody,
|
|
20766
|
+
referenceImageConformPlan,
|
|
20767
|
+
referenceVideoConformPlan,
|
|
20527
20768
|
replicateAdapter,
|
|
20528
20769
|
resetLiveCatalog,
|
|
20529
20770
|
resolutionTier,
|