@shop-os/modelkit 0.28.0 → 0.29.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/dist/index.cjs CHANGED
@@ -5699,6 +5699,7 @@ var KLING_LOGO2 = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0
5699
5699
  var MINIMAX_LOGO4 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
5700
5700
  var BYTEDANCE_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/3bba5d81-4e57-4e71-911b-cdfa05acca2c_compressed.png";
5701
5701
  var XAI_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/858b7fcc-9bd5-411d-aea1-a7b35ecfffab_compressed.png";
5702
+ var LIGHTRICKS_LOGO = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/lightricks.png";
5702
5703
  var H3_RATIOS = ["21:9", "16:9", "4:3", "1:1", "3:4", "9:16"];
5703
5704
  var HAPPY_HORSE_RATIOS = [
5704
5705
  "16:9",
@@ -6297,6 +6298,77 @@ var VIDEO_FAMILY_MODELS = [
6297
6298
  description: "xAI Grok Imagine 1.5: text- and image-to-video at native 1080p with lip-synced audio, or up to 14 reference images and pinned first and last frames at 720p, up to 15 seconds."
6298
6299
  },
6299
6300
  capabilities: {}
6301
+ },
6302
+ {
6303
+ // https://fal.ai/models/fal-ai/ltx-2.3/text-to-video/api (+ /image-to-video): one row;
6304
+ // a start frame routes to image-to-video, else text-to-video. The kit's 2k/4k tiers
6305
+ // are fal's 1440p/2160p (adapters/fal-ltx.ts). "adaptive" is fal's "auto" on
6306
+ // image-to-video; text-to-video leaves an adaptive ratio at fal's 16:9 default.
6307
+ id: "ltx-2.3",
6308
+ aliases: ["ltx-2-3", "ltx23"],
6309
+ label: "LTX 2.3",
6310
+ type: "video",
6311
+ adapter: "fal",
6312
+ providerModelId: "fal-ai/ltx-2.3/text-to-video",
6313
+ lifecycle: "active",
6314
+ exposure: ["cowork", "space_builder"],
6315
+ constraints: {
6316
+ aspectRatios: ["adaptive", "16:9", "9:16"],
6317
+ resolutions: ["1080p", "2k", "4k"],
6318
+ durations: [6, 8, 10],
6319
+ supports: ["generateAudio", "lastFrame", "safetyChecker"],
6320
+ prompt: { referenceSyntax: "numbered", maxChars: 5e3 },
6321
+ audio: "optional"
6322
+ },
6323
+ defaults: {
6324
+ durationSeconds: 6,
6325
+ resolution: "1080p",
6326
+ aspectRatio: "adaptive",
6327
+ generateAudio: true
6328
+ },
6329
+ usage: { ...VIDEO_USAGE },
6330
+ pricingKind: "video_per_second",
6331
+ display: {
6332
+ provider: "lightricks",
6333
+ logo: LIGHTRICKS_LOGO,
6334
+ description: "Lightricks LTX 2.3 open-source text-to-video and start/end-frame image-to-video with native audio; 6, 8 or 10 seconds at up to 4K in landscape or portrait."
6335
+ },
6336
+ capabilities: { lastFrameRequiresFirstFrame: true }
6337
+ },
6338
+ {
6339
+ // https://fal.ai/models/fal-ai/ltx-2.3/text-to-video/fast/api (+ /image-to-video/fast):
6340
+ // the fast tier at the same resolutions; even durations 6-20 s, but over 10 s is
6341
+ // 1080p at 25 fps only (the kit never sends fps, so the rule checks the tier).
6342
+ id: "ltx-2.3-fast",
6343
+ aliases: ["ltx-2-3-fast", "ltx23-fast"],
6344
+ label: "LTX 2.3 Fast",
6345
+ type: "video",
6346
+ adapter: "fal",
6347
+ providerModelId: "fal-ai/ltx-2.3/text-to-video/fast",
6348
+ lifecycle: "active",
6349
+ exposure: ["cowork", "space_builder"],
6350
+ constraints: {
6351
+ aspectRatios: ["adaptive", "16:9", "9:16"],
6352
+ resolutions: ["1080p", "2k", "4k"],
6353
+ durations: [6, 8, 10, 12, 14, 16, 18, 20],
6354
+ supports: ["generateAudio", "lastFrame", "safetyChecker"],
6355
+ prompt: { referenceSyntax: "numbered", maxChars: 5e3 },
6356
+ audio: "optional"
6357
+ },
6358
+ defaults: {
6359
+ durationSeconds: 6,
6360
+ resolution: "1080p",
6361
+ aspectRatio: "adaptive",
6362
+ generateAudio: true
6363
+ },
6364
+ usage: { ...VIDEO_USAGE },
6365
+ pricingKind: "video_per_second",
6366
+ display: {
6367
+ provider: "lightricks",
6368
+ logo: LIGHTRICKS_LOGO,
6369
+ 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."
6370
+ },
6371
+ capabilities: { lastFrameRequiresFirstFrame: true }
6300
6372
  }
6301
6373
  ];
6302
6374
 
@@ -10359,6 +10431,8 @@ var HAPPY_HORSE = "happyhorse-1.1";
10359
10431
  var HAPPY_HORSE_EDIT = "alibaba/happy-horse/video-edit";
10360
10432
  var VIDU_Q4 = "fal-ai/vidu/q4";
10361
10433
  var OMNIHUMAN_V2 = "bytedance/omnihuman/v2";
10434
+ var LTX_T2V = "fal-ai/ltx-2.3/text-to-video";
10435
+ var LTX_FAST_T2V = "fal-ai/ltx-2.3/text-to-video/fast";
10362
10436
  var KLING_O3_IMAGE_CAP = 7;
