@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/CHANGELOG.md CHANGED
@@ -9,6 +9,27 @@ header in the release PR.
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+ ## [0.30.0] - Unreleased
13
+
14
+ ### Added
15
+ - `ideogram-4.6` image row on the fal adapter (`ideogram/v4.6`), generation only. `aspectRatio` + `size` (`2K` or `4K`, default `2K`) pick one of fal's fixed sizes, and `exactSize` is sent as given. `quality` is `low`, `medium` or `high`; `auto` sends nothing and fal uses `medium`. fal's prompt expansion is off (the edit endpoint has no such field). It takes no reference images: the edit-only `very_low` tier and masked edits are not exposed.
16
+ - `ideogram-4.6-edit` image row for Precise Edit, on the same `ideogram/v4.6` provider model; the adapter routes there on references. It requires at least one reference (up to 5): the first is the image to edit (`image_url`), the rest (up to 4) are `reference_image_urls`, the output keeps the source size, and `edit_precision` is always `high`. It is a separate row because fal charges edits more than generates and the image price table is keyed by the model row; `size` picks the billed tier.
17
+
18
+ fal bills any output above 2048x2048 px in area at the 4K price, so both rows report the delivered image's tier on the usage event: an edit bills the size it kept, and a generate bills its exact size's area. An `exactSize` needs 256 to 4096 px per side, in multiples of 32, within 1:6; anything else is refused before the call, and an accepted one sets `size` to its area's tier so the quote and the hold price it right.
19
+
20
+ ### Live rows to add after publish
21
+ Add the `ideogram-4.6` and `ideogram-4.6-edit` rows to pro-backend's `model_catalog` only after their per-quality image prices exist and every app that will call them runs 0.30.0. An older kit sends `ideogram-4.6` down the Muse path, so every generate fails.
22
+
23
+ ## [0.29.0] - Unreleased
24
+
25
+ ### Added
26
+ - `ltx-2.3` and `ltx-2.3-fast` (ENG-4281): Lightricks LTX 2.3 on fal, one row per tier;
27
+ a start frame routes to `fal-ai/ltx-2.3/{text,image}-to-video` (or the `/fast` twins),
28
+ else text-to-video. The rows default to `adaptive`: fal's `auto` on image-to-video, its 16:9
29
+ default on text-to-video. The kit's `2k`/`4k` tiers are fal's `1440p`/`2160p`. Pro renders
30
+ 6/8/10 s; Fast renders even 6-20 s, over 10 s at 1080p only. No new vocabulary:
31
+ `fps` is not a kit request field and the adapter leaves fal's 25 fps default in place.
32
+
12
33
  ## [0.28.0] - Unreleased
13
34
 
14
35
  ### Added
package/dist/catalog.cjs CHANGED
@@ -996,6 +996,65 @@ var IMAGE_MODELS = [
996
996
  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."
997
997
  }
998
998
  },
