@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/catalog.js
CHANGED
|
@@ -147,6 +147,7 @@ function isListed(row2) {
|
|
|
147
147
|
var IMAGE_USAGE = { unit: "images" };
|
|
148
148
|
var EXPOSURE = ["cowork", "space_builder"];
|
|
149
149
|
var LOBE = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light";
|
|
150
|
+
var MINIMAX_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
|
|
150
151
|
var SIZED_RATIOS = [
|
|
151
152
|
"1:1",
|
|
152
153
|
"16:9",
|
|
@@ -172,6 +173,36 @@ var RECRAFT_RATIOS = [
|
|
|
172
173
|
"5:4",
|
|
173
174
|
"4:5"
|
|
174
175
|
];
|
|
176
|
+
function minimaxH3ImageRow(row2) {
|
|
177
|
+
return {
|
|
178
|
+
id: row2.id,
|
|
179
|
+
aliases: [],
|
|
180
|
+
label: row2.label,
|
|
181
|
+
type: "image",
|
|
182
|
+
adapter: "fal",
|
|
183
|
+
providerModelId: row2.providerModelId,
|
|
184
|
+
lifecycle: "active",
|
|
185
|
+
exposure: EXPOSURE,
|
|
186
|
+
constraints: {
|
|
187
|
+
aspectRatios: [...SIZED_RATIOS],
|
|
188
|
+
sizes: ["1K", "2K", "4K"],
|
|
189
|
+
references: {
|
|
190
|
+
images: 16,
|
|
191
|
+
imagePixels: { minWidth: 128, minHeight: 128, maxSide: 8192 }
|
|
192
|
+
},
|
|
193
|
+
supports: ["count", "outputFormat"],
|
|
194
|
+
prompt: { referenceSyntax: "numbered", maxChars: 32e3 }
|
|
195
|
+
},
|
|
196
|
+
defaults: { size: "2K", aspectRatio: "1:1", count: 1 },
|
|
197
|
+
usage: { ...IMAGE_USAGE },
|
|
198
|
+
pricingKind: "image_size",
|
|
199
|
+
display: {
|
|
200
|
+
provider: "minimax",
|
|
201
|
+
description: row2.description,
|
|
202
|
+
logo: MINIMAX_LOGO
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
}
|
|
175
206
|
var FAL_IMAGE_MODELS = [
|
|
176
207
|
{
|
|
177
208
|
// krea/v3/text-to-image; references switch to krea/v3/edit (1-8 images). Billed per
|
|
@@ -255,6 +286,22 @@ var FAL_IMAGE_MODELS = [
|
|
|
255
286
|
logo: `${LOBE}/qwen-color.png`
|
|
256
287
|
}
|
|
257
288
|
},
|
|
289
|
+
minimaxH3ImageRow({
|
|
290
|
+
// minimax/h3-image/text-to-image; references switch to minimax/h3-image/edit. Billed on
|
|
291
|
+
// tokens: $2.30/M input text, $1.50/M input image, $3.80/M output image.
|
|
292
|
+
id: "minimax-h3-image",
|
|
293
|
+
label: "MiniMax H3 Image",
|
|
294
|
+
providerModelId: "minimax/h3-image/text-to-image",
|
|
295
|
+
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."
|
|
296
|
+
}),
|
|
297
|
+
minimaxH3ImageRow({
|
|
298
|
+
// minimax/h3-image/highspeed/text-to-image; references switch to .../highspeed/edit.
|
|
299
|
+
// Billed on tokens: $2.30/M input text, $3.00/M input image, $7.60/M output image.
|
|
300
|
+
id: "minimax-h3-image-highspeed",
|
|
301
|
+
label: "MiniMax H3 Image Highspeed",
|
|
302
|
+
providerModelId: "minimax/h3-image/highspeed/text-to-image",
|
|
303
|
+
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."
|
|
304
|
+
}),
|
|
258
305
|
{
|
|
259
306
|
// fal-ai/kling-image/o3/text-to-image; references switch to .../o3/image-to-image (up to
|
|
260
307
|
// 10, "@Image1".."@Image10"). $0.028 per image at 1K and 2K, double at 4K.
|
|
@@ -831,6 +878,46 @@ var IMAGE_MODELS = [
|
|
|
831
878
|
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."
|
|
832
879
|
}
|
|
833
880
|
},
|
|
881
|
+
// Seedream 5.5 (Early Access, 2026-11-11): 1K / 1.5K / 2K, no 4K; exact sizes must total
|
|
882
|
+
// 921,600 to 4,624,220 px, which every SEEDREAM_SIZES 1K and 2K entry does. Up to 10
|
|
883
|
+
// references; `background: "transparent"` returns an RGBA PNG.
|
|
884
|
+
{
|
|
885
|
+
id: "seedream-5.5",
|
|
886
|
+
aliases: [],
|
|
887
|
+
label: "Seedream 5.5",
|
|
888
|
+
type: "image",
|
|
889
|
+
adapter: "ark",
|
|
890
|
+
providerModelId: "dola-seedream-5-5-261028",
|
|
891
|
+
lifecycle: "active",
|
|
892
|
+
exposure: ["cowork", "space_builder"],
|
|
893
|
+
constraints: {
|
|
894
|
+
aspectRatios: [
|
|
895
|
+
"1:1",
|
|
896
|
+
"4:3",
|
|
897
|
+
"3:4",
|
|
898
|
+
"16:9",
|
|
899
|
+
"9:16",
|
|
900
|
+
"3:2",
|
|
901
|
+
"2:3",
|
|
902
|
+
"21:9",
|
|
903
|
+
"9:21",
|
|
904
|
+
"4:5",
|
|
905
|
+
"5:4"
|
|
906
|
+
],
|
|
907
|
+
sizes: ["1K", "2K"],
|
|
908
|
+
references: { images: 10 },
|
|
909
|
+
supports: ["seed", "outputFormat"],
|
|
910
|
+
backgrounds: ["auto", "opaque", "transparent"]
|
|
911
|
+
},
|
|
912
|
+
defaults: { size: "1K", aspectRatio: "1:1" },
|
|
913
|
+
usage: { ...IMAGE_USAGE3 },
|
|
914
|
+
pricingKind: "image_size",
|
|
915
|
+
display: {
|
|
916
|
+
provider: "bytedance",
|
|
917
|
+
logo: "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/3bba5d81-4e57-4e71-911b-cdfa05acca2c_compressed.png",
|
|
918
|
+
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."
|
|
919
|
+
}
|
|
920
|
+
},
|
|
834
921
|
{
|
|
835
922
|
id: "seedream-4.5",
|
|
836
923
|
aliases: [],
|
|
@@ -3753,7 +3840,7 @@ var MINIMAX_VOICES = [
|
|
|
3753
3840
|
// src/catalog/media-nodes.ts
|
|
3754
3841
|
var ELEVENLABS_LOGO2 = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/elevenlabs.png";
|
|
3755
3842
|
var GOOGLE_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/192485d2-a76a-4657-9c06-930b2c70badd_compressed.png";
|
|
3756
|
-
var
|
|
3843
|
+
var MINIMAX_LOGO2 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
|
|
3757
3844
|
var SYNC_LOGO = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/sync.png";
|
|
3758
3845
|
var PER_CALL3 = { unit: "images" };
|
|
3759
3846
|
var EXPOSURE5 = ["cowork", "space_builder"];
|
|
@@ -3888,7 +3975,7 @@ var MEDIA_NODE_MODELS = [
|
|
|
3888
3975
|
pricingKind: "flat",
|
|
3889
3976
|
display: {
|
|
3890
3977
|
provider: "minimax",
|
|
3891
|
-
logo:
|
|
3978
|
+
logo: MINIMAX_LOGO2,
|
|
3892
3979
|
description: "MiniMax Speech 2.8 HD text to speech; studio-quality narration in over 300 voices, with pause and interjection tags."
|
|
3893
3980
|
},
|
|
3894
3981
|
capabilities: {}
|
|
@@ -4015,7 +4102,7 @@ var MEDIA_NODE_MODELS = [
|
|
|
4015
4102
|
pricingKind: "video_per_second",
|
|
4016
4103
|
display: {
|
|
4017
4104
|
provider: "minimax",
|
|
4018
|
-
logo:
|
|
4105
|
+
logo: MINIMAX_LOGO2,
|
|
4019
4106
|
description: "MiniMax H3 Max lip sync; animates a portrait image into a talking video as long as the speech, up to 2K."
|
|
4020
4107
|
},
|
|
4021
4108
|
capabilities: {}
|
|
@@ -4245,7 +4332,7 @@ var MODEL3D_MODELS = [
|
|
|
4245
4332
|
// src/catalog/other.ts
|
|
4246
4333
|
var GOOGLE_LOGO2 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/192485d2-a76a-4657-9c06-930b2c70badd_compressed.png";
|
|
4247
4334
|
var ELEVENLABS_LOGO3 = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/elevenlabs.png";
|
|
4248
|
-
var
|
|
4335
|
+
var MINIMAX_LOGO3 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
|
|
4249
4336
|
var OTHER_MODELS = [
|
|
4250
4337
|
{
|
|
4251
4338
|
id: "lyria-3-clip-preview",
|
|
@@ -4434,7 +4521,7 @@ var OTHER_MODELS = [
|
|
|
4434
4521
|
pricingKind: "flat",
|
|
4435
4522
|
display: {
|
|
4436
4523
|
provider: "minimax",
|
|
4437
|
-
logo:
|
|
4524
|
+
logo: MINIMAX_LOGO3,
|
|
4438
4525
|
description: "MiniMax Music 3 songs from a style prompt and your lyrics (or instrumental), up to 5 minutes."
|
|
4439
4526
|
},
|
|
4440
4527
|
capabilities: {}
|
|
@@ -5132,7 +5219,7 @@ var TEXT_MODELS = [
|
|
|
5132
5219
|
var VIDEO_USAGE = { unit: "seconds" };
|
|
5133
5220
|
var MB = 1024 * 1024;
|
|
5134
5221
|
var KLING_LOGO = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/kling-color.png";
|
|
5135
|
-
var
|
|
5222
|
+
var MINIMAX_LOGO4 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
|
|
5136
5223
|
var BYTEDANCE_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/3bba5d81-4e57-4e71-911b-cdfa05acca2c_compressed.png";
|
|
5137
5224
|
var XAI_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/858b7fcc-9bd5-411d-aea1-a7b35ecfffab_compressed.png";
|
|
5138
5225
|
var H3_RATIOS = ["21:9", "16:9", "4:3", "1:1", "3:4", "9:16"];
|
|
@@ -5284,7 +5371,8 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5284
5371
|
images: 10,
|
|
5285
5372
|
videos: 5,
|
|
5286
5373
|
videoSeconds: { min: 3, max: 30.05, total: 30 },
|
|
5287
|
-
videoPixels: { minWidth: 700, minHeight: 700 }
|
|
5374
|
+
videoPixels: { minWidth: 700, minHeight: 700 },
|
|
5375
|
+
videoFps: { min: 23.9, max: 60.05 }
|
|
5288
5376
|
},
|
|
5289
5377
|
supports: ["lastFrame"],
|
|
5290
5378
|
prompt: KLING_V4_PROMPT,
|
|
@@ -5450,7 +5538,7 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5450
5538
|
pricingKind: "video_per_second",
|
|
5451
5539
|
display: {
|
|
5452
5540
|
provider: "minimax",
|
|
5453
|
-
logo:
|
|
5541
|
+
logo: MINIMAX_LOGO4,
|
|
5454
5542
|
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."
|
|
5455
5543
|
},
|
|
5456
5544
|
capabilities: {}
|
|
@@ -5480,7 +5568,7 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5480
5568
|
pricingKind: "video_per_second",
|
|
5481
5569
|
display: {
|
|
5482
5570
|
provider: "minimax",
|
|
5483
|
-
logo:
|
|
5571
|
+
logo: MINIMAX_LOGO4,
|
|
5484
5572
|
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."
|
|
5485
5573
|
},
|
|
5486
5574
|
capabilities: { acceptsSourceVideo: true, videoEdit: true }
|
|
@@ -5509,7 +5597,7 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5509
5597
|
pricingKind: "video_per_second",
|
|
5510
5598
|
display: {
|
|
5511
5599
|
provider: "minimax",
|
|
5512
|
-
logo:
|
|
5600
|
+
logo: MINIMAX_LOGO4,
|
|
5513
5601
|
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."
|
|
5514
5602
|
},
|
|
5515
5603
|
capabilities: { acceptsSourceVideo: true, videoEdit: true }
|
|
@@ -5540,7 +5628,7 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5540
5628
|
pricingKind: "video_per_second",
|
|
5541
5629
|
display: {
|
|
5542
5630
|
provider: "minimax",
|
|
5543
|
-
logo:
|
|
5631
|
+
logo: MINIMAX_LOGO4,
|
|
5544
5632
|
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."
|
|
5545
5633
|
},
|
|
5546
5634
|
capabilities: { acceptsSourceVideo: true, videoEdit: true }
|
|
@@ -5852,6 +5940,11 @@ var SEEDANCE_2_AUDIO = {
|
|
|
5852
5940
|
audioFormats: ["wav", "mp3"],
|
|
5853
5941
|
audioMaxBytes: 15 * 1024 * 1024
|
|
5854
5942
|
};
|
|
5943
|
+
var SEEDANCE_REFERENCE_MEDIA = {
|
|
5944
|
+
videoPixels: { minPixels: 407696, maxPixels: 8295044 },
|
|
5945
|
+
videoFps: { min: 23.8, max: 60 },
|
|
5946
|
+
imagePixels: { minPixels: 9e4 }
|
|
5947
|
+
};
|
|
5855
5948
|
var H3_PROMPT2 = { referenceSyntax: "numbered", maxChars: 5e4 };
|
|
5856
5949
|
var WAN_PROMPT = { referenceSyntax: "numbered", maxChars: 2e4 };
|
|
5857
5950
|
var OMNI_PROMPT = { referenceSyntax: "caption", maxChars: 5e4 };
|
|
@@ -6096,6 +6189,7 @@ var VIDEO_MODELS = [
|
|
|
6096
6189
|
audios: 3,
|
|
6097
6190
|
audioOnly: false,
|
|
6098
6191
|
videoSeconds: { min: 2, max: 15, total: 15 },
|
|
6192
|
+
...SEEDANCE_REFERENCE_MEDIA,
|
|
6099
6193
|
...SEEDANCE_2_AUDIO
|
|
6100
6194
|
},
|
|
6101
6195
|
sourceVideoSeconds: { min: 2, max: 15, inReferenceTotal: true },
|
|
@@ -6139,6 +6233,7 @@ var VIDEO_MODELS = [
|
|
|
6139
6233
|
audios: 3,
|
|
6140
6234
|
audioOnly: false,
|
|
6141
6235
|
videoSeconds: { min: 2, max: 15, total: 15 },
|
|
6236
|
+
...SEEDANCE_REFERENCE_MEDIA,
|
|
6142
6237
|
...SEEDANCE_2_AUDIO
|
|
6143
6238
|
},
|
|
6144
6239
|
sourceVideoSeconds: { min: 2, max: 15, inReferenceTotal: true },
|
|
@@ -6182,6 +6277,7 @@ var VIDEO_MODELS = [
|
|
|
6182
6277
|
videos: 10,
|
|
6183
6278
|
audios: 10,
|
|
6184
6279
|
videoSeconds: { min: 2, max: 30, total: 30, editMin: 4 },
|
|
6280
|
+
...SEEDANCE_REFERENCE_MEDIA,
|
|
6185
6281
|
// BytePlus: 2-30 s per clip, 30 s in all, wav/mp3, 15 MB each.
|
|
6186
6282
|
audioSeconds: { min: 2, max: 30, total: 30 },
|
|
6187
6283
|
audioFormats: ["wav", "mp3"],
|
|
@@ -8006,7 +8102,14 @@ var VideoSecondsLimitsSchema = z3.looseObject({
|
|
|
8006
8102
|
});
|
|
8007
8103
|
var VideoPixelLimitsSchema = z3.looseObject({
|
|
8008
8104
|
minWidth: z3.number().int().positive().optional(),
|
|
8009
|
-
minHeight: z3.number().int().positive().optional()
|
|
8105
|
+
minHeight: z3.number().int().positive().optional(),
|
|
8106
|
+
minPixels: z3.number().int().positive().optional(),
|
|
8107
|
+
maxPixels: z3.number().int().positive().optional(),
|
|
8108
|
+
maxSide: z3.number().int().positive().optional()
|
|
8109
|
+
});
|
|
8110
|
+
var VideoFpsLimitsSchema = z3.looseObject({
|
|
8111
|
+
min: z3.number().positive().optional(),
|
|
8112
|
+
max: z3.number().positive().optional()
|
|
8010
8113
|
});
|
|
8011
8114
|
var ReferenceLimitsSchema = z3.looseObject({
|
|
8012
8115
|
images: z3.number().optional(),
|
|
@@ -8017,6 +8120,13 @@ var ReferenceLimitsSchema = z3.looseObject({
|
|
|
8017
8120
|
audioOnly: z3.boolean().optional(),
|
|
8018
8121
|
videoSeconds: VideoSecondsLimitsSchema.optional(),
|
|
8019
8122
|
videoPixels: VideoPixelLimitsSchema.optional(),
|
|
8123
|
+
videoFps: VideoFpsLimitsSchema.optional(),
|
|
8124
|
+
videoMaxBytes: z3.number().positive().optional(),
|
|
8125
|
+
imagePixels: VideoPixelLimitsSchema.optional(),
|
|
8126
|
+
imageAspect: z3.looseObject({
|
|
8127
|
+
min: z3.number().positive().optional(),
|
|
8128
|
+
max: z3.number().positive().optional()
|
|
8129
|
+
}).optional(),
|
|
8020
8130
|
audioSeconds: z3.looseObject({
|
|
8021
8131
|
min: z3.number().optional(),
|
|
8022
8132
|
max: z3.number().optional(),
|
|
@@ -8999,9 +9109,6 @@ function applyImageOutputRules(model, req, onUnsupported, warnings) {
|
|
|
8999
9109
|
}
|
|
9000
9110
|
if (req.outputFormat === "svg") {
|
|
9001
9111
|
if (!c.svgModel) refuse(model, `${model.id} names no svgModel to write the SVG`);
|
|
9002
|
-
if ((req.references ?? []).length > 0) {
|
|
9003
|
-
refuse(model, `${model.label} cannot make an SVG from reference images`);
|
|
9004
|
-
}
|
|
9005
9112
|
if ((req.count ?? 1) > 1) {
|
|
9006
9113
|
if (onUnsupported === "error") {
|
|
9007
9114
|
refuse(model, `${model.label} makes one SVG per call`);
|
|
@@ -9136,6 +9243,27 @@ var QWEN_EXACT = {
|
|
|
9136
9243
|
maxArea: 2048 * 2048,
|
|
9137
9244
|
multipleOf: 1
|
|
9138
9245
|
};
|
|
9246
|
+
var MINIMAX_H3_IMAGE_EXACT = {
|
|
9247
|
+
minSide: 1,
|
|
9248
|
+
maxSide: 14142,
|
|
9249
|
+
minArea: 655360,
|
|
9250
|
+
maxArea: 4096 * 4096,
|
|
9251
|
+
multipleOf: 1,
|
|
9252
|
+
maxAspect: 3,
|
|
9253
|
+
topTier: "4K"
|
|
9254
|
+
};
|
|
9255
|
+
function minimaxH3ImageSpec(label) {
|
|
9256
|
+
return {
|
|
9257
|
+
label,
|
|
9258
|
+
maxReferences: 16,
|
|
9259
|
+
maxCount: 10,
|
|
9260
|
+
outputFormats: ALL_FORMATS,
|
|
9261
|
+
promptMax: 32e3,
|
|
9262
|
+
promptRequired: true,
|
|
9263
|
+
aspectRatios: WIDE_RATIOS,
|
|
9264
|
+
exactSize: MINIMAX_H3_IMAGE_EXACT
|
|
9265
|
+
};
|
|
9266
|
+
}
|
|
9139
9267
|
var FAL_IMAGE_SPECS = /* @__PURE__ */ new Map([
|
|
9140
9268
|
[
|
|
9141
9269
|
"krea/v3/text-to-image",
|
|
@@ -9177,6 +9305,8 @@ var FAL_IMAGE_SPECS = /* @__PURE__ */ new Map([
|
|
|
9177
9305
|
exactSize: QWEN_EXACT
|
|
9178
9306
|
}
|
|
9179
9307
|
],
|
|
9308
|
+
["minimax/h3-image/text-to-image", minimaxH3ImageSpec("MiniMax H3 Image")],
|
|
9309
|
+
["minimax/h3-image/highspeed/text-to-image", minimaxH3ImageSpec("MiniMax H3 Image Highspeed")],
|
|
9180
9310
|
[
|
|
9181
9311
|
"fal-ai/kling-image/o3/text-to-image",
|
|
9182
9312
|
{
|
|
@@ -9240,6 +9370,7 @@ function falImageSpec(providerModelId) {
|
|
|
9240
9370
|
return FAL_IMAGE_SPECS.get(providerModelId.toLowerCase());
|
|
9241
9371
|
}
|
|
9242
9372
|
var AREA_1K = 1024 * 1024;
|
|
9373
|
+
var AREA_2K = 2048 * 2048;
|
|
9243
9374
|
function checkExactSize(exact, b) {
|
|
9244
9375
|
const match = /^(\d+)x(\d+)$/.exec(exact);
|
|
9245
9376
|
if (match === null) {
|
|
@@ -9251,14 +9382,21 @@ function checkExactSize(exact, b) {
|
|
|
9251
9382
|
const sideOk = [width, height].every(
|
|
9252
9383
|
(side) => side >= b.minSide && side <= b.maxSide && side % b.multipleOf === 0
|
|
9253
9384
|
);
|
|
9254
|
-
|
|
9385
|
+
const aspectOk = b.maxAspect === void 0 || Math.max(width, height) <= b.maxAspect * Math.min(width, height);
|
|
9386
|
+
if (!sideOk || !aspectOk || area < b.minArea || area > b.maxArea) {
|
|
9255
9387
|
const step = b.multipleOf > 1 ? `, multiples of ${b.multipleOf}` : "";
|
|
9388
|
+
const aspectLimit = b.maxAspect === void 0 ? "" : `, at most ${b.maxAspect}:1,`;
|
|
9256
9389
|
return {
|
|
9257
9390
|
ok: false,
|
|
9258
|
-
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}`
|
|
9391
|
+
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}`
|
|
9259
9392
|
};
|
|
9260
9393
|
}
|
|
9261
|
-
return { ok: true, size: { width, height, tier: area
|
|
9394
|
+
return { ok: true, size: { width, height, tier: exactTier(area, b) } };
|
|
9395
|
+
}
|
|
9396
|
+
function exactTier(area, b) {
|
|
9397
|
+
if (area <= AREA_1K) return "1K";
|
|
9398
|
+
if (b.topTier === void 0 || area <= AREA_2K) return "2K";
|
|
9399
|
+
return b.topTier;
|
|
9262
9400
|
}
|
|
9263
9401
|
function unsupported(message) {
|
|
9264
9402
|
return { code: "unsupported_option", message };
|
|
@@ -10659,6 +10797,126 @@ function resolveOptions(model, call, onUnsupported = "error") {
|
|
|
10659
10797
|
return { method: call.method, ...resolveVideoToolCall(model, call.request) };
|
|
10660
10798
|
}
|
|
10661
10799
|
}
|
|
10800
|
+
|
|
10801
|
+
// src/reference-video-conform.ts
|
|
10802
|
+
var REFERENCE_VIDEO_CONFORM_PROFILE = "model-safe-v1";
|
|
10803
|
+
var SHRINK_MARGIN = 0.998;
|
|
10804
|
+
var GROW_MARGIN = 1.002;
|
|
10805
|
+
var LOW_FPS_TARGET = 24;
|
|
10806
|
+
var HIGH_FPS_TARGET = 30;
|
|
10807
|
+
function measured(value) {
|
|
10808
|
+
return value !== void 0 && Number.isFinite(value) && value > 0;
|
|
10809
|
+
}
|
|
10810
|
+
function evenDown(value) {
|
|
10811
|
+
return Math.max(2, Math.floor(value / 2) * 2);
|
|
10812
|
+
}
|
|
10813
|
+
function evenUp(value) {
|
|
10814
|
+
return Math.max(2, Math.ceil(value / 2) * 2);
|
|
10815
|
+
}
|
|
10816
|
+
function sizeFix(limits, width, height) {
|
|
10817
|
+
if (!limits) return null;
|
|
10818
|
+
const pixels = width * height;
|
|
10819
|
+
const long = Math.max(width, height);
|
|
10820
|
+
const shrink = [];
|
|
10821
|
+
const grow = [];
|
|
10822
|
+
const reasons = [];
|
|
10823
|
+
if (limits.maxPixels !== void 0 && pixels > limits.maxPixels) {
|
|
10824
|
+
shrink.push(Math.sqrt(limits.maxPixels / pixels) * SHRINK_MARGIN);
|
|
10825
|
+
reasons.push("pixels_over");
|
|
10826
|
+
}
|
|
10827
|
+
if (limits.maxSide !== void 0 && long > limits.maxSide) {
|
|
10828
|
+
shrink.push(limits.maxSide / long * SHRINK_MARGIN);
|
|
10829
|
+
reasons.push("side_over");
|
|
10830
|
+
}
|
|
10831
|
+
if (shrink.length > 0) return { scale: Math.min(...shrink), up: false, reasons };
|
|
10832
|
+
if (limits.minPixels !== void 0 && pixels < limits.minPixels) {
|
|
10833
|
+
grow.push(Math.sqrt(limits.minPixels / pixels) * GROW_MARGIN);
|
|
10834
|
+
reasons.push("pixels_under");
|
|
10835
|
+
}
|
|
10836
|
+
const sideUnder = [
|
|
10837
|
+
limits.minWidth !== void 0 && width < limits.minWidth ? limits.minWidth / width * GROW_MARGIN : 0,
|
|
10838
|
+
limits.minHeight !== void 0 && height < limits.minHeight ? limits.minHeight / height * GROW_MARGIN : 0
|
|
10839
|
+
].filter((scale) => scale > 0);
|
|
10840
|
+
if (sideUnder.length > 0) {
|
|
10841
|
+
grow.push(...sideUnder);
|
|
10842
|
+
reasons.push("side_under");
|
|
10843
|
+
}
|
|
10844
|
+
if (grow.length > 0) return { scale: Math.max(...grow), up: true, reasons };
|
|
10845
|
+
return null;
|
|
10846
|
+
}
|
|
10847
|
+
function fpsFix(model, fps) {
|
|
10848
|
+
const limits = model.constraints.references?.videoFps;
|
|
10849
|
+
if (!limits || !measured(fps)) return void 0;
|
|
10850
|
+
const inRange = (rate) => (limits.min === void 0 || rate >= limits.min) && (limits.max === void 0 || rate <= limits.max);
|
|
10851
|
+
if (limits.min !== void 0 && fps < limits.min) {
|
|
10852
|
+
const target = inRange(LOW_FPS_TARGET) ? LOW_FPS_TARGET : Math.ceil(limits.min);
|
|
10853
|
+
return { fps: target, reason: "fps_under" };
|
|
10854
|
+
}
|
|
10855
|
+
if (limits.max !== void 0 && fps > limits.max) {
|
|
10856
|
+
const target = inRange(HIGH_FPS_TARGET) ? HIGH_FPS_TARGET : Math.floor(limits.max);
|
|
10857
|
+
return { fps: target, reason: "fps_over" };
|
|
10858
|
+
}
|
|
10859
|
+
return void 0;
|
|
10860
|
+
}
|
|
10861
|
+
function referenceVideoConformPlan(model, probe) {
|
|
10862
|
+
const rate = fpsFix(model, probe.fps);
|
|
10863
|
+
const maxBytes = model.constraints.references?.videoMaxBytes;
|
|
10864
|
+
const overBytes = maxBytes !== void 0 && measured(probe.bytes) && probe.bytes > maxBytes;
|
|
10865
|
+
const { width: probedWidth, height: probedHeight } = probe;
|
|
10866
|
+
if (!measured(probedWidth) || !measured(probedHeight)) return null;
|
|
10867
|
+
const width = Math.round(probedWidth);
|
|
10868
|
+
const height = Math.round(probedHeight);
|
|
10869
|
+
const size = sizeFix(model.constraints.references?.videoPixels, width, height);
|
|
10870
|
+
if (!size && !rate && !overBytes) return null;
|
|
10871
|
+
const round = size?.up ? evenUp : evenDown;
|
|
10872
|
+
const scale = size?.scale ?? 1;
|
|
10873
|
+
const reasons = [...size?.reasons ?? []];
|
|
10874
|
+
if (rate) reasons.push(rate.reason);
|
|
10875
|
+
if (overBytes) reasons.push("bytes_over");
|
|
10876
|
+
const plan = {
|
|
10877
|
+
width: round(width * scale),
|
|
10878
|
+
height: round(height * scale),
|
|
10879
|
+
reasons
|
|
10880
|
+
};
|
|
10881
|
+
if (rate) plan.fps = rate.fps;
|
|
10882
|
+
if (maxBytes !== void 0) plan.maxBytes = maxBytes;
|
|
10883
|
+
return plan;
|
|
10884
|
+
}
|
|
10885
|
+
function referenceImageConformPlan(model, probe) {
|
|
10886
|
+
const { width: probedWidth, height: probedHeight } = probe;
|
|
10887
|
+
if (!measured(probedWidth) || !measured(probedHeight)) return null;
|
|
10888
|
+
const references = model.constraints.references;
|
|
10889
|
+
const width = Math.round(probedWidth);
|
|
10890
|
+
const height = Math.round(probedHeight);
|
|
10891
|
+
const reasons = [];
|
|
10892
|
+
let frameWidth = width;
|
|
10893
|
+
let frameHeight = height;
|
|
10894
|
+
const aspect = references?.imageAspect;
|
|
10895
|
+
if (aspect?.min !== void 0 && width / height < aspect.min) {
|
|
10896
|
+
frameWidth = Math.ceil(height * aspect.min);
|
|
10897
|
+
reasons.push("aspect");
|
|
10898
|
+
} else if (aspect?.max !== void 0 && width / height > aspect.max) {
|
|
10899
|
+
frameHeight = Math.ceil(width / aspect.max);
|
|
10900
|
+
reasons.push("aspect");
|
|
10901
|
+
}
|
|
10902
|
+
const size = sizeFix(references?.imagePixels, frameWidth, frameHeight);
|
|
10903
|
+
if (!size && reasons.length === 0) return null;
|
|
10904
|
+
if (size) reasons.push(...size.reasons);
|
|
10905
|
+
const scale = size?.scale ?? 1;
|
|
10906
|
+
const round = size?.up ? Math.ceil : Math.floor;
|
|
10907
|
+
const frame = {
|
|
10908
|
+
width: Math.max(1, round(frameWidth * scale)),
|
|
10909
|
+
height: Math.max(1, round(frameHeight * scale))
|
|
10910
|
+
};
|
|
10911
|
+
const image = frameWidth > width ? {
|
|
10912
|
+
width: Math.max(1, Math.round(frame.height * width / height)),
|
|
10913
|
+
height: frame.height
|
|
10914
|
+
} : frameHeight > height ? {
|
|
10915
|
+
width: frame.width,
|
|
10916
|
+
height: Math.max(1, Math.round(frame.width * height / width))
|
|
10917
|
+
} : { ...frame };
|
|
10918
|
+
return { ...frame, image, reasons };
|
|
10919
|
+
}
|
|
10662
10920
|
export {
|
|
10663
10921
|
ADAPTER_IDS,
|
|
10664
10922
|
AUDIO_OUTPUTS,
|
|
@@ -10676,6 +10934,7 @@ export {
|
|
|
10676
10934
|
ModelKitError,
|
|
10677
10935
|
OTHER_MODELS,
|
|
10678
10936
|
REFERENCE_SYNTAXES,
|
|
10937
|
+
REFERENCE_VIDEO_CONFORM_PROFILE,
|
|
10679
10938
|
SURFACES2 as SURFACES,
|
|
10680
10939
|
SurfaceSchema,
|
|
10681
10940
|
TEXT_MODELS,
|
|
@@ -10703,6 +10962,8 @@ export {
|
|
|
10703
10962
|
planVideoTool,
|
|
10704
10963
|
primeCatalog,
|
|
10705
10964
|
promptConventions,
|
|
10965
|
+
referenceImageConformPlan,
|
|
10966
|
+
referenceVideoConformPlan,
|
|
10706
10967
|
resetLiveCatalog,
|
|
10707
10968
|
resolutionTier,
|
|
10708
10969
|
resolveAudioOptions,
|