@shop-os/modelkit 0.28.0 → 0.30.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/catalog.js CHANGED
@@ -904,6 +904,65 @@ var IMAGE_MODELS = [
904
904
  description: "Ideogram's precise edit model: repeated edits keep the untouched pixels and colours intact, at the source's native resolution. Also generates from text."
905
905
  }
906
906
  },
907
+ {
908
+ // Generation only: fal charges edits more, so editing is its own row
909
+ // (ideogram-4.6-edit) with its own prices. fal bills any output above
910
+ // 2048x2048 in area at the 4K price; very_low renders at most 2K, so it is
911
+ // not exposed (no 4K price exists for it, and the catalog seed gate needs
912
+ // every size x quality priced). https://fal.ai/models/ideogram/v4.6
913
+ id: "ideogram-4.6",
914
+ aliases: [],
915
+ label: "Ideogram 4.6",
916
+ type: "image",
917
+ adapter: "fal",
918
+ providerModelId: "ideogram/v4.6",
919
+ lifecycle: "active",
920
+ exposure: ["cowork", "space_builder"],
921
+ constraints: {
922
+ aspectRatios: ["1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3", "5:4", "4:5"],
923
+ sizes: ["2K", "4K"],
924
+ qualityOptions: ["auto", "low", "medium", "high"],
925
+ references: { images: 0 },
926
+ supports: ["quality", "count", "seed"]
927
+ },
928
+ defaults: { size: "2K", aspectRatio: "1:1", quality: "medium", count: 1 },
929
+ usage: { ...IMAGE_USAGE3, slug: "ideogram" },
930
+ pricingKind: "image_size",
931
+ display: {
932
+ provider: "ideogram",
933
+ description: "Ideogram 4.6 text-to-image from a prompt, at 2K or 4K. Edits go to Ideogram 4.6 Edit."
934
+ }
935
+ },
936
+ {
937
+ // Precise Edit only: references switch to the /edit endpoint, where the
938
+ // first is the image to edit and the rest (up to 4) guide it, so 5 images
939
+ // in all. The output keeps the source size, so `size` only picks the
940
+ // billed tier. Same provider model as the generate row, whose adapter
941
+ // routes on references. https://fal.ai/models/ideogram/v4.6/edit
942
+ id: "ideogram-4.6-edit",
943
+ aliases: [],
944
+ label: "Ideogram 4.6 Edit",
945
+ type: "image",
946
+ adapter: "fal",
947
+ providerModelId: "ideogram/v4.6",
948
+ lifecycle: "active",
949
+ exposure: ["cowork", "space_builder"],
950
+ constraints: {
951
+ aspectRatios: ["1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3", "5:4", "4:5"],
952
+ sizes: ["2K", "4K"],
953
+ qualityOptions: ["auto", "low", "medium", "high"],
954
+ references: { images: 5 },
955
+ requires: ["references"],
956
+ supports: ["quality", "count", "seed"]
957
+ },
958
+ defaults: { size: "2K", aspectRatio: "1:1", quality: "medium", count: 1 },
959
+ usage: { ...IMAGE_USAGE3, slug: "ideogram" },
960
+ pricingKind: "image_size",
961
+ display: {
962
+ provider: "ideogram",
963
+ description: "Ideogram 4.6 Precise Edit: the first image is edited and up to 4 more guide it. Repeated edits keep the untouched pixels and colours intact, and the output keeps the source size."
964
+ }
965
+ },
907
966
  {
908
967
  id: "seedream-5-0-pro",
909
968
  aliases: ["seedream-4-5"],
@@ -5531,6 +5590,7 @@ var KLING_LOGO2 = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0
5531
5590
  var MINIMAX_LOGO4 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
5532
5591
  var BYTEDANCE_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/3bba5d81-4e57-4e71-911b-cdfa05acca2c_compressed.png";
5533
5592
  var XAI_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/858b7fcc-9bd5-411d-aea1-a7b35ecfffab_compressed.png";
5593
+ var LIGHTRICKS_LOGO = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/lightricks.png";
5534
5594
  var H3_RATIOS = ["21:9", "16:9", "4:3", "1:1", "3:4", "9:16"];
5535
5595
  var HAPPY_HORSE_RATIOS = [
5536
5596
  "16:9",
@@ -6129,6 +6189,77 @@ var VIDEO_FAMILY_MODELS = [
6129
6189
  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."
6130
6190
  },
6131
6191
  capabilities: {}
6192
+ },
6193
+ {
6194
+ // https://fal.ai/models/fal-ai/ltx-2.3/text-to-video/api (+ /image-to-video): one row;
6195
+ // a start frame routes to image-to-video, else text-to-video. The kit's 2k/4k tiers
6196
+ // are fal's 1440p/2160p (adapters/fal-ltx.ts). "adaptive" is fal's "auto" on
6197
+ // image-to-video; text-to-video leaves an adaptive ratio at fal's 16:9 default.
6198
+ id: "ltx-2.3",
6199
+ aliases: ["ltx-2-3", "ltx23"],
6200
+ label: "LTX 2.3",
6201
+ type: "video",
6202
+ adapter: "fal",
6203
+ providerModelId: "fal-ai/ltx-2.3/text-to-video",
6204
+ lifecycle: "active",
6205
+ exposure: ["cowork", "space_builder"],
6206
+ constraints: {
6207
+ aspectRatios: ["adaptive", "16:9", "9:16"],
6208
+ resolutions: ["1080p", "2k", "4k"],
6209
+ durations: [6, 8, 10],
6210
+ supports: ["generateAudio", "lastFrame", "safetyChecker"],
6211
+ prompt: { referenceSyntax: "numbered", maxChars: 5e3 },
6212
+ audio: "optional"
6213
+ },
6214
+ defaults: {
6215
+ durationSeconds: 6,
6216
+ resolution: "1080p",
6217
+ aspectRatio: "adaptive",
6218
+ generateAudio: true
6219
+ },
6220
+ usage: { ...VIDEO_USAGE },
6221
+ pricingKind: "video_per_second",
6222
+ display: {
6223
+ provider: "lightricks",
6224
+ logo: LIGHTRICKS_LOGO,
6225
+ 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."
6226
+ },
6227
+ capabilities: { lastFrameRequiresFirstFrame: true }
6228
+ },
6229
+ {
6230
+ // https://fal.ai/models/fal-ai/ltx-2.3/text-to-video/fast/api (+ /image-to-video/fast):
6231
+ // the fast tier at the same resolutions; even durations 6-20 s, but over 10 s is
6232
+ // 1080p at 25 fps only (the kit never sends fps, so the rule checks the tier).
6233
+ id: "ltx-2.3-fast",
6234
+ aliases: ["ltx-2-3-fast", "ltx23-fast"],
6235
+ label: "LTX 2.3 Fast",
6236
+ type: "video",
6237
+ adapter: "fal",
6238
+ providerModelId: "fal-ai/ltx-2.3/text-to-video/fast",
6239
+ lifecycle: "active",
6240
+ exposure: ["cowork", "space_builder"],
6241
+ constraints: {
6242
+ aspectRatios: ["adaptive", "16:9", "9:16"],
6243
+ resolutions: ["1080p", "2k", "4k"],
6244
+ durations: [6, 8, 10, 12, 14, 16, 18, 20],
6245
+ supports: ["generateAudio", "lastFrame", "safetyChecker"],
6246
+ prompt: { referenceSyntax: "numbered", maxChars: 5e3 },
6247
+ audio: "optional"
6248
+ },
6249
+ defaults: {
6250
+ durationSeconds: 6,
6251
+ resolution: "1080p",
6252
+ aspectRatio: "adaptive",
6253
+ generateAudio: true
6254
+ },
6255
+ usage: { ...VIDEO_USAGE },
6256
+ pricingKind: "video_per_second",
6257
+ display: {
6258
+ provider: "lightricks",
6259
+ logo: LIGHTRICKS_LOGO,
6260
+ 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."
6261
+ },
6262
+ capabilities: { lastFrameRequiresFirstFrame: true }
6132
6263
  }
6133
6264
  ];