999
+ {
1000
+ // Generation only: fal charges edits more, so editing is its own row
1001
+ // (ideogram-4.6-edit) with its own prices. fal bills any output above
1002
+ // 2048x2048 in area at the 4K price; very_low renders at most 2K, so it is
1003
+ // not exposed (no 4K price exists for it, and the catalog seed gate needs
1004
+ // every size x quality priced). https://fal.ai/models/ideogram/v4.6
1005
+ id: "ideogram-4.6",
1006
+ aliases: [],
1007
+ label: "Ideogram 4.6",
1008
+ type: "image",
1009
+ adapter: "fal",
1010
+ providerModelId: "ideogram/v4.6",
1011
+ lifecycle: "active",
1012
+ exposure: ["cowork", "space_builder"],
1013
+ constraints: {
1014
+ aspectRatios: ["1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3", "5:4", "4:5"],
1015
+ sizes: ["2K", "4K"],
1016
+ qualityOptions: ["auto", "low", "medium", "high"],
1017
+ references: { images: 0 },
1018
+ supports: ["quality", "count", "seed"]
1019
+ },
1020
+ defaults: { size: "2K", aspectRatio: "1:1", quality: "medium", count: 1 },
1021
+ usage: { ...IMAGE_USAGE3, slug: "ideogram" },
1022
+ pricingKind: "image_size",
1023
+ display: {
1024
+ provider: "ideogram",
1025
+ description: "Ideogram 4.6 text-to-image from a prompt, at 2K or 4K. Edits go to Ideogram 4.6 Edit."
1026
+ }
1027
+ },
1028
+ {
1029
+ // Precise Edit only: references switch to the /edit endpoint, where the
1030
+ // first is the image to edit and the rest (up to 4) guide it, so 5 images
1031
+ // in all. The output keeps the source size, so `size` only picks the
1032
+ // billed tier. Same provider model as the generate row, whose adapter
1033
+ // routes on references. https://fal.ai/models/ideogram/v4.6/edit
1034
+ id: "ideogram-4.6-edit",
1035
+ aliases: [],
1036
+ label: "Ideogram 4.6 Edit",
1037
+ type: "image",
1038
+ adapter: "fal",
1039
+ providerModelId: "ideogram/v4.6",
1040
+ lifecycle: "active",
1041
+ exposure: ["cowork", "space_builder"],
1042
+ constraints: {
1043
+ aspectRatios: ["1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3", "5:4", "4:5"],
1044
+ sizes: ["2K", "4K"],
1045
+ qualityOptions: ["auto", "low", "medium", "high"],
1046
+ references: { images: 5 },
1047
+ requires: ["references"],
1048
+ supports: ["quality", "count", "seed"]
1049
+ },
1050
+ defaults: { size: "2K", aspectRatio: "1:1", quality: "medium", count: 1 },
1051
+ usage: { ...IMAGE_USAGE3, slug: "ideogram" },
1052
+ pricingKind: "image_size",
1053
+ display: {
1054
+ provider: "ideogram",
1055
+ 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."
1056
+ }
1057
+ },
999
1058
  {
1000
1059
  id: "seedream-5-0-pro",
1001
1060
  aliases: ["seedream-4-5"],
@@ -5623,6 +5682,7 @@ var KLING_LOGO2 = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0
5623
5682
  var MINIMAX_LOGO4 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
5624
5683
  var BYTEDANCE_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/3bba5d81-4e57-4e71-911b-cdfa05acca2c_compressed.png";
5625
5684
  var XAI_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/858b7fcc-9bd5-411d-aea1-a7b35ecfffab_compressed.png";
5685
+ var LIGHTRICKS_LOGO = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/lightricks.png";
5626
5686
  var H3_RATIOS = ["21:9", "16:9", "4:3", "1:1", "3:4", "9:16"];
5627
5687
  var HAPPY_HORSE_RATIOS = [
5628
5688
  "16:9",
@@ -6221,6 +6281,77 @@ var VIDEO_FAMILY_MODELS = [
6221
6281
  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."
6222
6282
  },
6223
6283
  capabilities: {}
6284
+ },
6285
+ {
6286
+ // https://fal.ai/models/fal-ai/ltx-2.3/text-to-video/api (+ /image-to-video): one row;
6287
+ // a start frame routes to image-to-video, else text-to-video. The kit's 2k/4k tiers
6288
+ // are fal's 1440p/2160p (adapters/fal-ltx.ts). "adaptive" is fal's "auto" on
6289
+ // image-to-video; text-to-video leaves an adaptive ratio at fal's 16:9 default.
6290
+ id: "ltx-2.3",
6291
+ aliases: ["ltx-2-3", "ltx23"],
6292
+ label: "LTX 2.3",
6293
+ type: "video",
6294
+ adapter: "fal",
6295
+ providerModelId: "fal-ai/ltx-2.3/text-to-video",
6296
+ lifecycle: "active",
6297
+ exposure: ["cowork", "space_builder"],
6298
+ constraints: {
6299
+ aspectRatios: ["adaptive", "16:9", "9:16"],
6300
+ resolutions: ["1080p", "2k", "4k"],
6301
+ durations: [6, 8, 10],
6302
+ supports: ["generateAudio", "lastFrame", "safetyChecker"],
6303
+ prompt: { referenceSyntax: "numbered", maxChars: 5e3 },
6304
+ audio: "optional"
6305
+ },
6306
+ defaults: {
6307
+ durationSeconds: 6,
6308
+ resolution: "1080p",
6309
+ aspectRatio: "adaptive",
6310
+ generateAudio: true
6311
+ },
6312
+ usage: { ...VIDEO_USAGE },
6313
+ pricingKind: "video_per_second",
6314
+ display: {
6315
+ provider: "lightricks",
6316
+ logo: LIGHTRICKS_LOGO,
6317
+ 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."
6318
+ },
6319
+ capabilities: { lastFrameRequiresFirstFrame: true }
6320
+ },
6321
+ {
6322
+ // https://fal.ai/models/fal-ai/ltx-2.3/text-to-video/fast/api (+ /image-to-video/fast):
6323
+ // the fast tier at the same resolutions; even durations 6-20 s, but over 10 s is
6324
+ // 1080p at 25 fps only (the kit never sends fps, so the rule checks the tier).
6325
+ id: "ltx-2.3-fast",
6326
+ aliases: ["ltx-2-3-fast", "ltx23-fast"],
6327
+ label: "LTX 2.3 Fast",
6328
+ type: "video",
6329
+ adapter: "fal",
6330
+ providerModelId: "fal-ai/ltx-2.3/text-to-video/fast",
6331
+ lifecycle: "active",
6332
+ exposure: ["cowork", "space_builder"],
6333
+ constraints: {
6334
+ aspectRatios: ["adaptive", "16:9", "9:16"],
6335
+ resolutions: ["1080p", "2k", "4k"],
6336
+ durations: [6, 8, 10, 12, 14, 16, 18, 20],
6337
+ supports: ["generateAudio", "lastFrame", "safetyChecker"],
6338
+ prompt: { referenceSyntax: "numbered", maxChars: 5e3 },
6339
+ audio: "optional"
6340
+ },
6341
+ defaults: {
6342
+ durationSeconds: 6,
6343
+ resolution: "1080p",
6344
+ aspectRatio: "adaptive",
6345
+ generateAudio: true
6346
+ },
6347
+ usage: { ...VIDEO_USAGE },
6348
+ pricingKind: "video_per_second",
6349
+ display: {
6350
+ provider: "lightricks",
6351
+ logo: LIGHTRICKS_LOGO,
6352
+ 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."
6353
+ },
6354
+ capabilities: { lastFrameRequiresFirstFrame: true }
6224
6355
  }
6225
6356
  ];
