@shop-os/modelkit 0.27.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.js CHANGED
@@ -5542,6 +5542,7 @@ var KLING_LOGO2 = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0
5542
5542
  var MINIMAX_LOGO4 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
5543
5543
  var BYTEDANCE_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/3bba5d81-4e57-4e71-911b-cdfa05acca2c_compressed.png";
5544
5544
  var XAI_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/858b7fcc-9bd5-411d-aea1-a7b35ecfffab_compressed.png";
5545
+ var LIGHTRICKS_LOGO = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/lightricks.png";
5545
5546
  var H3_RATIOS = ["21:9", "16:9", "4:3", "1:1", "3:4", "9:16"];
5546
5547
  var HAPPY_HORSE_RATIOS = [
5547
5548
  "16:9",
@@ -5672,7 +5673,9 @@ var VIDEO_FAMILY_MODELS = [
5672
5673
  // start frame included (fal: "counts toward the image reference limit"), 300 px min.
5673
5674
  // Reference videos: 5, 3-30.05 s each and 30 s combined, 700 px min, 23.9-60.05 fps.
5674
5675
  // The prompt names references as @Image1, @Video1 (no space; @Element1 for elements,
5675
- // which the kit does not send). No sound switch on any endpoint.
5676
+ // which the kit does not send). No sound switch on any endpoint. 4K since 2026-11-19;
5677
+ // the endpoints also take `hdr` (10-bit, 1080p and 4K, billed per output second on top),
5678
+ // which the kit does not send: no price row can carry that fee yet (ENG-4272).
5676
5679
  id: "kling-4.0",
5677
5680
  aliases: ["kling-4", "kling-v4"],
5678
5681
  label: "Kling 4.0",
@@ -5684,7 +5687,7 @@ var VIDEO_FAMILY_MODELS = [
5684
5687
  constraints: {
5685
5688
  inputBilling: "kling-v4",
5686
5689
  aspectRatios: ["adaptive", "16:9", "9:16", "1:1", "21:9"],
5687
- resolutions: ["720p", "1080p"],
5690
+ resolutions: ["720p", "1080p", "4k"],
5688
5691
  durations: { min: 3, max: 30 },
5689
5692
  durationPresets: [5, 10, 15, 30],
5690
5693
  references: {
@@ -5705,7 +5708,7 @@ var VIDEO_FAMILY_MODELS = [
5705
5708
  display: {
5706
5709
  provider: "kuaishou",
5707
5710
  logo: KLING_LOGO2,
5708
- description: "Kuaishou Kling 4.0: text-to-video, start/end frames, or reference-to-video from up to 10 images and 5 videos (30 seconds combined), up to 30 seconds at 720p or 1080p. Prompts name references @Image1, @Video1."
5711
+ description: "Kuaishou Kling 4.0: text-to-video, start/end frames, or reference-to-video from up to 10 images and 5 videos (30 seconds combined), up to 30 seconds at 720p or 1080p and up to 15 seconds at 4K. Prompts name references @Image1, @Video1."
5709
5712
  },
5710
5713
  capabilities: { lastFrameRequiresFirstFrame: true }
5711
5714
  },
@@ -5723,7 +5726,7 @@ var VIDEO_FAMILY_MODELS = [
5723
5726
  exposure: ["cowork", "space_builder"],
5724
5727
  constraints: {
5725
5728
  inputBilling: "kling-v4",
5726
- resolutions: ["720p", "1080p"],
5729
+ resolutions: ["720p", "1080p", "4k"],
5727
5730
  durations: { min: 3, max: 30 },
5728
5731
  references: { ...NO_REFERENCES, images: 10 },
5729
5732
  requires: ["sourceVideo"],
@@ -5739,7 +5742,7 @@ var VIDEO_FAMILY_MODELS = [
5739
5742
  display: {
5740
5743
  provider: "kuaishou",
5741
5744
  logo: KLING_LOGO2,
5742
- description: "Kuaishou Kling 4.0 video edit: change a 3-30 second clip with a prompt and up to 10 reference images, at 720p or 1080p, as long as the source or a set 3-30 seconds. Prompts name the source @Video1 and images @Image1."
5745
+ description: "Kuaishou Kling 4.0 video edit: change a 3-30 second clip with a prompt and up to 10 reference images, at 720p, 1080p or 4K (up to 15 seconds at 4K), as long as the source or a set 3-30 seconds. Prompts name the source @Video1 and images @Image1."
5743
5746
  },
5744
5747
  capabilities: { acceptsSourceVideo: true, videoEdit: true }
5745
5748
  },
@@ -6138,6 +6141,77 @@ var VIDEO_FAMILY_MODELS = [
6138
6141
  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."
6139
6142
  },
6140
6143
  capabilities: {}
6144
+ },
6145
+ {
6146
+ // https://fal.ai/models/fal-ai/ltx-2.3/text-to-video/api (+ /image-to-video): one row;
6147
+ // a start frame routes to image-to-video, else text-to-video. The kit's 2k/4k tiers
6148
+ // are fal's 1440p/2160p (adapters/fal-ltx.ts). "adaptive" is fal's "auto" on
6149
+ // image-to-video; text-to-video leaves an adaptive ratio at fal's 16:9 default.
6150
+ id: "ltx-2.3",
6151
+ aliases: ["ltx-2-3", "ltx23"],
6152
+ label: "LTX 2.3",
6153
+ type: "video",
6154
+ adapter: "fal",
6155
+ providerModelId: "fal-ai/ltx-2.3/text-to-video",
6156
+ lifecycle: "active",
6157
+ exposure: ["cowork", "space_builder"],
6158
+ constraints: {
6159
+ aspectRatios: ["adaptive", "16:9", "9:16"],
6160
+ resolutions: ["1080p", "2k", "4k"],
6161
+ durations: [6, 8, 10],
6162
+ supports: ["generateAudio", "lastFrame", "safetyChecker"],
6163
+ prompt: { referenceSyntax: "numbered", maxChars: 5e3 },
6164
+ audio: "optional"
6165
+ },
6166
+ defaults: {
6167
+ durationSeconds: 6,
6168
+ resolution: "1080p",
6169
+ aspectRatio: "adaptive",
6170
+ generateAudio: true
6171
+ },
6172
+ usage: { ...VIDEO_USAGE },
6173
+ pricingKind: "video_per_second",
6174
+ display: {
6175
+ provider: "lightricks",
6176
+ logo: LIGHTRICKS_LOGO,
6177
+ 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."
6178
+ },
6179
+ capabilities: { lastFrameRequiresFirstFrame: true }
6180
+ },
6181
+ {
6182
+ // https://fal.ai/models/fal-ai/ltx-2.3/text-to-video/fast/api (+ /image-to-video/fast):
6183
+ // the fast tier at the same resolutions; even durations 6-20 s, but over 10 s is
6184
+ // 1080p at 25 fps only (the kit never sends fps, so the rule checks the tier).
6185
+ id: "ltx-2.3-fast",
6186
+ aliases: ["ltx-2-3-fast", "ltx23-fast"],
6187
+ label: "LTX 2.3 Fast",
6188
+ type: "video",
6189
+ adapter: "fal",
6190
+ providerModelId: "fal-ai/ltx-2.3/text-to-video/fast",
6191
+ lifecycle: "active",
6192
+ exposure: ["cowork", "space_builder"],
6193
+ constraints: {
6194
+ aspectRatios: ["adaptive", "16:9", "9:16"],
6195
+ resolutions: ["1080p", "2k", "4k"],
6196
+ durations: [6, 8, 10, 12, 14, 16, 18, 20],
6197
+ supports: ["generateAudio", "lastFrame", "safetyChecker"],
6198
+ prompt: { referenceSyntax: "numbered", maxChars: 5e3 },
6199
+ audio: "optional"
6200
+ },
6201
+ defaults: {
6202
+ durationSeconds: 6,
6203
+ resolution: "1080p",
6204
+ aspectRatio: "adaptive",
6205
+ generateAudio: true
6206
+ },
6207
+ usage: { ...VIDEO_USAGE },
6208
+ pricingKind: "video_per_second",
6209
+ display: {
6210
+ provider: "lightricks",
6211
+ logo: LIGHTRICKS_LOGO,
6212
+ 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."
6213
+ },
6214
+ capabilities: { lastFrameRequiresFirstFrame: true }
6141
6215
  }
6142
6216
  ];
6143
6217
 
@@ -10200,6 +10274,8 @@ var HAPPY_HORSE = "happyhorse-1.1";
10200
10274
  var HAPPY_HORSE_EDIT = "alibaba/happy-horse/video-edit";
10201
10275
  var VIDU_Q4 = "fal-ai/vidu/q4";
10202
10276
  var OMNIHUMAN_V2 = "bytedance/omnihuman/v2";
10277
+ var LTX_T2V = "fal-ai/ltx-2.3/text-to-video";
10278
+ var LTX_FAST_T2V = "fal-ai/ltx-2.3/text-to-video/fast";
10203
10279
  var KLING_O3_IMAGE_CAP = 7;
10204
10280
  var KLING_V4_IMAGE_CAP = 10;
10205
10281
  var TURBO_AUDIO_MIN_SECONDS = 2;
@@ -10269,7 +10345,17 @@ function o3Reference(req) {
10269
10345
  function hasReferences(req) {
10270
10346
  return count(req.referenceImages) + count(req.referenceVideos) > 0;
10271
10347
  }
10348
+ var KLING_V4_4K_MAX_SECONDS = 15;
10349
+ function klingV4FourK(seconds3, req) {
10350
+ if (req.resolution !== "4k") return void 0;
10351
+ if (seconds3 === void 0) {
10352
+ return missing(`needs a measured source video of up to ${KLING_V4_4K_MAX_SECONDS} s at 4K`);
10353
+ }
10354
+ return seconds3 > KLING_V4_4K_MAX_SECONDS ? unsupported3(`renders at most ${KLING_V4_4K_MAX_SECONDS} s at 4K`) : void 0;
10355
+ }
10272
10356
  function klingV4(req) {
10357
+ const fourK = klingV4FourK(req.durationSeconds ?? 5, req);
10358
+ if (fourK !== void 0) return fourK;
10273
10359
  if (hasReferences(req)) {
10274
10360
  if (req.lastFrame !== void 0) {
10275
10361
  return unsupported3("takes an end frame only without reference images or videos");
@@ -10366,6 +10452,20 @@ function imageAndAudio(req, audioSeconds) {
10366
10452
  }
10367
10453
  return inputSeconds("audio", audio, audioSeconds);
10368
10454
  }
10455
+ function ltx(fast) {
10456
+ return (req) => {
10457
+ if (req.lastFrame !== void 0 && req.firstFrame === void 0) {
10458
+ return missing("takes an end frame only together with a start frame");
10459
+ }
10460
+ if (count(req.referenceImages) + count(req.referenceVideos) + count(req.referenceAudios) > 0) {
10461
+ return unsupported3("takes no reference images, videos or audio");
10462
+ }
10463
+ if (fast && (req.durationSeconds ?? 6) > 10 && req.resolution !== void 0 && req.resolution !== "1080p") {
10464
+ return unsupported3("renders over 10 s at 1080p only");
10465
+ }
10466
+ return needsPrompt(req);
10467
+ };
10468
+ }
10369
10469
  var RULES = new Map([
10370
10470
  [MOTION_PRO, motionControl],
10371
10471
  [MOTION_STANDARD, motionControl],
@@ -10373,7 +10473,10 @@ var RULES = new Map([
10373
10473
  [KLING_O3_OMNI, o3Reference],
10374
10474
  [O3_EDIT, (req) => needsSource(req) ?? needsPrompt(req)],
10375
10475
  [KLING_V4, klingV4],
10376
- [KLING_V4_EDIT, (req) => needsSource(req) ?? needsPrompt(req)],
10476
+ [
10477
+ KLING_V4_EDIT,
10478
+ (req) => needsSource(req) ?? klingV4FourK(req.durationSeconds ?? req.sourceVideo?.durationSeconds, req) ?? needsPrompt(req)
10479
+ ],
10377
10480
  [KLING_V4_FLASH, klingV4Flash],
10378
10481
  [KLING_V4_FLASH_EDIT, (req) => needsSource(req) ?? needsPrompt(req)],
10379
10482
  [H3_TURBO, h3Turbo],
@@ -10386,7 +10489,9 @@ var RULES = new Map([
10386
10489
  [OMNIHUMAN_V2, (req) => imageAndAudio(req, OMNIHUMAN_AUDIO_SECONDS)],
10387
10490
  ...AVATAR_AUDIO.map(
10388
10491
  ([id, limits]) => [id, (req) => imageAndAudio(req, limits)]
10389
- )
10492
+ ),
10493
+ [LTX_T2V, ltx(false)],
10494
+ [LTX_FAST_T2V, ltx(true)]
10390
10495
  ]);
10391
10496
  function falVideoProblem(providerModelId, req) {
10392
10497
  return RULES.get(providerModelId.toLowerCase())?.(req);
@@ -13576,6 +13681,58 @@ var klingOmniFamily = {
13576
13681
  plan: plan2
13577
13682
  };
13578
13683
 
13684
+ // src/adapters/fal-ltx.ts
13685
+ var LTX_T2V2 = "fal-ai/ltx-2.3/text-to-video";
13686
+ var LTX_I2V = "fal-ai/ltx-2.3/image-to-video";
13687
+ var LTX_FAST_T2V2 = "fal-ai/ltx-2.3/text-to-video/fast";
13688
+ var LTX_FAST_I2V = "fal-ai/ltx-2.3/image-to-video/fast";
13689
+ var LTX_TIERS = {
13690
+ "360p": "360p",
13691
+ "480p": "480p",
13692
+ "720p": "720p",
13693
+ "768p": "768p",
13694
+ "1080p": "1080p",
13695
+ "2k": "1440p",
13696
+ "4k": "2160p"
13697
+ };
13698
+ function ltxGenerate(fast, req, ctx) {
13699
+ const resolution = resolutionOf2(req, ctx);
13700
+ const duration = wholeSeconds(req, ctx);
13701
+ const input = {
13702
+ prompt: req.prompt.trim(),
13703
+ duration,
13704
+ resolution: LTX_TIERS[resolution],
13705
+ generate_audio: req.generateAudio ?? true
13706
+ };
13707
+ if (req.safetyChecker !== void 0) input["enable_safety_checker"] = req.safetyChecker;
13708
+ const firstFrame = req.firstFrame;
13709
+ const endpoint = firstFrame === void 0 ? fast ? LTX_FAST_T2V2 : LTX_T2V2 : fast ? LTX_FAST_I2V : LTX_I2V;
13710
+ if (firstFrame === void 0) {
13711
+ const ratio = concreteRatio(req);
13712
+ if (ratio !== void 0) input["aspect_ratio"] = ratio;
13713
+ } else {
13714
+ input["image_url"] = refToUrl(firstFrame);
13715
+ if (req.lastFrame !== void 0) input["end_image_url"] = refToUrl(req.lastFrame);
13716
+ if (req.aspectRatio !== void 0) {
13717
+ input["aspect_ratio"] = req.aspectRatio === "adaptive" ? "auto" : req.aspectRatio;
13718
+ }
13719
+ }
13720
+ return { endpoint, input, resolution, seconds: requestedSeconds(duration) };
13721
+ }
13722
+ var LTX_MODEL_IDS = /* @__PURE__ */ new Set([
13723
+ LTX_T2V2,
13724
+ LTX_I2V,
13725
+ LTX_FAST_T2V2,
13726
+ LTX_FAST_I2V
13727
+ ]);
13728
+ var ltxFamily = {
13729
+ ids: LTX_MODEL_IDS,
13730
+ plan(req, ctx) {
13731
+ const id = ctx.model.providerModelId.toLowerCase();
13732
+ return ltxGenerate(id === LTX_FAST_T2V2 || id === LTX_FAST_I2V, req, ctx);
13733
+ }
13734
+ };
13735
+
13579
13736
  // src/adapters/fal-minimax-h3.ts
13580
13737
  var TURBO = "minimax/h3-max-turbo";
13581
13738
  var INSERT = MINIMAX_H3_INSERT;
@@ -13746,6 +13903,7 @@ var FAMILIES2 = [
13746
13903
  klingV4Family,
13747
13904
  minimaxH3MaxFamily,
13748
13905
  happyHorseFamily,
13906
+ ltxFamily,
13749
13907
  viduFamily,
13750
13908
  omnihumanFamily,
13751
13909
  avatarFamily