@shop-os/modelkit 0.30.0 → 0.32.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 +39 -0
- package/dist/catalog.cjs +143 -21
- package/dist/catalog.cjs.map +1 -1
- package/dist/catalog.d.cts +14 -0
- package/dist/catalog.d.ts +14 -0
- package/dist/catalog.js +143 -21
- package/dist/catalog.js.map +1 -1
- package/dist/index.cjs +163 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +163 -33
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -799,6 +799,10 @@ interface ModelConstraints {
|
|
|
799
799
|
} | number[];
|
|
800
800
|
/** Curated UI choices when `durations` is a range; `resolveOptions` ignores it. */
|
|
801
801
|
durationPresets?: number[];
|
|
802
|
+
/** Video rows: the longest output, in seconds, at a resolution that renders shorter than `durations`. */
|
|
803
|
+
maxSecondsByResolution?: Partial<Record<VideoResolution, number>>;
|
|
804
|
+
/** Pickers pre-select `defaults.durationSeconds` over their own product default. */
|
|
805
|
+
preferDefaultDuration?: boolean;
|
|
802
806
|
/** Curated quality choices for rows whose `supports` includes "quality". */
|
|
803
807
|
qualityOptions?: string[];
|
|
804
808
|
/** Upscale rows: the `scaleFactor` values the row offers; absent means any. */
|
|
@@ -1401,6 +1405,16 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
|
|
|
1401
1405
|
max: z.ZodNumber;
|
|
1402
1406
|
}, z.core.$loose>, z.ZodArray<z.ZodNumber>]>>;
|
|
1403
1407
|
durationPresets: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
1408
|
+
maxSecondsByResolution: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
1409
|
+
"360p": "360p";
|
|
1410
|
+
"480p": "480p";
|
|
1411
|
+
"720p": "720p";
|
|
1412
|
+
"768p": "768p";
|
|
1413
|
+
"1080p": "1080p";
|
|
1414
|
+
"2k": "2k";
|
|
1415
|
+
"4k": "4k";
|
|
1416
|
+
}> & z.core.$partial, z.ZodNumber>>;
|
|
1417
|
+
preferDefaultDuration: z.ZodOptional<z.ZodBoolean>;
|
|
1404
1418
|
qualityOptions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1405
1419
|
scaleFactors: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
1406
1420
|
exactSizes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -799,6 +799,10 @@ interface ModelConstraints {
|
|
|
799
799
|
} | number[];
|
|
800
800
|
/** Curated UI choices when `durations` is a range; `resolveOptions` ignores it. */
|
|
801
801
|
durationPresets?: number[];
|
|
802
|
+
/** Video rows: the longest output, in seconds, at a resolution that renders shorter than `durations`. */
|
|
803
|
+
maxSecondsByResolution?: Partial<Record<VideoResolution, number>>;
|
|
804
|
+
/** Pickers pre-select `defaults.durationSeconds` over their own product default. */
|
|
805
|
+
preferDefaultDuration?: boolean;
|
|
802
806
|
/** Curated quality choices for rows whose `supports` includes "quality". */
|
|
803
807
|
qualityOptions?: string[];
|
|
804
808
|
/** Upscale rows: the `scaleFactor` values the row offers; absent means any. */
|
|
@@ -1401,6 +1405,16 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
|
|
|
1401
1405
|
max: z.ZodNumber;
|
|
1402
1406
|
}, z.core.$loose>, z.ZodArray<z.ZodNumber>]>>;
|
|
1403
1407
|
durationPresets: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
1408
|
+
maxSecondsByResolution: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
1409
|
+
"360p": "360p";
|
|
1410
|
+
"480p": "480p";
|
|
1411
|
+
"720p": "720p";
|
|
1412
|
+
"768p": "768p";
|
|
1413
|
+
"1080p": "1080p";
|
|
1414
|
+
"2k": "2k";
|
|
1415
|
+
"4k": "4k";
|
|
1416
|
+
}> & z.core.$partial, z.ZodNumber>>;
|
|
1417
|
+
preferDefaultDuration: z.ZodOptional<z.ZodBoolean>;
|
|
1404
1418
|
qualityOptions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1405
1419
|
scaleFactors: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
1406
1420
|
exactSizes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
package/dist/index.js
CHANGED
|
@@ -5748,7 +5748,9 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5748
5748
|
aspectRatios: ["adaptive", "16:9", "9:16", "1:1", "21:9"],
|
|
5749
5749
|
resolutions: ["720p", "1080p", "4k"],
|
|
5750
5750
|
durations: { min: 3, max: 30 },
|
|
5751
|
-
|
|
5751
|
+
preferDefaultDuration: true,
|
|
5752
|
+
// A 3 s 4K clip took 138 s on fal; 30 s could outlast the 15-minute result wait.
|
|
5753
|
+
maxSecondsByResolution: { "4k": 15 },
|
|
5752
5754
|
references: {
|
|
5753
5755
|
...NO_REFERENCES,
|
|
5754
5756
|
images: 10,
|
|
@@ -5787,6 +5789,8 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5787
5789
|
inputBilling: "kling-v4",
|
|
5788
5790
|
resolutions: ["720p", "1080p", "4k"],
|
|
5789
5791
|
durations: { min: 3, max: 30 },
|
|
5792
|
+
// A 3 s 4K clip took 138 s on fal; 30 s could outlast the 15-minute result wait.
|
|
5793
|
+
maxSecondsByResolution: { "4k": 15 },
|
|
5790
5794
|
references: { ...NO_REFERENCES, images: 10 },
|
|
5791
5795
|
requires: ["sourceVideo"],
|
|
5792
5796
|
sourceVideoSeconds: { min: 3, max: 30.05 },
|
|
@@ -5824,7 +5828,7 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5824
5828
|
aspectRatios: ["adaptive", "16:9", "9:16", "1:1", "21:9"],
|
|
5825
5829
|
resolutions: ["720p"],
|
|
5826
5830
|
durations: { min: 3, max: 20 },
|
|
5827
|
-
|
|
5831
|
+
preferDefaultDuration: true,
|
|
5828
5832
|
references: {
|
|
5829
5833
|
...NO_REFERENCES,
|
|
5830
5834
|
images: 10,
|
|
@@ -6271,6 +6275,76 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
6271
6275
|
description: "Speed-optimized Lightricks LTX 2.3 Fast text-to-video and start/end-frame image-to-video with native audio; 6-20 seconds at up to 4K, over 10 seconds at 1080p."
|
|
6272
6276
|
},
|
|
6273
6277
|
capabilities: { lastFrameRequiresFirstFrame: true }
|
|
6278
|
+
},
|
|
6279
|
+
{
|
|
6280
|
+
// https://fal.ai/models/lightricks/ltx-2.5/text-to-video/pro/api (+ /image-to-video/pro):
|
|
6281
|
+
// a Lightricks partner endpoint on fal. Pro renders 720p and 1080p only, 6/8/10 s;
|
|
6282
|
+
// no safety checker field. Routing and tiers as LTX 2.3 (adapters/fal-ltx.ts).
|
|
6283
|
+
id: "ltx-2.5",
|
|
6284
|
+
aliases: ["ltx-2-5", "ltx25", "ltx-2.5-pro"],
|
|
6285
|
+
label: "LTX 2.5",
|
|
6286
|
+
type: "video",
|
|
6287
|
+
adapter: "fal",
|
|
6288
|
+
providerModelId: "lightricks/ltx-2.5/text-to-video/pro",
|
|
6289
|
+
lifecycle: "active",
|
|
6290
|
+
exposure: ["cowork", "space_builder"],
|
|
6291
|
+
constraints: {
|
|
6292
|
+
aspectRatios: ["adaptive", "16:9", "9:16"],
|
|
6293
|
+
resolutions: ["720p", "1080p"],
|
|
6294
|
+
durations: [6, 8, 10],
|
|
6295
|
+
supports: ["generateAudio", "lastFrame"],
|
|
6296
|
+
prompt: { referenceSyntax: "numbered", maxChars: 5e3 },
|
|
6297
|
+
audio: "optional"
|
|
6298
|
+
},
|
|
6299
|
+
defaults: {
|
|
6300
|
+
durationSeconds: 6,
|
|
6301
|
+
resolution: "1080p",
|
|
6302
|
+
aspectRatio: "adaptive",
|
|
6303
|
+
generateAudio: true
|
|
6304
|
+
},
|
|
6305
|
+
usage: { ...VIDEO_USAGE },
|
|
6306
|
+
pricingKind: "video_per_second",
|
|
6307
|
+
display: {
|
|
6308
|
+
provider: "lightricks",
|
|
6309
|
+
logo: LIGHTRICKS_LOGO,
|
|
6310
|
+
description: "Lightricks LTX 2.5 Pro text-to-video and start/end-frame image-to-video with native audio; 6, 8 or 10 seconds at 720p or 1080p in landscape or portrait."
|
|
6311
|
+
},
|
|
6312
|
+
capabilities: { lastFrameRequiresFirstFrame: true }
|
|
6313
|
+
},
|
|
6314
|
+
{
|
|
6315
|
+
// https://fal.ai/models/lightricks/ltx-2.5/text-to-video/fast/api (+ /image-to-video/fast):
|
|
6316
|
+
// 720p to 2160p, even durations 6-20 s; over 10 s is 720p or 1080p at 24/25 fps only
|
|
6317
|
+
// (the kit never sends fps, so the rule checks the tier).
|
|
6318
|
+
id: "ltx-2.5-fast",
|
|
6319
|
+
aliases: ["ltx-2-5-fast", "ltx25-fast"],
|
|
6320
|
+
label: "LTX 2.5 Fast",
|
|
6321
|
+
type: "video",
|
|
6322
|
+
adapter: "fal",
|
|
6323
|
+
providerModelId: "lightricks/ltx-2.5/text-to-video/fast",
|
|
6324
|
+
lifecycle: "active",
|
|
6325
|
+
exposure: ["cowork", "space_builder"],
|
|
6326
|
+
constraints: {
|
|
6327
|
+
aspectRatios: ["adaptive", "16:9", "9:16"],
|
|
6328
|
+
resolutions: ["720p", "1080p", "2k", "4k"],
|
|
6329
|
+
durations: [6, 8, 10, 12, 14, 16, 18, 20],
|
|
6330
|
+
supports: ["generateAudio", "lastFrame"],
|
|
6331
|
+
prompt: { referenceSyntax: "numbered", maxChars: 5e3 },
|
|
6332
|
+
audio: "optional"
|
|
6333
|
+
},
|
|
6334
|
+
defaults: {
|
|
6335
|
+
durationSeconds: 6,
|
|
6336
|
+
resolution: "1080p",
|
|
6337
|
+
aspectRatio: "adaptive",
|
|
6338
|
+
generateAudio: true
|
|
6339
|
+
},
|
|
6340
|
+
usage: { ...VIDEO_USAGE },
|
|
6341
|
+
pricingKind: "video_per_second",
|
|
6342
|
+
display: {
|
|
6343
|
+
provider: "lightricks",
|
|
6344
|
+
logo: LIGHTRICKS_LOGO,
|
|
6345
|
+
description: "Speed-optimized Lightricks LTX 2.5 Fast text-to-video and start/end-frame image-to-video with native audio; 6-20 seconds at up to 4K, over 10 seconds at 720p or 1080p."
|
|
6346
|
+
},
|
|
6347
|
+
capabilities: { lastFrameRequiresFirstFrame: true }
|
|
6274
6348
|
}
|
|
6275
6349
|
];
|
|
6276
6350
|
|
|
@@ -6609,7 +6683,6 @@ var VIDEO_MODELS = [
|
|
|
6609
6683
|
aspectRatios: [...OMNI_RATIOS],
|
|
6610
6684
|
resolutions: ["360p", "720p", "1080p", "4k"],
|
|
6611
6685
|
durations: { min: 3, max: 15 },
|
|
6612
|
-
durationPresets: [3, 5, 8, 10, 15],
|
|
6613
6686
|
references: { images: 6, videos: 1, videoSeconds: { max: 10 } },
|
|
6614
6687
|
sourceVideoSeconds: { max: 15 },
|
|
6615
6688
|
supports: ["videoExtension", "lastFrame"],
|
|
@@ -7176,7 +7249,7 @@ var VIDEO_MODELS = [
|
|
|
7176
7249
|
aspectRatios: [...WAN_RATIOS],
|
|
7177
7250
|
resolutions: ["480p", "720p", "1080p"],
|
|
7178
7251
|
durations: { min: 2, max: 30 },
|
|
7179
|
-
|
|
7252
|
+
preferDefaultDuration: true,
|
|
7180
7253
|
references: {
|
|
7181
7254
|
images: 10,
|
|
7182
7255
|
videos: 5,
|
|
@@ -7218,7 +7291,7 @@ var VIDEO_MODELS = [
|
|
|
7218
7291
|
aspectRatios: [...WAN_RATIOS],
|
|
7219
7292
|
resolutions: ["480p", "720p", "1080p"],
|
|
7220
7293
|
durations: { min: 2, max: 30 },
|
|
7221
|
-
|
|
7294
|
+
preferDefaultDuration: true,
|
|
7222
7295
|
references: {
|
|
7223
7296
|
images: 10,
|
|
7224
7297
|
videos: 5,
|
|
@@ -8770,6 +8843,8 @@ var ModelConstraintsSchema = z3.looseObject({
|
|
|
8770
8843
|
resolutions: z3.array(VideoResolutionSchema).optional(),
|
|
8771
8844
|
durations: z3.union([z3.looseObject({ min: z3.number(), max: z3.number() }), z3.array(z3.number())]).optional(),
|
|
8772
8845
|
durationPresets: z3.array(z3.number()).optional(),
|
|
8846
|
+
maxSecondsByResolution: z3.partialRecord(VideoResolutionSchema, z3.number().positive()).optional(),
|
|
8847
|
+
preferDefaultDuration: z3.boolean().optional(),
|
|
8773
8848
|
qualityOptions: z3.array(z3.string()).optional(),
|
|
8774
8849
|
scaleFactors: z3.array(z3.number().positive()).min(1).optional(),
|
|
8775
8850
|
exactSizes: z3.record(z3.string(), z3.string()).optional(),
|
|
@@ -8996,6 +9071,19 @@ var CatalogModelSchema = CatalogModelSchemaBase.superRefine(
|
|
|
8996
9071
|
}
|
|
8997
9072
|
}
|
|
8998
9073
|
}
|
|
9074
|
+
const durations = row2.constraints.durations;
|
|
9075
|
+
for (const [resolution, max] of Object.entries(
|
|
9076
|
+
row2.constraints.maxSecondsByResolution ?? {}
|
|
9077
|
+
)) {
|
|
9078
|
+
const inRange = durations === void 0 || (Array.isArray(durations) ? durations.some((d) => d <= max) && max <= Math.max(...durations) : max >= durations.min && max <= durations.max);
|
|
9079
|
+
if (!Number.isInteger(max) || !inRange) {
|
|
9080
|
+
ctx.addIssue({
|
|
9081
|
+
code: "custom",
|
|
9082
|
+
path: ["constraints", "maxSecondsByResolution", resolution],
|
|
9083
|
+
message: "a resolution cap must be whole seconds within the row's durations"
|
|
9084
|
+
});
|
|
9085
|
+
}
|
|
9086
|
+
}
|
|
8999
9087
|
const audio = row2.constraints.audio;
|
|
9000
9088
|
if (audio !== void 0 && !AudioOutputSchema.safeParse(audio).success) {
|
|
9001
9089
|
ctx.addIssue({
|
|
@@ -10366,6 +10454,8 @@ var VIDU_Q4 = "fal-ai/vidu/q4";
|
|
|
10366
10454
|
var OMNIHUMAN_V2 = "bytedance/omnihuman/v2";
|
|
10367
10455
|
var LTX_T2V = "fal-ai/ltx-2.3/text-to-video";
|
|
10368
10456
|
var LTX_FAST_T2V = "fal-ai/ltx-2.3/text-to-video/fast";
|
|
10457
|
+
var LTX25_T2V = "lightricks/ltx-2.5/text-to-video/pro";
|
|
10458
|
+
var LTX25_FAST_T2V = "lightricks/ltx-2.5/text-to-video/fast";
|
|
10369
10459
|
var KLING_O3_IMAGE_CAP = 7;
|
|
10370
10460
|
var KLING_V4_IMAGE_CAP = 10;
|
|
10371
10461
|
var TURBO_AUDIO_MIN_SECONDS = 2;
|
|
@@ -10436,15 +10526,16 @@ function hasReferences(req) {
|
|
|
10436
10526
|
return count(req.referenceImages) + count(req.referenceVideos) > 0;
|
|
10437
10527
|
}
|
|
10438
10528
|
var KLING_V4_4K_MAX_SECONDS = 15;
|
|
10439
|
-
function klingV4FourK(seconds3, req) {
|
|
10529
|
+
function klingV4FourK(seconds3, req, model) {
|
|
10440
10530
|
if (req.resolution !== "4k") return void 0;
|
|
10531
|
+
const max = model.constraints.maxSecondsByResolution?.["4k"] ?? KLING_V4_4K_MAX_SECONDS;
|
|
10441
10532
|
if (seconds3 === void 0) {
|
|
10442
|
-
return missing(`needs a measured source video of up to ${
|
|
10533
|
+
return missing(`needs a measured source video of up to ${max} s at 4K`);
|
|
10443
10534
|
}
|
|
10444
|
-
return seconds3 >
|
|
10535
|
+
return seconds3 > max ? unsupported3(`renders at most ${max} s at 4K`) : void 0;
|
|
10445
10536
|
}
|
|
10446
|
-
function klingV4(req) {
|
|
10447
|
-
const fourK = klingV4FourK(req.durationSeconds ?? 5, req);
|
|
10537
|
+
function klingV4(req, model) {
|
|
10538
|
+
const fourK = klingV4FourK(req.durationSeconds ?? 5, req, model);
|
|
10448
10539
|
if (fourK !== void 0) return fourK;
|
|
10449
10540
|
if (hasReferences(req)) {
|
|
10450
10541
|
if (req.lastFrame !== void 0) {
|
|
@@ -10459,10 +10550,10 @@ function klingV4(req) {
|
|
|
10459
10550
|
}
|
|
10460
10551
|
return needsPrompt(req);
|
|
10461
10552
|
}
|
|
10462
|
-
function klingV4Flash(req) {
|
|
10553
|
+
function klingV4Flash(req, model) {
|
|
10463
10554
|
if (req.lastFrame !== void 0) return unsupported3("takes no end frame");
|
|
10464
10555
|
if (!hasReferences(req) && req.firstFrame !== void 0) return void 0;
|
|
10465
|
-
return klingV4(req);
|
|
10556
|
+
return klingV4(req, model);
|
|
10466
10557
|
}
|
|
10467
10558
|
function h3Turbo(req) {
|
|
10468
10559
|
if (count(req.referenceImages) + count(req.referenceVideos) > 0) {
|
|
@@ -10542,7 +10633,7 @@ function imageAndAudio(req, audioSeconds) {
|
|
|
10542
10633
|
}
|
|
10543
10634
|
return inputSeconds("audio", audio, audioSeconds);
|
|
10544
10635
|
}
|
|
10545
|
-
function ltx(
|
|
10636
|
+
function ltx(longTiers) {
|
|
10546
10637
|
return (req) => {
|
|
10547
10638
|
if (req.lastFrame !== void 0 && req.firstFrame === void 0) {
|
|
10548
10639
|
return missing("takes an end frame only together with a start frame");
|
|
@@ -10550,8 +10641,8 @@ function ltx(fast) {
|
|
|
10550
10641
|
if (count(req.referenceImages) + count(req.referenceVideos) + count(req.referenceAudios) > 0) {
|
|
10551
10642
|
return unsupported3("takes no reference images, videos or audio");
|
|
10552
10643
|
}
|
|
10553
|
-
if (
|
|
10554
|
-
return unsupported3(
|
|
10644
|
+
if (longTiers !== null && (req.durationSeconds ?? 6) > 10 && req.resolution !== void 0 && !longTiers.includes(req.resolution)) {
|
|
10645
|
+
return unsupported3(`renders over 10 s at ${longTiers.join(" or ")} only`);
|
|
10555
10646
|
}
|
|
10556
10647
|
return needsPrompt(req);
|
|
10557
10648
|
};
|
|
@@ -10565,7 +10656,7 @@ var RULES = new Map([
|
|
|
10565
10656
|
[KLING_V4, klingV4],
|
|
10566
10657
|
[
|
|
10567
10658
|
KLING_V4_EDIT,
|
|
10568
|
-
(req) => needsSource(req) ?? klingV4FourK(req.durationSeconds ?? req.sourceVideo?.durationSeconds, req) ?? needsPrompt(req)
|
|
10659
|
+
(req, model) => needsSource(req) ?? klingV4FourK(req.durationSeconds ?? req.sourceVideo?.durationSeconds, req, model) ?? needsPrompt(req)
|
|
10569
10660
|
],
|
|
10570
10661
|
[KLING_V4_FLASH, klingV4Flash],
|
|
10571
10662
|
[KLING_V4_FLASH_EDIT, (req) => needsSource(req) ?? needsPrompt(req)],
|
|
@@ -10580,11 +10671,13 @@ var RULES = new Map([
|
|
|
10580
10671
|
...AVATAR_AUDIO.map(
|
|
10581
10672
|
([id, limits]) => [id, (req) => imageAndAudio(req, limits)]
|
|
10582
10673
|
),
|
|
10583
|
-
[LTX_T2V, ltx(
|
|
10584
|
-
[LTX_FAST_T2V, ltx(
|
|
10674
|
+
[LTX_T2V, ltx(null)],
|
|
10675
|
+
[LTX_FAST_T2V, ltx(["1080p"])],
|
|
10676
|
+
[LTX25_T2V, ltx(null)],
|
|
10677
|
+
[LTX25_FAST_T2V, ltx(["720p", "1080p"])]
|
|
10585
10678
|
]);
|
|
10586
|
-
function falVideoProblem(
|
|
10587
|
-
return RULES.get(providerModelId.toLowerCase())?.(req);
|
|
10679
|
+
function falVideoProblem(model, req) {
|
|
10680
|
+
return RULES.get(model.providerModelId.toLowerCase())?.(req, model);
|
|
10588
10681
|
}
|
|
10589
10682
|
function viduSilentWarning(model) {
|
|
10590
10683
|
return {
|
|
@@ -10615,7 +10708,7 @@ function fillKlingModeResolution(model, req) {
|
|
|
10615
10708
|
}
|
|
10616
10709
|
function applyFalVideoRules(model, req, callerRatio, warnings) {
|
|
10617
10710
|
if (model.adapter !== "fal" && model.adapter !== "alibaba") return;
|
|
10618
|
-
const problem = falVideoProblem(model
|
|
10711
|
+
const problem = falVideoProblem(model, withPromptForResolve(req));
|
|
10619
10712
|
if (problem !== void 0) throw ruleRefusal(model, problem.message, problem.code);
|
|
10620
10713
|
const id = model.providerModelId.toLowerCase();
|
|
10621
10714
|
const references = count(req.referenceImages) + count(req.referenceAudios);
|
|
@@ -10728,7 +10821,7 @@ function happyHorseBody(req, ctx) {
|
|
|
10728
10821
|
}
|
|
10729
10822
|
function planAlibabaVideo(req, ctx) {
|
|
10730
10823
|
const id = ctx.model.providerModelId.toLowerCase();
|
|
10731
|
-
const problem = falVideoProblem(
|
|
10824
|
+
const problem = falVideoProblem(ctx.model, req);
|
|
10732
10825
|
if (problem !== void 0) throw ruleRefusal(ctx.model, problem.message, problem.code);
|
|
10733
10826
|
if (WAN_VIDEO_IDS.has(id)) return wanBody(req, ctx);
|
|
10734
10827
|
if (id === HAPPY_HORSE_FAMILY) return happyHorseBody(req, ctx);
|
|
@@ -13787,6 +13880,10 @@ var LTX_T2V2 = "fal-ai/ltx-2.3/text-to-video";
|
|
|
13787
13880
|
var LTX_I2V = "fal-ai/ltx-2.3/image-to-video";
|
|
13788
13881
|
var LTX_FAST_T2V2 = "fal-ai/ltx-2.3/text-to-video/fast";
|
|
13789
13882
|
var LTX_FAST_I2V = "fal-ai/ltx-2.3/image-to-video/fast";
|
|
13883
|
+
var LTX25_T2V2 = "lightricks/ltx-2.5/text-to-video/pro";
|
|
13884
|
+
var LTX25_I2V = "lightricks/ltx-2.5/image-to-video/pro";
|
|
13885
|
+
var LTX25_FAST_T2V2 = "lightricks/ltx-2.5/text-to-video/fast";
|
|
13886
|
+
var LTX25_FAST_I2V = "lightricks/ltx-2.5/image-to-video/fast";
|
|
13790
13887
|
var LTX_TIERS = {
|
|
13791
13888
|
"360p": "360p",
|
|
13792
13889
|
"480p": "480p",
|
|
@@ -13796,7 +13893,13 @@ var LTX_TIERS = {
|
|
|
13796
13893
|
"2k": "1440p",
|
|
13797
13894
|
"4k": "2160p"
|
|
13798
13895
|
};
|
|
13799
|
-
|
|
13896
|
+
var I2V_OF = /* @__PURE__ */ new Map([
|
|
13897
|
+
[LTX_T2V2, LTX_I2V],
|
|
13898
|
+
[LTX_FAST_T2V2, LTX_FAST_I2V],
|
|
13899
|
+
[LTX25_T2V2, LTX25_I2V],
|
|
13900
|
+
[LTX25_FAST_T2V2, LTX25_FAST_I2V]
|
|
13901
|
+
]);
|
|
13902
|
+
function ltxGenerate(t2v, i2v, req, ctx) {
|
|
13800
13903
|
const resolution = resolutionOf2(req, ctx);
|
|
13801
13904
|
const duration = wholeSeconds(req, ctx);
|
|
13802
13905
|
const input = {
|
|
@@ -13805,9 +13908,11 @@ function ltxGenerate(fast, req, ctx) {
|
|
|
13805
13908
|
resolution: LTX_TIERS[resolution],
|
|
13806
13909
|
generate_audio: req.generateAudio ?? true
|
|
13807
13910
|
};
|
|
13808
|
-
if (req.safetyChecker !== void 0
|
|
13911
|
+
if (req.safetyChecker !== void 0 && t2v.startsWith("fal-ai/ltx-2.3/")) {
|
|
13912
|
+
input["enable_safety_checker"] = req.safetyChecker;
|
|
13913
|
+
}
|
|
13809
13914
|
const firstFrame = req.firstFrame;
|
|
13810
|
-
const endpoint = firstFrame === void 0 ?
|
|
13915
|
+
const endpoint = firstFrame === void 0 ? t2v : i2v;
|
|
13811
13916
|
if (firstFrame === void 0) {
|
|
13812
13917
|
const ratio = concreteRatio(req);
|
|
13813
13918
|
if (ratio !== void 0) input["aspect_ratio"] = ratio;
|
|
@@ -13820,17 +13925,13 @@ function ltxGenerate(fast, req, ctx) {
|
|
|
13820
13925
|
}
|
|
13821
13926
|
return { endpoint, input, resolution, seconds: requestedSeconds(duration) };
|
|
13822
13927
|
}
|
|
13823
|
-
var LTX_MODEL_IDS =
|
|
13824
|
-
LTX_T2V2,
|
|
13825
|
-
LTX_I2V,
|
|
13826
|
-
LTX_FAST_T2V2,
|
|
13827
|
-
LTX_FAST_I2V
|
|
13828
|
-
]);
|
|
13928
|
+
var LTX_MODEL_IDS = new Set([...I2V_OF.entries()].flat());
|
|
13829
13929
|
var ltxFamily = {
|
|
13830
13930
|
ids: LTX_MODEL_IDS,
|
|
13831
13931
|
plan(req, ctx) {
|
|
13832
13932
|
const id = ctx.model.providerModelId.toLowerCase();
|
|
13833
|
-
|
|
13933
|
+
const t2v = I2V_OF.has(id) ? id : [...I2V_OF.entries()].find(([, i2v]) => i2v === id)?.[0] ?? LTX_T2V2;
|
|
13934
|
+
return ltxGenerate(t2v, I2V_OF.get(t2v) ?? LTX_I2V, req, ctx);
|
|
13834
13935
|
}
|
|
13835
13936
|
};
|
|
13836
13937
|
|
|
@@ -14017,7 +14118,7 @@ function planFalFamilyVideo(req, ctx) {
|
|
|
14017
14118
|
const id = ctx.model.providerModelId.toLowerCase();
|
|
14018
14119
|
const family = FAMILIES2.find((f) => f.ids.has(id));
|
|
14019
14120
|
if (family === void 0) return void 0;
|
|
14020
|
-
const problem = falVideoProblem(
|
|
14121
|
+
const problem = falVideoProblem(ctx.model, req);
|
|
14021
14122
|
if (problem !== void 0) throw refusal2(ctx, problem.message, problem.code);
|
|
14022
14123
|
return family.plan(req, ctx);
|
|
14023
14124
|
}
|
|
@@ -19809,6 +19910,27 @@ function resolveDuration(requested, durations, model, onUnsupported, warnings) {
|
|
|
19809
19910
|
});
|
|
19810
19911
|
return to;
|
|
19811
19912
|
}
|
|
19913
|
+
function capDurationAtResolution(seconds3, resolution, model, onUnsupported, warnings) {
|
|
19914
|
+
if (seconds3 === void 0 || resolution === void 0) return seconds3;
|
|
19915
|
+
const max = model.constraints.maxSecondsByResolution?.[resolution];
|
|
19916
|
+
if (max === void 0 || seconds3 <= max) return seconds3;
|
|
19917
|
+
const shown = resolution.endsWith("k") ? resolution.toUpperCase() : resolution;
|
|
19918
|
+
if (onUnsupported === "error") {
|
|
19919
|
+
throw new ModelKitError({
|
|
19920
|
+
code: "unsupported_option",
|
|
19921
|
+
message: `${model.id} renders at most ${max} s at ${shown}`,
|
|
19922
|
+
model: model.id
|
|
19923
|
+
});
|
|
19924
|
+
}
|
|
19925
|
+
warnings.push({
|
|
19926
|
+
code: "duration_coerced",
|
|
19927
|
+
field: "durationSeconds",
|
|
19928
|
+
from: seconds3,
|
|
19929
|
+
to: max,
|
|
19930
|
+
message: `duration ${seconds3}s coerced to ${max}s for ${model.id} at ${shown}`
|
|
19931
|
+
});
|
|
19932
|
+
return max;
|
|
19933
|
+
}
|
|
19812
19934
|
function resolveAspectRatio(requested, supported, model, onUnsupported, warnings) {
|
|
19813
19935
|
if (requested === void 0 || requested === "adaptive" || !supported) return requested;
|
|
19814
19936
|
if (supported.includes(requested)) return requested;
|
|
@@ -20128,6 +20250,14 @@ function resolveVideoOptions(model, request, onUnsupported = "error") {
|
|
|
20128
20250
|
warnings
|
|
20129
20251
|
);
|
|
20130
20252
|
if (duration !== void 0) merged.durationSeconds = duration;
|
|
20253
|
+
const capped = capDurationAtResolution(
|
|
20254
|
+
merged.durationSeconds,
|
|
20255
|
+
resolution,
|
|
20256
|
+
model,
|
|
20257
|
+
onUnsupported,
|
|
20258
|
+
warnings
|
|
20259
|
+
);
|
|
20260
|
+
if (capped !== void 0) merged.durationSeconds = capped;
|
|
20131
20261
|
const limits = c.references ?? {};
|
|
20132
20262
|
let images = trim(
|
|
20133
20263
|
"referenceImages",
|