6226
6357
 
@@ -9929,6 +10060,17 @@ function falImageSpec(providerModelId) {
9929
10060
  }
9930
10061
  var AREA_1K = 1024 * 1024;
9931
10062
  var AREA_2K = 2048 * 2048;
10063
+ var IDEOGRAM_46_EXACT = {
10064
+ minSide: 256,
10065
+ maxSide: 4096,
10066
+ minArea: 256 * 256,
10067
+ maxArea: 4096 * 4096,
10068
+ multipleOf: 32,
10069
+ maxAspect: 6,
10070
+ minTier: "2K",
10071
+ topTier: "4K"
10072
+ };
10073
+ var IDEOGRAM_46_IDS = /* @__PURE__ */ new Set(["ideogram/v4.6"]);
9932
10074
  function checkExactSize(exact, b) {
9933
10075
  const match = /^(\d+)x(\d+)$/.exec(exact);
9934
10076
  if (match === null) {
@@ -9952,7 +10094,7 @@ function checkExactSize(exact, b) {
9952
10094
  return { ok: true, size: { width, height, tier: exactTier(area, b) } };
9953
10095
  }
9954
10096
  function exactTier(area, b) {
9955
- if (area <= AREA_1K) return "1K";
10097
+ if (area <= AREA_1K) return b.minTier ?? "1K";
9956
10098
  if (b.topTier === void 0 || area <= AREA_2K) return "2K";
9957
10099
  return b.topTier;
9958
10100
  }
@@ -10014,23 +10156,43 @@ function falImageProblem(spec, req) {
10014
10156
  }
10015
10157
  function falExactSize(spec, req) {
10016
10158
  if (req.exactSize === void 0 || spec.exactSize === void 0) return void 0;
10017
- const check = checkExactSize(req.exactSize, spec.exactSize);
10159
+ return checkedExactSize(req.exactSize, spec.exactSize);
10160
+ }
10161
+ function checkedExactSize(exact, bounds) {
10162
+ const check = checkExactSize(exact, bounds);
10018
10163
  return check.ok ? check.size : void 0;
10019
10164
  }
10165
+ function ideogram46ExactSize(model, req) {
10166
+ if (req.exactSize === void 0) return void 0;
10167
+ const check = checkExactSize(req.exactSize, IDEOGRAM_46_EXACT);
10168
+ if (check.ok) return check.size;
10169
+ throw new ModelKitError({
10170
+ code: "unsupported_option",
10171
+ message: `${model.label}: ${check.message}`,
10172
+ model: model.id,
10173
+ retryable: false
10174
+ });
10175
+ }
10020
10176
  function applyFalImageRules(model, req, callerSize, warnings) {
10021
10177
  if (model.adapter !== "fal" && model.adapter !== "alibaba") return;
10022
10178
  const spec = falImageSpec(model.providerModelId);
10023
- if (spec === void 0) return;
10024
- const problem = falImageProblem(spec, withPromptForResolve(req));
10025
- if (problem !== void 0) {
10026
- throw new ModelKitError({
10027
- code: problem.code,
10028
- message: problem.message,
10029
- model: model.id,
10030
- retryable: false
10031
- });
10179
+ const ideogram46 = IDEOGRAM_46_IDS.has(model.providerModelId.toLowerCase());
10180
+ if (spec === void 0 && !ideogram46) return;
10181
+ let exact;
10182
+ if (spec === void 0) {
10183
+ exact = ideogram46ExactSize(model, req);
10184
+ } else {
10185
+ const problem = falImageProblem(spec, withPromptForResolve(req));
10186
+ if (problem !== void 0) {
10187
+ throw new ModelKitError({
10188
+ code: problem.code,
10189
+ message: problem.message,
10190
+ model: model.id,
10191
+ retryable: false
10192
+ });
10193
+ }
10194
+ exact = falExactSize(spec, req);
10032
10195
  }
10033
- const exact = falExactSize(spec, req);
10034
10196
  if (exact === void 0) return;
10035
10197
  if (callerSize !== void 0 && callerSize !== exact.tier) {
10036
10198
  warnings.push({
@@ -10085,6 +10247,8 @@ var HAPPY_HORSE = "happyhorse-1.1";
10085
10247
  var HAPPY_HORSE_EDIT = "alibaba/happy-horse/video-edit";
10086
10248
  var VIDU_Q4 = "fal-ai/vidu/q4";
10087
10249
  var OMNIHUMAN_V2 = "bytedance/omnihuman/v2";
10250
+ var LTX_T2V = "fal-ai/ltx-2.3/text-to-video";
10251
+ var LTX_FAST_T2V = "fal-ai/ltx-2.3/text-to-video/fast";
10088
10252
  var KLING_O3_IMAGE_CAP = 7;
10089
10253
  var KLING_V4_IMAGE_CAP = 10;
10090
10254
  var TURBO_AUDIO_MIN_SECONDS = 2;
@@ -10261,6 +10425,20 @@ function imageAndAudio(req, audioSeconds) {
10261
10425
  }
10262
10426
  return inputSeconds("audio", audio, audioSeconds);
10263
10427
  }
10428
+ function ltx(fast) {
10429
+ return (req) => {
10430
+ if (req.lastFrame !== void 0 && req.firstFrame === void 0) {
10431
+ return missing("takes an end frame only together with a start frame");
10432
+ }
10433
+ if (count(req.referenceImages) + count(req.referenceVideos) + count(req.referenceAudios) > 0) {
10434
+ return unsupported2("takes no reference images, videos or audio");
10435
+ }
10436
+ if (fast && (req.durationSeconds ?? 6) > 10 && req.resolution !== void 0 && req.resolution !== "1080p") {
10437
+ return unsupported2("renders over 10 s at 1080p only");
10438
+ }
10439
+ return needsPrompt(req);
10440
+ };
10441
+ }
10264
10442
  var RULES = new Map([
10265
10443
  [MOTION_PRO, motionControl],
10266
10444
  [MOTION_STANDARD, motionControl],
@@ -10284,7 +10462,9 @@ var RULES = new Map([
10284
10462
  [OMNIHUMAN_V2, (req) => imageAndAudio(req, OMNIHUMAN_AUDIO_SECONDS)],
10285
10463
  ...AVATAR_AUDIO.map(
10286
10464
  ([id, limits]) => [id, (req) => imageAndAudio(req, limits)]
10287
- )
10465
+ ),
10466
+ [LTX_T2V, ltx(false)],
10467
+ [LTX_FAST_T2V, ltx(true)]
10288
10468
  ]);
10289
10469
  function falVideoProblem(providerModelId, req) {
10290
10470
  return RULES.get(providerModelId.toLowerCase())?.(req);