10363
10437
  var KLING_V4_IMAGE_CAP = 10;
10364
10438
  var TURBO_AUDIO_MIN_SECONDS = 2;
@@ -10535,6 +10609,20 @@ function imageAndAudio(req, audioSeconds) {
10535
10609
  }
10536
10610
  return inputSeconds("audio", audio, audioSeconds);
10537
10611
  }
10612
+ function ltx(fast) {
10613
+ return (req) => {
10614
+ if (req.lastFrame !== void 0 && req.firstFrame === void 0) {
10615
+ return missing("takes an end frame only together with a start frame");
10616
+ }
10617
+ if (count(req.referenceImages) + count(req.referenceVideos) + count(req.referenceAudios) > 0) {
10618
+ return unsupported3("takes no reference images, videos or audio");
10619
+ }
10620
+ if (fast && (req.durationSeconds ?? 6) > 10 && req.resolution !== void 0 && req.resolution !== "1080p") {
10621
+ return unsupported3("renders over 10 s at 1080p only");
10622
+ }
10623
+ return needsPrompt(req);
10624
+ };
10625
+ }
10538
10626
  var RULES = new Map([
10539
10627
  [MOTION_PRO, motionControl],
10540
10628
  [MOTION_STANDARD, motionControl],
@@ -10558,7 +10646,9 @@ var RULES = new Map([
10558
10646
  [OMNIHUMAN_V2, (req) => imageAndAudio(req, OMNIHUMAN_AUDIO_SECONDS)],
10559
10647
  ...AVATAR_AUDIO.map(
10560
10648
  ([id, limits]) => [id, (req) => imageAndAudio(req, limits)]
10561
- )
10649
+ ),
10650
+ [LTX_T2V, ltx(false)],
10651
+ [LTX_FAST_T2V, ltx(true)]
10562
10652
  ]);
10563
10653
  function falVideoProblem(providerModelId, req) {
10564
10654
  return RULES.get(providerModelId.toLowerCase())?.(req);
@@ -13748,6 +13838,58 @@ var klingOmniFamily = {
13748
13838
  plan: plan2
13749
13839
  };
13750
13840
 
13841
+ // src/adapters/fal-ltx.ts
13842
+ var LTX_T2V2 = "fal-ai/ltx-2.3/text-to-video";
13843
+ var LTX_I2V = "fal-ai/ltx-2.3/image-to-video";
13844
+ var LTX_FAST_T2V2 = "fal-ai/ltx-2.3/text-to-video/fast";
13845
+ var LTX_FAST_I2V = "fal-ai/ltx-2.3/image-to-video/fast";
13846
+ var LTX_TIERS = {
13847
+ "360p": "360p",
13848
+ "480p": "480p",
13849
+ "720p": "720p",
13850
+ "768p": "768p",
13851
+ "1080p": "1080p",
13852
+ "2k": "1440p",
13853
+ "4k": "2160p"
13854
+ };
13855
+ function ltxGenerate(fast, req, ctx) {
13856
+ const resolution = resolutionOf2(req, ctx);
13857
+ const duration = wholeSeconds(req, ctx);
13858
+ const input = {
13859
+ prompt: req.prompt.trim(),
13860
+ duration,
13861
+ resolution: LTX_TIERS[resolution],
13862
+ generate_audio: req.generateAudio ?? true
13863
+ };
13864
+ if (req.safetyChecker !== void 0) input["enable_safety_checker"] = req.safetyChecker;
13865
+ const firstFrame = req.firstFrame;
13866
+ const endpoint = firstFrame === void 0 ? fast ? LTX_FAST_T2V2 : LTX_T2V2 : fast ? LTX_FAST_I2V : LTX_I2V;
13867
+ if (firstFrame === void 0) {
13868
+ const ratio = concreteRatio(req);
13869
+ if (ratio !== void 0) input["aspect_ratio"] = ratio;
13870
+ } else {
13871
+ input["image_url"] = refToUrl(firstFrame);
13872
+ if (req.lastFrame !== void 0) input["end_image_url"] = refToUrl(req.lastFrame);
13873
+ if (req.aspectRatio !== void 0) {
13874
+ input["aspect_ratio"] = req.aspectRatio === "adaptive" ? "auto" : req.aspectRatio;
13875
+ }
13876
+ }
13877
+ return { endpoint, input, resolution, seconds: requestedSeconds(duration) };
13878
+ }
13879
+ var LTX_MODEL_IDS = /* @__PURE__ */ new Set([
13880
+ LTX_T2V2,
13881
+ LTX_I2V,
13882
+ LTX_FAST_T2V2,
13883
+ LTX_FAST_I2V
13884
+ ]);
13885
+ var ltxFamily = {
13886
+ ids: LTX_MODEL_IDS,
13887
+ plan(req, ctx) {
13888
+ const id = ctx.model.providerModelId.toLowerCase();
13889
+ return ltxGenerate(id === LTX_FAST_T2V2 || id === LTX_FAST_I2V, req, ctx);
13890
+ }
13891
+ };
13892
+
13751
13893
  // src/adapters/fal-minimax-h3.ts
13752
13894
  var TURBO = "minimax/h3-max-turbo";
13753
13895
  var INSERT = MINIMAX_H3_INSERT;
@@ -13918,6 +14060,7 @@ var FAMILIES2 = [
13918
14060
  klingV4Family,
13919
14061
  minimaxH3MaxFamily,
13920
14062
  happyHorseFamily,
14063
+ ltxFamily,
13921
14064
  viduFamily,
13922
14065
  omnihumanFamily,
13923
14066
  avatarFamily