@shop-os/modelkit 0.16.0 → 0.17.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 +8 -0
- package/dist/catalog.cjs +90 -1
- package/dist/catalog.cjs.map +1 -1
- package/dist/catalog.js +90 -1
- package/dist/catalog.js.map +1 -1
- package/dist/index.cjs +118 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +118 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5222,6 +5222,7 @@ var KLING_PROMPT = { referenceSyntax: "numbered", maxChars: 2500 };
|
|
|
5222
5222
|
var H3_PROMPT = { referenceSyntax: "numbered", maxChars: 5e4 };
|
|
5223
5223
|
var KLING_V4_PROMPT = { referenceSyntax: "numbered", maxChars: 2500 };
|
|
5224
5224
|
var KLING_V4_AUDIO = "always";
|
|
5225
|
+
var KLING_V4_FLASH_PROMPT = { referenceSyntax: "numbered", maxChars: 26e3 };
|
|
5225
5226
|
var NO_REFERENCES = { images: 0, videos: 0, audios: 0 };
|
|
5226
5227
|
function klingMotionControl(tier) {
|
|
5227
5228
|
const label = tier === "pro" ? "Pro" : "Standard";
|
|
@@ -5399,6 +5400,85 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5399
5400
|
},
|
|
5400
5401
|
capabilities: { acceptsSourceVideo: true, videoEdit: true }
|
|
5401
5402
|
},
|
|
5403
|
+
{
|
|
5404
|
+
// https://fal.ai/models/kling/v4/flash/reference-to-video/api (+ /text-to-video,
|
|
5405
|
+
// /image-to-video): routed like kling-4.0, at 720p only and 3-20 s. image-to-video takes
|
|
5406
|
+
// a start frame (300 px min, ratio 0.40-2.50) and no end frame; its prompt is optional.
|
|
5407
|
+
// Reference images: 10, the start frame included. Reference videos: 5, 3-20.05 s each
|
|
5408
|
+
// and 20 s combined, 700 px min. Prompts up to 26,000 characters. No sound switch.
|
|
5409
|
+
id: "kling-4.0-flash",
|
|
5410
|
+
aliases: ["kling-4-flash", "kling-v4-flash"],
|
|
5411
|
+
label: "Kling 4.0 Flash",
|
|
5412
|
+
type: "video",
|
|
5413
|
+
adapter: "fal",
|
|
5414
|
+
providerModelId: "kling/v4/flash",
|
|
5415
|
+
lifecycle: "active",
|
|
5416
|
+
exposure: ["cowork", "space_builder"],
|
|
5417
|
+
constraints: {
|
|
5418
|
+
aspectRatios: ["adaptive", "16:9", "9:16", "1:1", "21:9"],
|
|
5419
|
+
resolutions: ["720p"],
|
|
5420
|
+
durations: { min: 3, max: 20 },
|
|
5421
|
+
durationPresets: [5, 10, 15, 20],
|
|
5422
|
+
references: {
|
|
5423
|
+
...NO_REFERENCES,
|
|
5424
|
+
images: 10,
|
|
5425
|
+
videos: 5,
|
|
5426
|
+
videoSeconds: { min: 3, max: 20.05, total: 20 },
|
|
5427
|
+
videoPixels: { minWidth: 700, minHeight: 700 }
|
|
5428
|
+
},
|
|
5429
|
+
supports: [],
|
|
5430
|
+
prompt: KLING_V4_FLASH_PROMPT,
|
|
5431
|
+
audio: KLING_V4_AUDIO
|
|
5432
|
+
},
|
|
5433
|
+
defaults: { durationSeconds: 5, resolution: "720p", aspectRatio: "16:9" },
|
|
5434
|
+
usage: { ...VIDEO_USAGE },
|
|
5435
|
+
pricingKind: "video_per_second",
|
|
5436
|
+
display: {
|
|
5437
|
+
provider: "kuaishou",
|
|
5438
|
+
logo: KLING_LOGO,
|
|
5439
|
+
description: "Kuaishou Kling 4.0 Flash: fast text-to-video, a start frame, or reference-to-video from up to 10 images and 5 videos (20 seconds combined), 3 to 20 seconds at 720p. Prompts name references @Image1, @Video1."
|
|
5440
|
+
}
|
|
5441
|
+
},
|
|
5442
|
+
{
|
|
5443
|
+
// https://fal.ai/models/kling/v4/flash/video-to-video/api: source 3-20.05 s (700 px
|
|
5444
|
+
// min, 23.9-60.05 fps), up to 10 reference images and 4 reference videos; the source
|
|
5445
|
+
// and reference videos total 20 s at most. duration 3-20, or left out for the source's
|
|
5446
|
+
// length. The prompt names the source @Video1, reference videos @Video2 on, images @Image1.
|
|
5447
|
+
id: "kling-4.0-flash-edit",
|
|
5448
|
+
aliases: ["kling-4-flash-edit", "kling-v4-flash-edit"],
|
|
5449
|
+
label: "Kling 4.0 Flash Edit",
|
|
5450
|
+
type: "video",
|
|
5451
|
+
adapter: "fal",
|
|
5452
|
+
providerModelId: "kling/v4/flash/video-to-video",
|
|
5453
|
+
lifecycle: "active",
|
|
5454
|
+
exposure: ["cowork", "space_builder"],
|
|
5455
|
+
constraints: {
|
|
5456
|
+
resolutions: ["720p"],
|
|
5457
|
+
durations: { min: 3, max: 20 },
|
|
5458
|
+
references: {
|
|
5459
|
+
...NO_REFERENCES,
|
|
5460
|
+
images: 10,
|
|
5461
|
+
videos: 4,
|
|
5462
|
+
videoSeconds: { min: 3, max: 20.05, total: 20 },
|
|
5463
|
+
videoPixels: { minWidth: 700, minHeight: 700 }
|
|
5464
|
+
},
|
|
5465
|
+
requires: ["sourceVideo"],
|
|
5466
|
+
sourceVideoSeconds: { min: 3, max: 20.05, inReferenceTotal: true },
|
|
5467
|
+
sourceVideoPixels: { minWidth: 700, minHeight: 700 },
|
|
5468
|
+
supports: [],
|
|
5469
|
+
prompt: KLING_V4_FLASH_PROMPT,
|
|
5470
|
+
audio: KLING_V4_AUDIO
|
|
5471
|
+
},
|
|
5472
|
+
defaults: { resolution: "720p" },
|
|
5473
|
+
usage: { ...VIDEO_USAGE },
|
|
5474
|
+
pricingKind: "video_per_second",
|
|
5475
|
+
display: {
|
|
5476
|
+
provider: "kuaishou",
|
|
5477
|
+
logo: KLING_LOGO,
|
|
5478
|
+
description: "Kuaishou Kling 4.0 Flash video edit: change a 3-20 second clip with a prompt, up to 10 reference images and 4 reference videos (20 seconds in all with the source), at 720p, as long as the source or a set 3-20 seconds. Prompts name the source @Video1."
|
|
5479
|
+
},
|
|
5480
|
+
capabilities: { acceptsSourceVideo: true, videoEdit: true }
|
|
5481
|
+
},
|
|
5402
5482
|
{
|
|
5403
5483
|
// https://fal.ai/models/minimax/h3-max-turbo/text-to-video/api (+ /image-to-video).
|
|
5404
5484
|
// image-to-video takes a start frame, an end frame, or both, and no aspect_ratio.
|
|
@@ -11854,8 +11934,13 @@ var MOTION_PRO = "fal-ai/kling-video/v3/pro/motion-control";
|
|
|
11854
11934
|
var MOTION_STANDARD = "fal-ai/kling-video/v3/standard/motion-control";
|
|
11855
11935
|
var O3_REFERENCE = "fal-ai/kling-video/o3/pro/reference-to-video";
|
|
11856
11936
|
var O3_EDIT = "fal-ai/kling-video/o3/pro/video-to-video/edit";
|
|
11857
|
-
var
|
|
11858
|
-
var
|
|
11937
|
+
var V4 = { generate: "kling/v4", edit: "kling/v4/video-to-video/edit", flash: false };
|
|
11938
|
+
var V4_FLASH = {
|
|
11939
|
+
generate: "kling/v4/flash",
|
|
11940
|
+
edit: "kling/v4/flash/video-to-video",
|
|
11941
|
+
flash: true
|
|
11942
|
+
};
|
|
11943
|
+
var V4_VARIANTS = [V4, V4_FLASH];
|
|
11859
11944
|
function motionControl(endpoint, req, ctx) {
|
|
11860
11945
|
const [character] = req.referenceImages ?? [];
|
|
11861
11946
|
const [motion] = req.referenceVideos ?? [];
|
|
@@ -11915,15 +12000,18 @@ var klingV3Family = {
|
|
|
11915
12000
|
return motionControl(id, req, ctx);
|
|
11916
12001
|
}
|
|
11917
12002
|
};
|
|
11918
|
-
function v4Generate(req, ctx) {
|
|
12003
|
+
function v4Generate(variant, req, ctx) {
|
|
11919
12004
|
const images = urls(req.referenceImages);
|
|
11920
12005
|
const videos = urls(req.referenceVideos);
|
|
11921
12006
|
const duration = wholeSeconds(req, ctx);
|
|
11922
12007
|
const resolution = resolutionOf(req, ctx);
|
|
11923
|
-
const
|
|
12008
|
+
const references = images.length + videos.length > 0;
|
|
12009
|
+
const input = { duration, resolution };
|
|
12010
|
+
if (variant.flash && !references && req.firstFrame) optionalPrompt(input, req);
|
|
12011
|
+
else input["prompt"] = req.prompt.trim();
|
|
11924
12012
|
let endpoint;
|
|
11925
|
-
if (
|
|
11926
|
-
endpoint = `${
|
|
12013
|
+
if (references) {
|
|
12014
|
+
endpoint = `${variant.generate}/reference-to-video`;
|
|
11927
12015
|
if (images.length > 0) input["image_urls"] = images;
|
|
11928
12016
|
if (videos.length > 0) input["video_urls"] = videos;
|
|
11929
12017
|
if (req.firstFrame) input["start_image_url"] = refToUrl(req.firstFrame);
|
|
@@ -11931,17 +12019,17 @@ function v4Generate(req, ctx) {
|
|
|
11931
12019
|
input["aspect_ratio"] = req.aspectRatio === "adaptive" ? "auto" : req.aspectRatio;
|
|
11932
12020
|
}
|
|
11933
12021
|
} else if (req.firstFrame) {
|
|
11934
|
-
endpoint = `${
|
|
12022
|
+
endpoint = `${variant.generate}/image-to-video`;
|
|
11935
12023
|
input["start_image_url"] = refToUrl(req.firstFrame);
|
|
11936
12024
|
if (req.lastFrame) input["end_image_url"] = refToUrl(req.lastFrame);
|
|
11937
12025
|
} else {
|
|
11938
|
-
endpoint = `${
|
|
12026
|
+
endpoint = `${variant.generate}/text-to-video`;
|
|
11939
12027
|
const ratio = concreteRatio(req);
|
|
11940
12028
|
if (ratio !== void 0) input["aspect_ratio"] = ratio;
|
|
11941
12029
|
}
|
|
11942
12030
|
return { endpoint, input, resolution, seconds: requestedSeconds(duration) };
|
|
11943
12031
|
}
|
|
11944
|
-
function v4Edit(req, ctx) {
|
|
12032
|
+
function v4Edit(variant, req, ctx) {
|
|
11945
12033
|
if (req.sourceVideo === void 0) throw refusal(ctx, "needs a source video", "missing_input");
|
|
11946
12034
|
const resolution = resolutionOf(req, ctx);
|
|
11947
12035
|
const input = {
|
|
@@ -11951,9 +12039,11 @@ function v4Edit(req, ctx) {
|
|
|
11951
12039
|
};
|
|
11952
12040
|
const images = urls(req.referenceImages);
|
|
11953
12041
|
if (images.length > 0) input["image_urls"] = images;
|
|
12042
|
+
const videos = urls(req.referenceVideos);
|
|
12043
|
+
if (variant.flash && videos.length > 0) input["video_urls"] = videos;
|
|
11954
12044
|
if (req.durationSeconds === void 0) {
|
|
11955
12045
|
return {
|
|
11956
|
-
endpoint:
|
|
12046
|
+
endpoint: variant.edit,
|
|
11957
12047
|
input,
|
|
11958
12048
|
resolution,
|
|
11959
12049
|
seconds: inputLengthSeconds(req, req.sourceVideo)
|
|
@@ -11961,13 +12051,18 @@ function v4Edit(req, ctx) {
|
|
|
11961
12051
|
}
|
|
11962
12052
|
const duration = wholeSeconds(req, ctx);
|
|
11963
12053
|
input["duration"] = duration;
|
|
11964
|
-
return { endpoint:
|
|
12054
|
+
return { endpoint: variant.edit, input, resolution, seconds: requestedSeconds(duration) };
|
|
11965
12055
|
}
|
|
11966
|
-
var KLING_V4_VIDEO_IDS =
|
|
12056
|
+
var KLING_V4_VIDEO_IDS = new Set(
|
|
12057
|
+
V4_VARIANTS.flatMap((v) => [v.generate, v.edit])
|
|
12058
|
+
);
|
|
11967
12059
|
var klingV4Family = {
|
|
11968
12060
|
ids: KLING_V4_VIDEO_IDS,
|
|
11969
12061
|
plan(req, ctx) {
|
|
11970
|
-
|
|
12062
|
+
const id = ctx.model.providerModelId.toLowerCase();
|
|
12063
|
+
const edit2 = V4_VARIANTS.find((v) => v.edit === id);
|
|
12064
|
+
if (edit2 !== void 0) return v4Edit(edit2, req, ctx);
|
|
12065
|
+
return v4Generate(V4_VARIANTS.find((v) => v.generate === id) ?? V4, req, ctx);
|
|
11971
12066
|
}
|
|
11972
12067
|
};
|
|
11973
12068
|
|
|
@@ -12042,6 +12137,8 @@ var O3_REFERENCE2 = "fal-ai/kling-video/o3/pro/reference-to-video";
|
|
|
12042
12137
|
var O3_EDIT2 = "fal-ai/kling-video/o3/pro/video-to-video/edit";
|
|
12043
12138
|
var KLING_V4 = "kling/v4";
|
|
12044
12139
|
var KLING_V4_EDIT = "kling/v4/video-to-video/edit";
|
|
12140
|
+
var KLING_V4_FLASH = "kling/v4/flash";
|
|
12141
|
+
var KLING_V4_FLASH_EDIT = "kling/v4/flash/video-to-video";
|
|
12045
12142
|
var H3_TURBO = "minimax/h3-max-turbo";
|
|
12046
12143
|
var H3_RECAST = "minimax/h3-max/recast";
|
|
12047
12144
|
var H3_RELIGHT = "minimax/h3-max/relight";
|
|
@@ -12123,6 +12220,11 @@ function klingV4(req) {
|
|
|
12123
12220
|
}
|
|
12124
12221
|
return needsPrompt(req);
|
|
12125
12222
|
}
|
|
12223
|
+
function klingV4Flash(req) {
|
|
12224
|
+
if (req.lastFrame !== void 0) return unsupported2("takes no end frame");
|
|
12225
|
+
if (!hasReferences(req) && req.firstFrame !== void 0) return void 0;
|
|
12226
|
+
return klingV4(req);
|
|
12227
|
+
}
|
|
12126
12228
|
function h3Turbo(req) {
|
|
12127
12229
|
if (count(req.referenceImages) + count(req.referenceVideos) > 0) {
|
|
12128
12230
|
return unsupported2("takes no reference images or videos");
|
|
@@ -12203,6 +12305,8 @@ var RULES = /* @__PURE__ */ new Map([
|
|
|
12203
12305
|
[O3_EDIT2, (req) => needsSource(req) ?? needsPrompt(req)],
|
|
12204
12306
|
[KLING_V4, klingV4],
|
|
12205
12307
|
[KLING_V4_EDIT, (req) => needsSource(req) ?? needsPrompt(req)],
|
|
12308
|
+
[KLING_V4_FLASH, klingV4Flash],
|
|
12309
|
+
[KLING_V4_FLASH_EDIT, (req) => needsSource(req) ?? needsPrompt(req)],
|
|
12206
12310
|
[H3_TURBO, h3Turbo],
|
|
12207
12311
|
[MINIMAX_H3_INSERT, h3Insert],
|
|
12208
12312
|
[H3_RECAST, h3Recast],
|
|
@@ -12252,7 +12356,7 @@ function applyFalVideoRules(model, req, callerRatio, warnings) {
|
|
|
12252
12356
|
warnings.push(viduSilentWarning(model));
|
|
12253
12357
|
req.generateAudio = false;
|
|
12254
12358
|
}
|
|
12255
|
-
if (id === KLING_V4 && req.firstFrame !== void 0 && !hasReferences(req)) {
|
|
12359
|
+
if ((id === KLING_V4 || id === KLING_V4_FLASH) && req.firstFrame !== void 0 && !hasReferences(req)) {
|
|
12256
12360
|
if (req.aspectRatio !== void 0) {
|
|
12257
12361
|
if (callerRatio !== void 0) {
|
|
12258
12362
|
warnings.push({
|