@shop-os/modelkit 0.18.2 → 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 +42 -0
- package/dist/catalog.cjs +239 -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 +239 -18
- package/dist/catalog.js.map +1 -1
- package/dist/index.cjs +271 -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 +268 -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.
|
|
@@ -3764,7 +3811,7 @@ var MINIMAX_VOICES = [
|
|
|
3764
3811
|
// src/catalog/media-nodes.ts
|
|
3765
3812
|
var ELEVENLABS_LOGO2 = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/elevenlabs.png";
|
|
3766
3813
|
var GOOGLE_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/192485d2-a76a-4657-9c06-930b2c70badd_compressed.png";
|
|
3767
|
-
var
|
|
3814
|
+
var MINIMAX_LOGO2 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
|
|
3768
3815
|
var SYNC_LOGO = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/sync.png";
|
|
3769
3816
|
var PER_CALL3 = { unit: "images" };
|
|
3770
3817
|
var EXPOSURE5 = ["cowork", "space_builder"];
|
|
@@ -3899,7 +3946,7 @@ var MEDIA_NODE_MODELS = [
|
|
|
3899
3946
|
pricingKind: "flat",
|
|
3900
3947
|
display: {
|
|
3901
3948
|
provider: "minimax",
|
|
3902
|
-
logo:
|
|
3949
|
+
logo: MINIMAX_LOGO2,
|
|
3903
3950
|
description: "MiniMax Speech 2.8 HD text to speech; studio-quality narration in over 300 voices, with pause and interjection tags."
|
|
3904
3951
|
},
|
|
3905
3952
|
capabilities: {}
|
|
@@ -4026,7 +4073,7 @@ var MEDIA_NODE_MODELS = [
|
|
|
4026
4073
|
pricingKind: "video_per_second",
|
|
4027
4074
|
display: {
|
|
4028
4075
|
provider: "minimax",
|
|
4029
|
-
logo:
|
|
4076
|
+
logo: MINIMAX_LOGO2,
|
|
4030
4077
|
description: "MiniMax H3 Max lip sync; animates a portrait image into a talking video as long as the speech, up to 2K."
|
|
4031
4078
|
},
|
|
4032
4079
|
capabilities: {}
|
|
@@ -4256,7 +4303,7 @@ var MODEL3D_MODELS = [
|
|
|
4256
4303
|
// src/catalog/other.ts
|
|
4257
4304
|
var GOOGLE_LOGO2 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/192485d2-a76a-4657-9c06-930b2c70badd_compressed.png";
|
|
4258
4305
|
var ELEVENLABS_LOGO3 = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/elevenlabs.png";
|
|
4259
|
-
var
|
|
4306
|
+
var MINIMAX_LOGO3 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
|
|
4260
4307
|
var OTHER_MODELS = [
|
|
4261
4308
|
{
|
|
4262
4309
|
id: "lyria-3-clip-preview",
|
|
@@ -4445,7 +4492,7 @@ var OTHER_MODELS = [
|
|
|
4445
4492
|
pricingKind: "flat",
|
|
4446
4493
|
display: {
|
|
4447
4494
|
provider: "minimax",
|
|
4448
|
-
logo:
|
|
4495
|
+
logo: MINIMAX_LOGO3,
|
|
4449
4496
|
description: "MiniMax Music 3 songs from a style prompt and your lyrics (or instrumental), up to 5 minutes."
|
|
4450
4497
|
},
|
|
4451
4498
|
capabilities: {}
|
|
@@ -5143,7 +5190,7 @@ var TEXT_MODELS = [
|
|
|
5143
5190
|
var VIDEO_USAGE = { unit: "seconds" };
|
|
5144
5191
|
var MB = 1024 * 1024;
|
|
5145
5192
|
var KLING_LOGO = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/kling-color.png";
|
|
5146
|
-
var
|
|
5193
|
+
var MINIMAX_LOGO4 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
|
|
5147
5194
|
var BYTEDANCE_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/3bba5d81-4e57-4e71-911b-cdfa05acca2c_compressed.png";
|
|
5148
5195
|
var XAI_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/858b7fcc-9bd5-411d-aea1-a7b35ecfffab_compressed.png";
|
|
5149
5196
|
var H3_RATIOS = ["21:9", "16:9", "4:3", "1:1", "3:4", "9:16"];
|
|
@@ -5295,7 +5342,8 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5295
5342
|
images: 10,
|
|
5296
5343
|
videos: 5,
|
|
5297
5344
|
videoSeconds: { min: 3, max: 30.05, total: 30 },
|
|
5298
|
-
videoPixels: { minWidth: 700, minHeight: 700 }
|
|
5345
|
+
videoPixels: { minWidth: 700, minHeight: 700 },
|
|
5346
|
+
videoFps: { min: 23.9, max: 60.05 }
|
|
5299
5347
|
},
|
|
5300
5348
|
supports: ["lastFrame"],
|
|
5301
5349
|
prompt: KLING_V4_PROMPT,
|
|
@@ -5461,7 +5509,7 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5461
5509
|
pricingKind: "video_per_second",
|
|
5462
5510
|
display: {
|
|
5463
5511
|
provider: "minimax",
|
|
5464
|
-
logo:
|
|
5512
|
+
logo: MINIMAX_LOGO4,
|
|
5465
5513
|
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
5514
|
},
|
|
5467
5515
|
capabilities: {}
|
|
@@ -5491,7 +5539,7 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5491
5539
|
pricingKind: "video_per_second",
|
|
5492
5540
|
display: {
|
|
5493
5541
|
provider: "minimax",
|
|
5494
|
-
logo:
|
|
5542
|
+
logo: MINIMAX_LOGO4,
|
|
5495
5543
|
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
5544
|
},
|
|
5497
5545
|
capabilities: { acceptsSourceVideo: true, videoEdit: true }
|
|
@@ -5520,7 +5568,7 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5520
5568
|
pricingKind: "video_per_second",
|
|
5521
5569
|
display: {
|
|
5522
5570
|
provider: "minimax",
|
|
5523
|
-
logo:
|
|
5571
|
+
logo: MINIMAX_LOGO4,
|
|
5524
5572
|
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
5573
|
},
|
|
5526
5574
|
capabilities: { acceptsSourceVideo: true, videoEdit: true }
|
|
@@ -5551,7 +5599,7 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5551
5599
|
pricingKind: "video_per_second",
|
|
5552
5600
|
display: {
|
|
5553
5601
|
provider: "minimax",
|
|
5554
|
-
logo:
|
|
5602
|
+
logo: MINIMAX_LOGO4,
|
|
5555
5603
|
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
5604
|
},
|
|
5557
5605
|
capabilities: { acceptsSourceVideo: true, videoEdit: true }
|
|
@@ -5863,6 +5911,11 @@ var SEEDANCE_2_AUDIO = {
|
|
|
5863
5911
|
audioFormats: ["wav", "mp3"],
|
|
5864
5912
|
audioMaxBytes: 15 * 1024 * 1024
|
|
5865
5913
|
};
|
|
5914
|
+
var SEEDANCE_REFERENCE_MEDIA = {
|
|
5915
|
+
videoPixels: { minPixels: 407696, maxPixels: 8295044 },
|
|
5916
|
+
videoFps: { min: 23.8, max: 60 },
|
|
5917
|
+
imagePixels: { minPixels: 9e4 }
|
|
5918
|
+
};
|
|
5866
5919
|
var H3_PROMPT2 = { referenceSyntax: "numbered", maxChars: 5e4 };
|
|
5867
5920
|
var WAN_PROMPT = { referenceSyntax: "numbered", maxChars: 2e4 };
|
|
5868
5921
|
var OMNI_PROMPT = { referenceSyntax: "caption", maxChars: 5e4 };
|
|
@@ -6107,6 +6160,7 @@ var VIDEO_MODELS = [
|
|
|
6107
6160
|
audios: 3,
|
|
6108
6161
|
audioOnly: false,
|
|
6109
6162
|
videoSeconds: { min: 2, max: 15, total: 15 },
|
|
6163
|
+
...SEEDANCE_REFERENCE_MEDIA,
|
|
6110
6164
|
...SEEDANCE_2_AUDIO
|
|
6111
6165
|
},
|
|
6112
6166
|
sourceVideoSeconds: { min: 2, max: 15, inReferenceTotal: true },
|
|
@@ -6150,6 +6204,7 @@ var VIDEO_MODELS = [
|
|
|
6150
6204
|
audios: 3,
|
|
6151
6205
|
audioOnly: false,
|
|
6152
6206
|
videoSeconds: { min: 2, max: 15, total: 15 },
|
|
6207
|
+
...SEEDANCE_REFERENCE_MEDIA,
|
|
6153
6208
|
...SEEDANCE_2_AUDIO
|
|
6154
6209
|
},
|
|
6155
6210
|
sourceVideoSeconds: { min: 2, max: 15, inReferenceTotal: true },
|
|
@@ -6193,6 +6248,7 @@ var VIDEO_MODELS = [
|
|
|
6193
6248
|
videos: 10,
|
|
6194
6249
|
audios: 10,
|
|
6195
6250
|
videoSeconds: { min: 2, max: 30, total: 30, editMin: 4 },
|
|
6251
|
+
...SEEDANCE_REFERENCE_MEDIA,
|
|
6196
6252
|
// BytePlus: 2-30 s per clip, 30 s in all, wav/mp3, 15 MB each.
|
|
6197
6253
|
audioSeconds: { min: 2, max: 30, total: 30 },
|
|
6198
6254
|
audioFormats: ["wav", "mp3"],
|
|
@@ -8011,7 +8067,14 @@ var VideoSecondsLimitsSchema = z3.looseObject({
|
|
|
8011
8067
|
});
|
|
8012
8068
|
var VideoPixelLimitsSchema = z3.looseObject({
|
|
8013
8069
|
minWidth: z3.number().int().positive().optional(),
|
|
8014
|
-
minHeight: z3.number().int().positive().optional()
|
|
8070
|
+
minHeight: z3.number().int().positive().optional(),
|
|
8071
|
+
minPixels: z3.number().int().positive().optional(),
|
|
8072
|
+
maxPixels: z3.number().int().positive().optional(),
|
|
8073
|
+
maxSide: z3.number().int().positive().optional()
|
|
8074
|
+
});
|
|
8075
|
+
var VideoFpsLimitsSchema = z3.looseObject({
|
|
8076
|
+
min: z3.number().positive().optional(),
|
|
8077
|
+
max: z3.number().positive().optional()
|
|
8015
8078
|
});
|
|
8016
8079
|
var ReferenceLimitsSchema = z3.looseObject({
|
|
8017
8080
|
images: z3.number().optional(),
|
|
@@ -8022,6 +8085,13 @@ var ReferenceLimitsSchema = z3.looseObject({
|
|
|
8022
8085
|
audioOnly: z3.boolean().optional(),
|
|
8023
8086
|
videoSeconds: VideoSecondsLimitsSchema.optional(),
|
|
8024
8087
|
videoPixels: VideoPixelLimitsSchema.optional(),
|
|
8088
|
+
videoFps: VideoFpsLimitsSchema.optional(),
|
|
8089
|
+
videoMaxBytes: z3.number().positive().optional(),
|
|
8090
|
+
imagePixels: VideoPixelLimitsSchema.optional(),
|
|
8091
|
+
imageAspect: z3.looseObject({
|
|
8092
|
+
min: z3.number().positive().optional(),
|
|
8093
|
+
max: z3.number().positive().optional()
|
|
8094
|
+
}).optional(),
|
|
8025
8095
|
audioSeconds: z3.looseObject({
|
|
8026
8096
|
min: z3.number().optional(),
|
|
8027
8097
|
max: z3.number().optional(),
|
|
@@ -10339,6 +10409,27 @@ var QWEN_EXACT = {
|
|
|
10339
10409
|
maxArea: 2048 * 2048,
|
|
10340
10410
|
multipleOf: 1
|
|
10341
10411
|
};
|
|
10412
|
+
var MINIMAX_H3_IMAGE_EXACT = {
|
|
10413
|
+
minSide: 1,
|
|
10414
|
+
maxSide: 14142,
|
|
10415
|
+
minArea: 655360,
|
|
10416
|
+
maxArea: 4096 * 4096,
|
|
10417
|
+
multipleOf: 1,
|
|
10418
|
+
maxAspect: 3,
|
|
10419
|
+
topTier: "4K"
|
|
10420
|
+
};
|
|
10421
|
+
function minimaxH3ImageSpec(label) {
|
|
10422
|
+
return {
|
|
10423
|
+
label,
|
|
10424
|
+
maxReferences: 16,
|
|
10425
|
+
maxCount: 10,
|
|
10426
|
+
outputFormats: ALL_FORMATS,
|
|
10427
|
+
promptMax: 32e3,
|
|
10428
|
+
promptRequired: true,
|
|
10429
|
+
aspectRatios: WIDE_RATIOS,
|
|
10430
|
+
exactSize: MINIMAX_H3_IMAGE_EXACT
|
|
10431
|
+
};
|
|
10432
|
+
}
|
|
10342
10433
|
var FAL_IMAGE_SPECS = /* @__PURE__ */ new Map([
|
|
10343
10434
|
[
|
|
10344
10435
|
"krea/v3/text-to-image",
|
|
@@ -10380,6 +10471,8 @@ var FAL_IMAGE_SPECS = /* @__PURE__ */ new Map([
|
|
|
10380
10471
|
exactSize: QWEN_EXACT
|
|
10381
10472
|
}
|
|
10382
10473
|
],
|
|
10474
|
+
["minimax/h3-image/text-to-image", minimaxH3ImageSpec("MiniMax H3 Image")],
|
|
10475
|
+
["minimax/h3-image/highspeed/text-to-image", minimaxH3ImageSpec("MiniMax H3 Image Highspeed")],
|
|
10383
10476
|
[
|
|
10384
10477
|
"fal-ai/kling-image/o3/text-to-image",
|
|
10385
10478
|
{
|
|
@@ -10443,6 +10536,7 @@ function falImageSpec(providerModelId) {
|
|
|
10443
10536
|
return FAL_IMAGE_SPECS.get(providerModelId.toLowerCase());
|
|
10444
10537
|
}
|
|
10445
10538
|
var AREA_1K = 1024 * 1024;
|
|
10539
|
+
var AREA_2K = 2048 * 2048;
|
|
10446
10540
|
function checkExactSize(exact, b) {
|
|
10447
10541
|
const match = /^(\d+)x(\d+)$/.exec(exact);
|
|
10448
10542
|
if (match === null) {
|
|
@@ -10454,14 +10548,21 @@ function checkExactSize(exact, b) {
|
|
|
10454
10548
|
const sideOk = [width, height].every(
|
|
10455
10549
|
(side) => side >= b.minSide && side <= b.maxSide && side % b.multipleOf === 0
|
|
10456
10550
|
);
|
|
10457
|
-
|
|
10551
|
+
const aspectOk = b.maxAspect === void 0 || Math.max(width, height) <= b.maxAspect * Math.min(width, height);
|
|
10552
|
+
if (!sideOk || !aspectOk || area < b.minArea || area > b.maxArea) {
|
|
10458
10553
|
const step = b.multipleOf > 1 ? `, multiples of ${b.multipleOf}` : "";
|
|
10554
|
+
const aspectLimit = b.maxAspect === void 0 ? "" : `, at most ${b.maxAspect}:1,`;
|
|
10459
10555
|
return {
|
|
10460
10556
|
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}`
|
|
10557
|
+
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
10558
|
};
|
|
10463
10559
|
}
|
|
10464
|
-
return { ok: true, size: { width, height, tier: area
|
|
10560
|
+
return { ok: true, size: { width, height, tier: exactTier(area, b) } };
|
|
10561
|
+
}
|
|
10562
|
+
function exactTier(area, b) {
|
|
10563
|
+
if (area <= AREA_1K) return "1K";
|
|
10564
|
+
if (b.topTier === void 0 || area <= AREA_2K) return "2K";
|
|
10565
|
+
return b.topTier;
|
|
10465
10566
|
}
|
|
10466
10567
|
function unsupported(message) {
|
|
10467
10568
|
return { code: "unsupported_option", message };
|
|
@@ -10667,17 +10768,17 @@ function pick(model, label, field, value, table) {
|
|
|
10667
10768
|
}
|
|
10668
10769
|
return mapped;
|
|
10669
10770
|
}
|
|
10670
|
-
function familyImageSize(model, call) {
|
|
10671
|
-
if (call.exact === void 0) return { dims: sizedDimensions(model, call) };
|
|
10771
|
+
function familyImageSize(model, call, areas = TIER_AREAS) {
|
|
10772
|
+
if (call.exact === void 0) return { dims: sizedDimensions(model, call, areas) };
|
|
10672
10773
|
const { width, height, tier } = call.exact;
|
|
10673
10774
|
return { dims: { width, height }, imageSize: tier };
|
|
10674
10775
|
}
|
|
10675
|
-
function sizedDimensions(model, { label, req }) {
|
|
10776
|
+
function sizedDimensions(model, { label, req }, areas) {
|
|
10676
10777
|
const aspectRatio = req.aspectRatio ?? "1:1";
|
|
10677
10778
|
const size = req.size ?? "1K";
|
|
10678
|
-
pick(model, label, "size", size,
|
|
10779
|
+
pick(model, label, "size", size, areas);
|
|
10679
10780
|
const dims = dimensionsFor(
|
|
10680
|
-
{ field: "image_size", areas: { ...
|
|
10781
|
+
{ field: "image_size", areas: { ...areas }, multipleOf: 16 },
|
|
10681
10782
|
{ prompt: req.prompt, aspectRatio, size }
|
|
10682
10783
|
);
|
|
10683
10784
|
if (dims === void 0) throw fail2(model, `${label} has no size for ${aspectRatio}`);
|
|
@@ -10690,8 +10791,8 @@ function withCommon(input, req, opts) {
|
|
|
10690
10791
|
return input;
|
|
10691
10792
|
}
|
|
10692
10793
|
var AREA_1K2 = 1024 * 1024;
|
|
10693
|
-
var
|
|
10694
|
-
var TIER_AREAS = { "1K": AREA_1K2, "2K":
|
|
10794
|
+
var AREA_2K2 = 2048 * 2048;
|
|
10795
|
+
var TIER_AREAS = { "1K": AREA_1K2, "2K": AREA_2K2 };
|
|
10695
10796
|
var KREA = {
|
|
10696
10797
|
editEndpoint: "krea/v3/edit",
|
|
10697
10798
|
build(call, model) {
|
|
@@ -10749,6 +10850,24 @@ var QWEN = {
|
|
|
10749
10850
|
};
|
|
10750
10851
|
}
|
|
10751
10852
|
};
|
|
10853
|
+
function minimaxH3Image(editEndpoint) {
|
|
10854
|
+
return {
|
|
10855
|
+
editEndpoint,
|
|
10856
|
+
build(call, model) {
|
|
10857
|
+
const { req, refs } = call;
|
|
10858
|
+
const size = familyImageSize(model, call, H3_IMAGE_AREAS);
|
|
10859
|
+
const input = { prompt: req.prompt, image_size: { ...size.dims } };
|
|
10860
|
+
if (refs.length > 0) input["image_urls"] = refs;
|
|
10861
|
+
return {
|
|
10862
|
+
input: withCommon(input, req, { count: true, seed: false }),
|
|
10863
|
+
...size.imageSize !== void 0 && { imageSize: size.imageSize }
|
|
10864
|
+
};
|
|
10865
|
+
}
|
|
10866
|
+
};
|
|
10867
|
+
}
|
|
10868
|
+
var H3_IMAGE_AREAS = { ...TIER_AREAS, "4K": 4096 * 4096 };
|
|
10869
|
+
var MINIMAX_H3_IMAGE = minimaxH3Image("minimax/h3-image/edit");
|
|
10870
|
+
var MINIMAX_H3_IMAGE_HIGHSPEED = minimaxH3Image("minimax/h3-image/highspeed/edit");
|
|
10752
10871
|
function klingImage(editEndpoint, sizes, field) {
|
|
10753
10872
|
return {
|
|
10754
10873
|
editEndpoint,
|
|
@@ -10830,6 +10949,8 @@ var FAMILIES = /* @__PURE__ */ new Map([
|
|
|
10830
10949
|
["krea/v3/text-to-image", KREA],
|
|
10831
10950
|
["xai/grok-imagine-image/v2.0/text-to-image", GROK],
|
|
10832
10951
|
["alibaba/qwen-image-3/text-to-image", QWEN],
|
|
10952
|
+
["minimax/h3-image/text-to-image", MINIMAX_H3_IMAGE],
|
|
10953
|
+
["minimax/h3-image/highspeed/text-to-image", MINIMAX_H3_IMAGE_HIGHSPEED],
|
|
10833
10954
|
["fal-ai/kling-image/o3/text-to-image", KLING_O3],
|
|
10834
10955
|
["fal-ai/kling-image/v3/text-to-image", KLING_V3],
|
|
10835
10956
|
["recraft/v4.1/flash/text-to-image", RECRAFT_FLASH],
|
|
@@ -15703,8 +15824,8 @@ function checkGenerateSeconds(req, ctx) {
|
|
|
15703
15824
|
}
|
|
15704
15825
|
var MAX_PLAUSIBLE_SECONDS = 60;
|
|
15705
15826
|
function editedSeconds(req, bytes) {
|
|
15706
|
-
const
|
|
15707
|
-
const length =
|
|
15827
|
+
const measured2 = mp4DurationSeconds(bytes);
|
|
15828
|
+
const length = measured2 !== void 0 && measured2 > 0 && measured2 <= MAX_PLAUSIBLE_SECONDS ? measured2 : req.sourceVideo?.durationSeconds;
|
|
15708
15829
|
return Math.max(length ?? 0, GENERATE_SECONDS);
|
|
15709
15830
|
}
|
|
15710
15831
|
function videoUsage4(ctx, req, mode, seconds3) {
|
|
@@ -16074,15 +16195,6 @@ var openaiImageAdapter = {
|
|
|
16074
16195
|
});
|
|
16075
16196
|
outputFormat = "png";
|
|
16076
16197
|
}
|
|
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
16198
|
const svgModel = ctx.model.constraints.svgModel;
|
|
16087
16199
|
if (outputFormat === "svg" && !svgModel) {
|
|
16088
16200
|
throw new ModelKitError({
|
|
@@ -17858,9 +17970,6 @@ function applyImageOutputRules(model, req, onUnsupported, warnings) {
|
|
|
17858
17970
|
}
|
|
17859
17971
|
if (req.outputFormat === "svg") {
|
|
17860
17972
|
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
17973
|
if ((req.count ?? 1) > 1) {
|
|
17865
17974
|
if (onUnsupported === "error") {
|
|
17866
17975
|
refuse(model, `${model.label} makes one SVG per call`);
|
|
@@ -18832,6 +18941,126 @@ function resolveVoiceDesignOptions(model, request, onUnsupported = "error") {
|
|
|
18832
18941
|
return { request: resolved, warnings };
|
|
18833
18942
|
}
|
|
18834
18943
|
|
|
18944
|
+
// src/reference-video-conform.ts
|
|
18945
|
+
var REFERENCE_VIDEO_CONFORM_PROFILE = "model-safe-v1";
|
|
18946
|
+
var SHRINK_MARGIN = 0.998;
|
|
18947
|
+
var GROW_MARGIN = 1.002;
|
|
18948
|
+
var LOW_FPS_TARGET = 24;
|
|
18949
|
+
var HIGH_FPS_TARGET = 30;
|
|
18950
|
+
function measured(value) {
|
|
18951
|
+
return value !== void 0 && Number.isFinite(value) && value > 0;
|
|
18952
|
+
}
|
|
18953
|
+
function evenDown(value) {
|
|
18954
|
+
return Math.max(2, Math.floor(value / 2) * 2);
|
|
18955
|
+
}
|
|
18956
|
+
function evenUp(value) {
|
|
18957
|
+
return Math.max(2, Math.ceil(value / 2) * 2);
|
|
18958
|
+
}
|
|
18959
|
+
function sizeFix(limits, width, height) {
|
|
18960
|
+
if (!limits) return null;
|
|
18961
|
+
const pixels = width * height;
|
|
18962
|
+
const long = Math.max(width, height);
|
|
18963
|
+
const shrink = [];
|
|
18964
|
+
const grow = [];
|
|
18965
|
+
const reasons = [];
|
|
18966
|
+
if (limits.maxPixels !== void 0 && pixels > limits.maxPixels) {
|
|
18967
|
+
shrink.push(Math.sqrt(limits.maxPixels / pixels) * SHRINK_MARGIN);
|
|
18968
|
+
reasons.push("pixels_over");
|
|
18969
|
+
}
|
|
18970
|
+
if (limits.maxSide !== void 0 && long > limits.maxSide) {
|
|
18971
|
+
shrink.push(limits.maxSide / long * SHRINK_MARGIN);
|
|
18972
|
+
reasons.push("side_over");
|
|
18973
|
+
}
|
|
18974
|
+
if (shrink.length > 0) return { scale: Math.min(...shrink), up: false, reasons };
|
|
18975
|
+
if (limits.minPixels !== void 0 && pixels < limits.minPixels) {
|
|
18976
|
+
grow.push(Math.sqrt(limits.minPixels / pixels) * GROW_MARGIN);
|
|
18977
|
+
reasons.push("pixels_under");
|
|
18978
|
+
}
|
|
18979
|
+
const sideUnder = [
|
|
18980
|
+
limits.minWidth !== void 0 && width < limits.minWidth ? limits.minWidth / width * GROW_MARGIN : 0,
|
|
18981
|
+
limits.minHeight !== void 0 && height < limits.minHeight ? limits.minHeight / height * GROW_MARGIN : 0
|
|
18982
|
+
].filter((scale) => scale > 0);
|
|
18983
|
+
if (sideUnder.length > 0) {
|
|
18984
|
+
grow.push(...sideUnder);
|
|
18985
|
+
reasons.push("side_under");
|
|
18986
|
+
}
|
|
18987
|
+
if (grow.length > 0) return { scale: Math.max(...grow), up: true, reasons };
|
|
18988
|
+
return null;
|
|
18989
|
+
}
|
|
18990
|
+
function fpsFix(model, fps) {
|
|
18991
|
+
const limits = model.constraints.references?.videoFps;
|
|
18992
|
+
if (!limits || !measured(fps)) return void 0;
|
|
18993
|
+
const inRange = (rate) => (limits.min === void 0 || rate >= limits.min) && (limits.max === void 0 || rate <= limits.max);
|
|
18994
|
+
if (limits.min !== void 0 && fps < limits.min) {
|
|
18995
|
+
const target = inRange(LOW_FPS_TARGET) ? LOW_FPS_TARGET : Math.ceil(limits.min);
|
|
18996
|
+
return { fps: target, reason: "fps_under" };
|
|
18997
|
+
}
|
|
18998
|
+
if (limits.max !== void 0 && fps > limits.max) {
|
|
18999
|
+
const target = inRange(HIGH_FPS_TARGET) ? HIGH_FPS_TARGET : Math.floor(limits.max);
|
|
19000
|
+
return { fps: target, reason: "fps_over" };
|
|
19001
|
+
}
|
|
19002
|
+
return void 0;
|
|
19003
|
+
}
|
|
19004
|
+
function referenceVideoConformPlan(model, probe) {
|
|
19005
|
+
const rate = fpsFix(model, probe.fps);
|
|
19006
|
+
const maxBytes = model.constraints.references?.videoMaxBytes;
|
|
19007
|
+
const overBytes = maxBytes !== void 0 && measured(probe.bytes) && probe.bytes > maxBytes;
|
|
19008
|
+
const { width: probedWidth, height: probedHeight } = probe;
|
|
19009
|
+
if (!measured(probedWidth) || !measured(probedHeight)) return null;
|
|
19010
|
+
const width = Math.round(probedWidth);
|
|
19011
|
+
const height = Math.round(probedHeight);
|
|
19012
|
+
const size = sizeFix(model.constraints.references?.videoPixels, width, height);
|
|
19013
|
+
if (!size && !rate && !overBytes) return null;
|
|
19014
|
+
const round = size?.up ? evenUp : evenDown;
|
|
19015
|
+
const scale = size?.scale ?? 1;
|
|
19016
|
+
const reasons = [...size?.reasons ?? []];
|
|
19017
|
+
if (rate) reasons.push(rate.reason);
|
|
19018
|
+
if (overBytes) reasons.push("bytes_over");
|
|
19019
|
+
const plan4 = {
|
|
19020
|
+
width: round(width * scale),
|
|
19021
|
+
height: round(height * scale),
|
|
19022
|
+
reasons
|
|
19023
|
+
};
|
|
19024
|
+
if (rate) plan4.fps = rate.fps;
|
|
19025
|
+
if (maxBytes !== void 0) plan4.maxBytes = maxBytes;
|
|
19026
|
+
return plan4;
|
|
19027
|
+
}
|
|
19028
|
+
function referenceImageConformPlan(model, probe) {
|
|
19029
|
+
const { width: probedWidth, height: probedHeight } = probe;
|
|
19030
|
+
if (!measured(probedWidth) || !measured(probedHeight)) return null;
|
|
19031
|
+
const references = model.constraints.references;
|
|
19032
|
+
const width = Math.round(probedWidth);
|
|
19033
|
+
const height = Math.round(probedHeight);
|
|
19034
|
+
const reasons = [];
|
|
19035
|
+
let frameWidth = width;
|
|
19036
|
+
let frameHeight = height;
|
|
19037
|
+
const aspect = references?.imageAspect;
|
|
19038
|
+
if (aspect?.min !== void 0 && width / height < aspect.min) {
|
|
19039
|
+
frameWidth = Math.ceil(height * aspect.min);
|
|
19040
|
+
reasons.push("aspect");
|
|
19041
|
+
} else if (aspect?.max !== void 0 && width / height > aspect.max) {
|
|
19042
|
+
frameHeight = Math.ceil(width / aspect.max);
|
|
19043
|
+
reasons.push("aspect");
|
|
19044
|
+
}
|
|
19045
|
+
const size = sizeFix(references?.imagePixels, frameWidth, frameHeight);
|
|
19046
|
+
if (!size && reasons.length === 0) return null;
|
|
19047
|
+
if (size) reasons.push(...size.reasons);
|
|
19048
|
+
const scale = size?.scale ?? 1;
|
|
19049
|
+
const round = size?.up ? Math.ceil : Math.floor;
|
|
19050
|
+
const frame = {
|
|
19051
|
+
width: Math.max(1, round(frameWidth * scale)),
|
|
19052
|
+
height: Math.max(1, round(frameHeight * scale))
|
|
19053
|
+
};
|
|
19054
|
+
const image = frameWidth > width ? {
|
|
19055
|
+
width: Math.max(1, Math.round(frame.height * width / height)),
|
|
19056
|
+
height: frame.height
|
|
19057
|
+
} : frameHeight > height ? {
|
|
19058
|
+
width: frame.width,
|
|
19059
|
+
height: Math.max(1, Math.round(frame.width * height / width))
|
|
19060
|
+
} : { ...frame };
|
|
19061
|
+
return { ...frame, image, reasons };
|
|
19062
|
+
}
|
|
19063
|
+
|
|
18835
19064
|
// src/keys.ts
|
|
18836
19065
|
var ADAPTER_KEYS = {
|
|
18837
19066
|
"ai-sdk-text": [],
|
|
@@ -20321,6 +20550,7 @@ export {
|
|
|
20321
20550
|
MODEL3D_MODELS,
|
|
20322
20551
|
MODELS,
|
|
20323
20552
|
ModelKitError,
|
|
20553
|
+
REFERENCE_VIDEO_CONFORM_PROFILE,
|
|
20324
20554
|
SURFACES2 as SURFACES,
|
|
20325
20555
|
SurfaceSchema,
|
|
20326
20556
|
VIDEO_INPUT_SPEC_KEYS,
|
|
@@ -20388,6 +20618,8 @@ export {
|
|
|
20388
20618
|
primeCatalog,
|
|
20389
20619
|
prodiaAdapter,
|
|
20390
20620
|
readErrorBody,
|
|
20621
|
+
referenceImageConformPlan,
|
|
20622
|
+
referenceVideoConformPlan,
|
|
20391
20623
|
replicateAdapter,
|
|
20392
20624
|
resetLiveCatalog,
|
|
20393
20625
|
resolutionTier,
|