6134
6265
 
@@ -9837,6 +9968,17 @@ function falImageSpec(providerModelId) {
9837
9968
  }
9838
9969
  var AREA_1K = 1024 * 1024;
9839
9970
  var AREA_2K = 2048 * 2048;
9971
+ var IDEOGRAM_46_EXACT = {
9972
+ minSide: 256,
9973
+ maxSide: 4096,
9974
+ minArea: 256 * 256,
9975
+ maxArea: 4096 * 4096,
9976
+ multipleOf: 32,
9977
+ maxAspect: 6,
9978
+ minTier: "2K",
9979
+ topTier: "4K"
9980
+ };
9981
+ var IDEOGRAM_46_IDS = /* @__PURE__ */ new Set(["ideogram/v4.6"]);
9840
9982
  function checkExactSize(exact, b) {
9841
9983
  const match = /^(\d+)x(\d+)$/.exec(exact);
9842
9984
  if (match === null) {
@@ -9860,7 +10002,7 @@ function checkExactSize(exact, b) {
9860
10002
  return { ok: true, size: { width, height, tier: exactTier(area, b) } };
9861
10003
  }
9862
10004
  function exactTier(area, b) {
9863
- if (area <= AREA_1K) return "1K";
10005
+ if (area <= AREA_1K) return b.minTier ?? "1K";
9864
10006
  if (b.topTier === void 0 || area <= AREA_2K) return "2K";
9865
10007
  return b.topTier;
9866
10008
  }
@@ -9922,23 +10064,43 @@ function falImageProblem(spec, req) {
9922
10064
  }
9923
10065
  function falExactSize(spec, req) {
9924
10066
  if (req.exactSize === void 0 || spec.exactSize === void 0) return void 0;
9925
- const check = checkExactSize(req.exactSize, spec.exactSize);
10067
+ return checkedExactSize(req.exactSize, spec.exactSize);
10068
+ }
10069
+ function checkedExactSize(exact, bounds) {
10070
+ const check = checkExactSize(exact, bounds);
9926
10071
  return check.ok ? check.size : void 0;
9927
10072
  }
10073
+ function ideogram46ExactSize(model, req) {
10074
+ if (req.exactSize === void 0) return void 0;
10075
+ const check = checkExactSize(req.exactSize, IDEOGRAM_46_EXACT);
10076
+ if (check.ok) return check.size;
10077
+ throw new ModelKitError({
10078
+ code: "unsupported_option",
10079
+ message: `${model.label}: ${check.message}`,
10080
+ model: model.id,
10081
+ retryable: false
10082
+ });
10083
+ }
9928
10084
  function applyFalImageRules(model, req, callerSize, warnings) {
9929
10085
  if (model.adapter !== "fal" && model.adapter !== "alibaba") return;
9930
10086
  const spec = falImageSpec(model.providerModelId);
9931
- if (spec === void 0) return;
9932
- const problem = falImageProblem(spec, withPromptForResolve(req));
9933
- if (problem !== void 0) {
9934
- throw new ModelKitError({
9935
- code: problem.code,
9936
- message: problem.message,
9937
- model: model.id,
9938
- retryable: false
9939
- });
10087
+ const ideogram46 = IDEOGRAM_46_IDS.has(model.providerModelId.toLowerCase());
10088
+ if (spec === void 0 && !ideogram46) return;
10089
+ let exact;
10090
+ if (spec === void 0) {
10091
+ exact = ideogram46ExactSize(model, req);
10092
+ } else {
10093
+ const problem = falImageProblem(spec, withPromptForResolve(req));
10094
+ if (problem !== void 0) {
10095
+ throw new ModelKitError({
10096
+ code: problem.code,
10097
+ message: problem.message,
10098
+ model: model.id,
10099
+ retryable: false
10100
+ });
10101
+ }
10102
+ exact = falExactSize(spec, req);
9940
10103
  }
9941
- const exact = falExactSize(spec, req);
9942
10104
  if (exact === void 0) return;
9943
10105
  if (callerSize !== void 0 && callerSize !== exact.tier) {
9944
10106
  warnings.push({
@@ -9993,6 +10155,8 @@ var HAPPY_HORSE = "happyhorse-1.1";
9993
10155
  var HAPPY_HORSE_EDIT = "alibaba/happy-horse/video-edit";
9994
10156
  var VIDU_Q4 = "fal-ai/vidu/q4";
9995
10157
  var OMNIHUMAN_V2 = "bytedance/omnihuman/v2";
10158
+ var LTX_T2V = "fal-ai/ltx-2.3/text-to-video";
10159
+ var LTX_FAST_T2V = "fal-ai/ltx-2.3/text-to-video/fast";
9996
10160
  var KLING_O3_IMAGE_CAP = 7;
9997
10161
  var KLING_V4_IMAGE_CAP = 10;
9998
10162
  var TURBO_AUDIO_MIN_SECONDS = 2;
@@ -10169,6 +10333,20 @@ function imageAndAudio(req, audioSeconds) {
10169
10333
  }
10170
10334
  return inputSeconds("audio", audio, audioSeconds);
10171
10335
  }
10336
+ function ltx(fast) {
10337
+ return (req) => {
10338
+ if (req.lastFrame !== void 0 && req.firstFrame === void 0) {
10339
+ return missing("takes an end frame only together with a start frame");
10340
+ }
10341
+ if (count(req.referenceImages) + count(req.referenceVideos) + count(req.referenceAudios) > 0) {
10342
+ return unsupported2("takes no reference images, videos or audio");
10343
+ }
10344
+ if (fast && (req.durationSeconds ?? 6) > 10 && req.resolution !== void 0 && req.resolution !== "1080p") {
10345
+ return unsupported2("renders over 10 s at 1080p only");
10346
+ }
10347
+ return needsPrompt(req);
10348
+ };
10349
+ }
10172
10350
  var RULES = new Map([
10173
10351
  [MOTION_PRO, motionControl],
10174
10352
  [MOTION_STANDARD, motionControl],
@@ -10192,7 +10370,9 @@ var RULES = new Map([
10192
10370
  [OMNIHUMAN_V2, (req) => imageAndAudio(req, OMNIHUMAN_AUDIO_SECONDS)],
10193
10371
  ...AVATAR_AUDIO.map(
10194
10372
  ([id, limits]) => [id, (req) => imageAndAudio(req, limits)]
10195
- )
10373
+ ),
10374
+ [LTX_T2V, ltx(false)],
10375
+ [LTX_FAST_T2V, ltx(true)]
10196
10376
  ]);
10197
10377
  function falVideoProblem(providerModelId, req) {
10198
10378
  return RULES.get(providerModelId.toLowerCase())?.(req);