@shop-os/modelkit 0.29.0 → 0.31.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"],
@@ -6201,6 +6260,76 @@ var VIDEO_FAMILY_MODELS = [
6201
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."
6202
6261
  },
6203
6262
  capabilities: { lastFrameRequiresFirstFrame: true }
6263
+ },
6264
+ {
6265
+ // https://fal.ai/models/lightricks/ltx-2.5/text-to-video/pro/api (+ /image-to-video/pro):
6266
+ // a Lightricks partner endpoint on fal. Pro renders 720p and 1080p only, 6/8/10 s;
6267
+ // no safety checker field. Routing and tiers as LTX 2.3 (adapters/fal-ltx.ts).
6268
+ id: "ltx-2.5",
6269
+ aliases: ["ltx-2-5", "ltx25", "ltx-2.5-pro"],
6270
+ label: "LTX 2.5",
6271
+ type: "video",
6272
+ adapter: "fal",
6273
+ providerModelId: "lightricks/ltx-2.5/text-to-video/pro",
6274
+ lifecycle: "active",
6275
+ exposure: ["cowork", "space_builder"],
6276
+ constraints: {
6277
+ aspectRatios: ["adaptive", "16:9", "9:16"],
6278
+ resolutions: ["720p", "1080p"],
6279
+ durations: [6, 8, 10],
6280
+ supports: ["generateAudio", "lastFrame"],
6281
+ prompt: { referenceSyntax: "numbered", maxChars: 5e3 },
6282
+ audio: "optional"
6283
+ },
6284
+ defaults: {
6285
+ durationSeconds: 6,
6286
+ resolution: "1080p",
6287
+ aspectRatio: "adaptive",
6288
+ generateAudio: true
6289
+ },
6290
+ usage: { ...VIDEO_USAGE },
6291
+ pricingKind: "video_per_second",
6292
+ display: {
6293
+ provider: "lightricks",
6294
+ logo: LIGHTRICKS_LOGO,
6295
+ 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."
6296
+ },
6297
+ capabilities: { lastFrameRequiresFirstFrame: true }
6298
+ },
6299
+ {
6300
+ // https://fal.ai/models/lightricks/ltx-2.5/text-to-video/fast/api (+ /image-to-video/fast):
6301
+ // 720p to 2160p, even durations 6-20 s; over 10 s is 720p or 1080p at 24/25 fps only
6302
+ // (the kit never sends fps, so the rule checks the tier).
6303
+ id: "ltx-2.5-fast",
6304
+ aliases: ["ltx-2-5-fast", "ltx25-fast"],
6305
+ label: "LTX 2.5 Fast",
6306
+ type: "video",
6307
+ adapter: "fal",
6308
+ providerModelId: "lightricks/ltx-2.5/text-to-video/fast",
6309
+ lifecycle: "active",
6310
+ exposure: ["cowork", "space_builder"],
6311
+ constraints: {
6312
+ aspectRatios: ["adaptive", "16:9", "9:16"],
6313
+ resolutions: ["720p", "1080p", "2k", "4k"],
6314
+ durations: [6, 8, 10, 12, 14, 16, 18, 20],
6315
+ supports: ["generateAudio", "lastFrame"],
6316
+ prompt: { referenceSyntax: "numbered", maxChars: 5e3 },
6317
+ audio: "optional"
6318
+ },
6319
+ defaults: {
6320
+ durationSeconds: 6,
6321
+ resolution: "1080p",
6322
+ aspectRatio: "adaptive",
6323
+ generateAudio: true
6324
+ },
6325
+ usage: { ...VIDEO_USAGE },
6326
+ pricingKind: "video_per_second",
6327
+ display: {
6328
+ provider: "lightricks",
6329
+ logo: LIGHTRICKS_LOGO,
6330
+ 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."
6331
+ },
6332
+ capabilities: { lastFrameRequiresFirstFrame: true }
6204
6333
  }
6205
6334
  ];
6206
6335
 
@@ -9909,6 +10038,17 @@ function falImageSpec(providerModelId) {
9909
10038
  }
9910
10039
  var AREA_1K = 1024 * 1024;
9911
10040
  var AREA_2K = 2048 * 2048;
10041
+ var IDEOGRAM_46_EXACT = {
10042
+ minSide: 256,
10043
+ maxSide: 4096,
10044
+ minArea: 256 * 256,
10045
+ maxArea: 4096 * 4096,
10046
+ multipleOf: 32,
10047
+ maxAspect: 6,
10048
+ minTier: "2K",
10049
+ topTier: "4K"
10050
+ };
10051
+ var IDEOGRAM_46_IDS = /* @__PURE__ */ new Set(["ideogram/v4.6"]);
9912
10052
  function checkExactSize(exact, b) {
9913
10053
  const match = /^(\d+)x(\d+)$/.exec(exact);
9914
10054
  if (match === null) {
@@ -9932,7 +10072,7 @@ function checkExactSize(exact, b) {
9932
10072
  return { ok: true, size: { width, height, tier: exactTier(area, b) } };
9933
10073
  }
9934
10074
  function exactTier(area, b) {
9935
- if (area <= AREA_1K) return "1K";
10075
+ if (area <= AREA_1K) return b.minTier ?? "1K";
9936
10076
  if (b.topTier === void 0 || area <= AREA_2K) return "2K";
9937
10077
  return b.topTier;
9938
10078
  }
@@ -9994,23 +10134,43 @@ function falImageProblem(spec, req) {
9994
10134
  }
9995
10135
  function falExactSize(spec, req) {
9996
10136
  if (req.exactSize === void 0 || spec.exactSize === void 0) return void 0;
9997
- const check = checkExactSize(req.exactSize, spec.exactSize);
10137
+ return checkedExactSize(req.exactSize, spec.exactSize);
10138
+ }
10139
+ function checkedExactSize(exact, bounds) {
10140
+ const check = checkExactSize(exact, bounds);
9998
10141
  return check.ok ? check.size : void 0;
9999
10142
  }
10143
+ function ideogram46ExactSize(model, req) {
10144
+ if (req.exactSize === void 0) return void 0;
10145
+ const check = checkExactSize(req.exactSize, IDEOGRAM_46_EXACT);
10146
+ if (check.ok) return check.size;
10147
+ throw new ModelKitError({
10148
+ code: "unsupported_option",
10149
+ message: `${model.label}: ${check.message}`,
10150
+ model: model.id,
10151
+ retryable: false
10152
+ });
10153
+ }
10000
10154
  function applyFalImageRules(model, req, callerSize, warnings) {
10001
10155
  if (model.adapter !== "fal" && model.adapter !== "alibaba") return;
10002
10156
  const spec = falImageSpec(model.providerModelId);
10003
- if (spec === void 0) return;
10004
- const problem = falImageProblem(spec, withPromptForResolve(req));
10005
- if (problem !== void 0) {
10006
- throw new ModelKitError({
10007
- code: problem.code,
10008
- message: problem.message,
10009
- model: model.id,
10010
- retryable: false
10011
- });
10157
+ const ideogram46 = IDEOGRAM_46_IDS.has(model.providerModelId.toLowerCase());
10158
+ if (spec === void 0 && !ideogram46) return;
10159
+ let exact;
10160
+ if (spec === void 0) {
10161
+ exact = ideogram46ExactSize(model, req);
10162
+ } else {
10163
+ const problem = falImageProblem(spec, withPromptForResolve(req));
10164
+ if (problem !== void 0) {
10165
+ throw new ModelKitError({
10166
+ code: problem.code,
10167
+ message: problem.message,
10168
+ model: model.id,
10169
+ retryable: false
10170
+ });
10171
+ }
10172
+ exact = falExactSize(spec, req);
10012
10173
  }
10013
- const exact = falExactSize(spec, req);
10014
10174
  if (exact === void 0) return;
10015
10175
  if (callerSize !== void 0 && callerSize !== exact.tier) {
10016
10176
  warnings.push({
@@ -10067,6 +10227,8 @@ var VIDU_Q4 = "fal-ai/vidu/q4";
10067
10227
  var OMNIHUMAN_V2 = "bytedance/omnihuman/v2";
10068
10228
  var LTX_T2V = "fal-ai/ltx-2.3/text-to-video";
10069
10229
  var LTX_FAST_T2V = "fal-ai/ltx-2.3/text-to-video/fast";
10230
+ var LTX25_T2V = "lightricks/ltx-2.5/text-to-video/pro";
10231
+ var LTX25_FAST_T2V = "lightricks/ltx-2.5/text-to-video/fast";
10070
10232
  var KLING_O3_IMAGE_CAP = 7;
10071
10233
  var KLING_V4_IMAGE_CAP = 10;
10072
10234
  var TURBO_AUDIO_MIN_SECONDS = 2;
@@ -10243,7 +10405,7 @@ function imageAndAudio(req, audioSeconds) {
10243
10405
  }
10244
10406
  return inputSeconds("audio", audio, audioSeconds);
10245
10407
  }
10246
- function ltx(fast) {
10408
+ function ltx(longTiers) {
10247
10409
  return (req) => {
10248
10410
  if (req.lastFrame !== void 0 && req.firstFrame === void 0) {
10249
10411
  return missing("takes an end frame only together with a start frame");
@@ -10251,8 +10413,8 @@ function ltx(fast) {
10251
10413
  if (count(req.referenceImages) + count(req.referenceVideos) + count(req.referenceAudios) > 0) {
10252
10414
  return unsupported2("takes no reference images, videos or audio");
10253
10415
  }
10254
- if (fast && (req.durationSeconds ?? 6) > 10 && req.resolution !== void 0 && req.resolution !== "1080p") {
10255
- return unsupported2("renders over 10 s at 1080p only");
10416
+ if (longTiers !== null && (req.durationSeconds ?? 6) > 10 && req.resolution !== void 0 && !longTiers.includes(req.resolution)) {
10417
+ return unsupported2(`renders over 10 s at ${longTiers.join(" or ")} only`);
10256
10418
  }
10257
10419
  return needsPrompt(req);
10258
10420
  };
@@ -10281,8 +10443,10 @@ var RULES = new Map([
10281
10443
  ...AVATAR_AUDIO.map(
10282
10444
  ([id, limits]) => [id, (req) => imageAndAudio(req, limits)]
10283
10445
  ),
10284
- [LTX_T2V, ltx(false)],
10285
- [LTX_FAST_T2V, ltx(true)]
10446
+ [LTX_T2V, ltx(null)],
10447
+ [LTX_FAST_T2V, ltx(["1080p"])],
10448
+ [LTX25_T2V, ltx(null)],
10449
+ [LTX25_FAST_T2V, ltx(["720p", "1080p"])]
10286
10450
  ]);
10287
10451
  function falVideoProblem(providerModelId, req) {
10288
10452
  return RULES.get(providerModelId.toLowerCase())?.(req);