@shop-os/modelkit 0.18.1 → 0.19.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,60 @@ header in the release PR.
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+ ## [0.19.0] - Unreleased
13
+
14
+ ### Added
15
+ - `minimax-h3-image` and `minimax-h3-image-highspeed` (ENG-3864): MiniMax H3 Image on fal
16
+ (`minimax/h3-image/text-to-image` and `minimax/h3-image/highspeed/text-to-image`; references
17
+ switch to the matching `/edit` endpoint). 1K, 2K or 4K (default 2K: the model renders at least
18
+ 2048², so 1K costs the same), 1 to 10 images per call, up to 16 references (`Image 1`..), each
19
+ side 128 to 8192 px, prompts up to 32,000 characters, `exactSize` from 655,360 px to 4096² at up
20
+ to 3:1. Prompt expansion stays at fal's default (on); there is no seed. Live-checked 2026-11-10
21
+ on every endpoint. Both rows are `pricingKind: "image_size"`: pro-backend needs image pricing
22
+ rows before they list.
23
+ - Reference-video limits beyond the minimum side: `references.videoPixels` gains `minPixels`,
24
+ `maxPixels` and `maxSide`; `references.videoFps` (`{ min, max }`) and `references.videoMaxBytes`
25
+ are new. Reference-image limits: `references.imagePixels` (the same keys) and
26
+ `references.imageAspect` (width over height, `{ min, max }`). All optional; older kits read rows
27
+ loosely and ignore them, so a live row carrying them stays valid for older consumers.
28
+ - `referenceVideoConformPlan(model, probe)` (both entries): from a measured reference video
29
+ (displayed width and height, fps, bytes) it returns `null` when the row takes the video as it
30
+ is, or the target a re-encode must hit: even `width` / `height` scaled by pixel count to keep the
31
+ shape (shrinking wins a conflict, rounded down when shrinking and up when growing), `fps` (24
32
+ under the floor, 30 over the ceiling, or the nearest in-range whole rate), the row's `maxBytes`,
33
+ and `reasons`. It never changes a video's length. An unmeasured size gives `null`.
34
+ `REFERENCE_VIDEO_CONFORM_PROFILE` (`model-safe-v1`) names the rules for cache keys.
35
+ - `referenceImageConformPlan(model, probe)`: the same for a reference image. A frame outside
36
+ `imageAspect` is padded (never stretched) to it, then scaled by pixel count; the plan gives the
37
+ frame size and the picture's size inside it.
38
+ - `seedance-2.0`, `seedance-2.0-fast` and `seedance-2.5` set `videoPixels: { minPixels: 407696,
39
+ maxPixels: 8295044 }`, `videoFps: { min: 23.8, max: 60 }` and `imagePixels: { minPixels: 90000 }`.
40
+ Evidence: Ark's errors on 2.0 (prod 2026-10-06 and 2026-11-07); on 2.5 the video minimum (5 prod
41
+ generations, 2026-10-12..29), the video maximum (one probe, 2026-11-07) and the image minimum
42
+ (about 10 prod generations). 2.5's frame-rate range and 2.0's image minimum are assumed, not
43
+ seen. No image aspect rule is set: none has been seen. `kling-4.0` sets
44
+ `videoFps: { min: 23.9, max: 60.05 }` (fal schema). **Live rows:** add the same keys to these
45
+ four rows in pro-admin after the publish.
46
+
47
+ ### Changed
48
+ - `openai-image`: GIF and SVG output now take reference images. Both go to `images.edit` with the
49
+ same `frame_count`, `frame_duration_ms` and `svg` fields as a generation (live-checked
50
+ 2026-11-07 on `gpt-image-2.6-sunburst` with one reference: an 8-frame animated GIF and an SVG).
51
+ `resolveImageOptions` no longer refuses SVG with references, and the adapter no longer throws
52
+ `unsupported_option` for it.
53
+
54
+ ## [0.18.2] - Unreleased
55
+
56
+ Two live catalog values move into the kit (ENG-3795). pro-backend's catalog seed is about to sync
57
+ the kit-owned fields of existing rows, and both values were set by hand in pro-admin on every
58
+ environment, so without this the first sync would revert them.
59
+
60
+ ### Changed
61
+ - `kling-v3-omni-video` defaults to `mode: "standard"` (720p) instead of `"pro"` (1080p). A request
62
+ with no mode or resolution now renders and bills 720p; `mode: "pro"` or `resolution: "1080p"`
63
+ still picks 1080p.
64
+ - `claude-fable-5` sets `capabilities.reasoning: true`.
65
+
12
66
  ## [0.18.1] - Unreleased
13
67
 
14
68
  Gemini Omni 1.2 Flash (ENG-3761).
package/dist/catalog.cjs CHANGED
@@ -36,6 +36,7 @@ __export(catalog_entry_exports, {
36
36
  ModelKitError: () => ModelKitError,
37
37
  OTHER_MODELS: () => OTHER_MODELS,
38
38
  REFERENCE_SYNTAXES: () => REFERENCE_SYNTAXES,
39
+ REFERENCE_VIDEO_CONFORM_PROFILE: () => REFERENCE_VIDEO_CONFORM_PROFILE,
39
40
  SURFACES: () => SURFACES2,
40
41
  SurfaceSchema: () => SurfaceSchema,
41
42
  TEXT_MODELS: () => TEXT_MODELS,
@@ -63,6 +64,8 @@ __export(catalog_entry_exports, {
63
64
  planVideoTool: () => planVideoTool,
64
65
  primeCatalog: () => primeCatalog,
65
66
  promptConventions: () => promptConventions,
67
+ referenceImageConformPlan: () => referenceImageConformPlan,
68
+ referenceVideoConformPlan: () => referenceVideoConformPlan,
66
69
  resetLiveCatalog: () => resetLiveCatalog,
67
70
  resolutionTier: () => resolutionTier,
68
71
  resolveAudioOptions: () => resolveAudioOptions,
@@ -233,6 +236,7 @@ function isListed(row2) {
233
236
  var IMAGE_USAGE = { unit: "images" };
234
237
  var EXPOSURE = ["cowork", "space_builder"];
235
238
  var LOBE = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light";
239
+ var MINIMAX_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
236
240
  var SIZED_RATIOS = [
237
241
  "1:1",
238
242
  "16:9",
@@ -258,6 +262,36 @@ var RECRAFT_RATIOS = [
258
262
  "5:4",
259
263
  "4:5"
260
264
  ];
265
+ function minimaxH3ImageRow(row2) {
266
+ return {
267
+ id: row2.id,
268
+ aliases: [],
269
+ label: row2.label,
270
+ type: "image",
271
+ adapter: "fal",
272
+ providerModelId: row2.providerModelId,
273
+ lifecycle: "active",
274
+ exposure: EXPOSURE,
275
+ constraints: {
276
+ aspectRatios: [...SIZED_RATIOS],
277
+ sizes: ["1K", "2K", "4K"],
278
+ references: {
279
+ images: 16,
280
+ imagePixels: { minWidth: 128, minHeight: 128, maxSide: 8192 }
281
+ },
282
+ supports: ["count", "outputFormat"],
283
+ prompt: { referenceSyntax: "numbered", maxChars: 32e3 }
284
+ },
285
+ defaults: { size: "2K", aspectRatio: "1:1", count: 1 },
286
+ usage: { ...IMAGE_USAGE },
287
+ pricingKind: "image_size",
288
+ display: {
289
+ provider: "minimax",
290
+ description: row2.description,
291
+ logo: MINIMAX_LOGO
292
+ }
293
+ };
294
+ }
261
295
  var FAL_IMAGE_MODELS = [
262
296
  {
263
297
  // krea/v3/text-to-image; references switch to krea/v3/edit (1-8 images). Billed per
@@ -341,6 +375,22 @@ var FAL_IMAGE_MODELS = [
341
375
  logo: `${LOBE}/qwen-color.png`
342
376
  }
343
377
  },
378
+ minimaxH3ImageRow({
379
+ // minimax/h3-image/text-to-image; references switch to minimax/h3-image/edit. Billed on
380
+ // tokens: $2.30/M input text, $1.50/M input image, $3.80/M output image.
381
+ id: "minimax-h3-image",
382
+ label: "MiniMax H3 Image",
383
+ providerModelId: "minimax/h3-image/text-to-image",
384
+ description: "MiniMax H3 Image text-to-image and multi-image editing with precise instruction following; takes a prompt and up to 16 reference images and outputs 1K, 2K or 4K."
385
+ }),
386
+ minimaxH3ImageRow({
387
+ // minimax/h3-image/highspeed/text-to-image; references switch to .../highspeed/edit.
388
+ // Billed on tokens: $2.30/M input text, $3.00/M input image, $7.60/M output image.
389
+ id: "minimax-h3-image-highspeed",
390
+ label: "MiniMax H3 Image Highspeed",
391
+ providerModelId: "minimax/h3-image/highspeed/text-to-image",
392
+ description: "MiniMax H3 Image Highspeed, the faster tier of H3 Image for text-to-image and multi-image editing; takes a prompt and up to 16 reference images and outputs 1K, 2K or 4K."
393
+ }),
344
394
  {
345
395
  // fal-ai/kling-image/o3/text-to-image; references switch to .../o3/image-to-image (up to
346
396
  // 10, "@Image1".."@Image10"). $0.028 per image at 1K and 2K, double at 4K.
@@ -3839,7 +3889,7 @@ var MINIMAX_VOICES = [
3839
3889
  // src/catalog/media-nodes.ts
3840
3890
  var ELEVENLABS_LOGO2 = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/elevenlabs.png";
3841
3891
  var GOOGLE_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/192485d2-a76a-4657-9c06-930b2c70badd_compressed.png";
3842
- var MINIMAX_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
3892
+ var MINIMAX_LOGO2 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
3843
3893
  var SYNC_LOGO = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/sync.png";
3844
3894
  var PER_CALL3 = { unit: "images" };
3845
3895
  var EXPOSURE5 = ["cowork", "space_builder"];
@@ -3974,7 +4024,7 @@ var MEDIA_NODE_MODELS = [
3974
4024
  pricingKind: "flat",
3975
4025
  display: {
3976
4026
  provider: "minimax",
3977
- logo: MINIMAX_LOGO,
4027
+ logo: MINIMAX_LOGO2,
3978
4028
  description: "MiniMax Speech 2.8 HD text to speech; studio-quality narration in over 300 voices, with pause and interjection tags."
3979
4029
  },
3980
4030
  capabilities: {}
@@ -4101,7 +4151,7 @@ var MEDIA_NODE_MODELS = [
4101
4151
  pricingKind: "video_per_second",
4102
4152
  display: {
4103
4153
  provider: "minimax",
4104
- logo: MINIMAX_LOGO,
4154
+ logo: MINIMAX_LOGO2,
4105
4155
  description: "MiniMax H3 Max lip sync; animates a portrait image into a talking video as long as the speech, up to 2K."
4106
4156
  },
4107
4157
  capabilities: {}
@@ -4331,7 +4381,7 @@ var MODEL3D_MODELS = [
4331
4381
  // src/catalog/other.ts
4332
4382
  var GOOGLE_LOGO2 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/192485d2-a76a-4657-9c06-930b2c70badd_compressed.png";
4333
4383
  var ELEVENLABS_LOGO3 = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/elevenlabs.png";
4334
- var MINIMAX_LOGO2 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
4384
+ var MINIMAX_LOGO3 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
4335
4385
  var OTHER_MODELS = [
4336
4386
  {
4337
4387
  id: "lyria-3-clip-preview",
@@ -4520,7 +4570,7 @@ var OTHER_MODELS = [
4520
4570
  pricingKind: "flat",
4521
4571
  display: {
4522
4572
  provider: "minimax",
4523
- logo: MINIMAX_LOGO2,
4573
+ logo: MINIMAX_LOGO3,
4524
4574
  description: "MiniMax Music 3 songs from a style prompt and your lyrics (or instrumental), up to 5 minutes."
4525
4575
  },
4526
4576
  capabilities: {}
@@ -4938,6 +4988,7 @@ var TEXT_MODELS = [
4938
4988
  description: "Anthropic Claude Fable 5 (legacy) model for demanding reasoning and long-horizon agentic work; text and image input, 1M-token context."
4939
4989
  },
4940
4990
  capabilities: {
4991
+ reasoning: true,
4941
4992
  vision: true,
4942
4993
  contextWindow: 1e6
4943
4994
  }
@@ -5217,7 +5268,7 @@ var TEXT_MODELS = [
5217
5268
  var VIDEO_USAGE = { unit: "seconds" };
5218
5269
  var MB = 1024 * 1024;
5219
5270
  var KLING_LOGO = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/kling-color.png";
5220
- var MINIMAX_LOGO3 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
5271
+ var MINIMAX_LOGO4 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
5221
5272
  var BYTEDANCE_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/3bba5d81-4e57-4e71-911b-cdfa05acca2c_compressed.png";
5222
5273
  var XAI_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/858b7fcc-9bd5-411d-aea1-a7b35ecfffab_compressed.png";
5223
5274
  var H3_RATIOS = ["21:9", "16:9", "4:3", "1:1", "3:4", "9:16"];
@@ -5369,7 +5420,8 @@ var VIDEO_FAMILY_MODELS = [
5369
5420
  images: 10,
5370
5421
  videos: 5,
5371
5422
  videoSeconds: { min: 3, max: 30.05, total: 30 },
5372
- videoPixels: { minWidth: 700, minHeight: 700 }
5423
+ videoPixels: { minWidth: 700, minHeight: 700 },
5424
+ videoFps: { min: 23.9, max: 60.05 }
5373
5425
  },
5374
5426
  supports: ["lastFrame"],
5375
5427
  prompt: KLING_V4_PROMPT,
@@ -5535,7 +5587,7 @@ var VIDEO_FAMILY_MODELS = [
5535
5587
  pricingKind: "video_per_second",
5536
5588
  display: {
5537
5589
  provider: "minimax",
5538
- logo: MINIMAX_LOGO3,
5590
+ logo: MINIMAX_LOGO4,
5539
5591
  description: "The fast tier of MiniMax H3 Max: text-to-video and start/end-frame image-to-video with native audio and an optional soundtrack clip, up to 15 seconds at 1080p."
5540
5592
  },
5541
5593
  capabilities: {}
@@ -5565,7 +5617,7 @@ var VIDEO_FAMILY_MODELS = [
5565
5617
  pricingKind: "video_per_second",
5566
5618
  display: {
5567
5619
  provider: "minimax",
5568
- logo: MINIMAX_LOGO3,
5620
+ logo: MINIMAX_LOGO4,
5569
5621
  description: "MiniMax H3 Max Insert: generates a new 5-13 second scene inside an existing video from a prompt, reference images or videos, then returns to the original footage."
5570
5622
  },
5571
5623
  capabilities: { acceptsSourceVideo: true, videoEdit: true }
@@ -5594,7 +5646,7 @@ var VIDEO_FAMILY_MODELS = [
5594
5646
  pricingKind: "video_per_second",
5595
5647
  display: {
5596
5648
  provider: "minimax",
5597
- logo: MINIMAX_LOGO3,
5649
+ logo: MINIMAX_LOGO4,
5598
5650
  description: "MiniMax H3 Max Recast: replaces the people in a 5-30 second video with up to 4 reference photos, keeping the motion, camera, cuts and soundtrack."
5599
5651
  },
5600
5652
  capabilities: { acceptsSourceVideo: true, videoEdit: true }
@@ -5625,7 +5677,7 @@ var VIDEO_FAMILY_MODELS = [
5625
5677
  pricingKind: "video_per_second",
5626
5678
  display: {
5627
5679
  provider: "minimax",
5628
- logo: MINIMAX_LOGO3,
5680
+ logo: MINIMAX_LOGO4,
5629
5681
  description: "MiniMax H3 Max Relight: relights a video of up to 15 seconds from a lighting sphere image, keeping the subjects, motion, camera and audio."
5630
5682
  },
5631
5683
  capabilities: { acceptsSourceVideo: true, videoEdit: true }
@@ -5937,6 +5989,11 @@ var SEEDANCE_2_AUDIO = {
5937
5989
  audioFormats: ["wav", "mp3"],
5938
5990
  audioMaxBytes: 15 * 1024 * 1024
5939
5991
  };
5992
+ var SEEDANCE_REFERENCE_MEDIA = {
5993
+ videoPixels: { minPixels: 407696, maxPixels: 8295044 },
5994
+ videoFps: { min: 23.8, max: 60 },
5995
+ imagePixels: { minPixels: 9e4 }
5996
+ };
5940
5997
  var H3_PROMPT2 = { referenceSyntax: "numbered", maxChars: 5e4 };
5941
5998
  var WAN_PROMPT = { referenceSyntax: "numbered", maxChars: 2e4 };
5942
5999
  var OMNI_PROMPT = { referenceSyntax: "caption", maxChars: 5e4 };
@@ -6181,6 +6238,7 @@ var VIDEO_MODELS = [
6181
6238
  audios: 3,
6182
6239
  audioOnly: false,
6183
6240
  videoSeconds: { min: 2, max: 15, total: 15 },
6241
+ ...SEEDANCE_REFERENCE_MEDIA,
6184
6242
  ...SEEDANCE_2_AUDIO
6185
6243
  },
6186
6244
  sourceVideoSeconds: { min: 2, max: 15, inReferenceTotal: true },
@@ -6224,6 +6282,7 @@ var VIDEO_MODELS = [
6224
6282
  audios: 3,
6225
6283
  audioOnly: false,
6226
6284
  videoSeconds: { min: 2, max: 15, total: 15 },
6285
+ ...SEEDANCE_REFERENCE_MEDIA,
6227
6286
  ...SEEDANCE_2_AUDIO
6228
6287
  },
6229
6288
  sourceVideoSeconds: { min: 2, max: 15, inReferenceTotal: true },
@@ -6267,6 +6326,7 @@ var VIDEO_MODELS = [
6267
6326
  videos: 10,
6268
6327
  audios: 10,
6269
6328
  videoSeconds: { min: 2, max: 30, total: 30, editMin: 4 },
6329
+ ...SEEDANCE_REFERENCE_MEDIA,
6270
6330
  // BytePlus: 2-30 s per clip, 30 s in all, wav/mp3, 15 MB each.
6271
6331
  audioSeconds: { min: 2, max: 30, total: 30 },
6272
6332
  audioFormats: ["wav", "mp3"],
@@ -6415,7 +6475,12 @@ var VIDEO_MODELS = [
6415
6475
  prompt: KLING_PROMPT2,
6416
6476
  audio: "optional"
6417
6477
  },
6418
- defaults: { durationSeconds: 5, aspectRatio: "16:9", generateAudio: true, mode: "pro" },
6478
+ defaults: {
6479
+ durationSeconds: 5,
6480
+ aspectRatio: "16:9",
6481
+ generateAudio: true,
6482
+ mode: "standard"
6483
+ },
6419
6484
  usage: { ...VIDEO_USAGE3 },
6420
6485
  pricingKind: "video_per_second",
6421
6486
  display: {
@@ -8086,7 +8151,14 @@ var VideoSecondsLimitsSchema = import_zod3.z.looseObject({
8086
8151
  });
8087
8152
  var VideoPixelLimitsSchema = import_zod3.z.looseObject({
8088
8153
  minWidth: import_zod3.z.number().int().positive().optional(),
8089
- minHeight: import_zod3.z.number().int().positive().optional()
8154
+ minHeight: import_zod3.z.number().int().positive().optional(),
8155
+ minPixels: import_zod3.z.number().int().positive().optional(),
8156
+ maxPixels: import_zod3.z.number().int().positive().optional(),
8157
+ maxSide: import_zod3.z.number().int().positive().optional()
8158
+ });
8159
+ var VideoFpsLimitsSchema = import_zod3.z.looseObject({
8160
+ min: import_zod3.z.number().positive().optional(),
8161
+ max: import_zod3.z.number().positive().optional()
8090
8162
  });
8091
8163
  var ReferenceLimitsSchema = import_zod3.z.looseObject({
8092
8164
  images: import_zod3.z.number().optional(),
@@ -8097,6 +8169,13 @@ var ReferenceLimitsSchema = import_zod3.z.looseObject({
8097
8169
  audioOnly: import_zod3.z.boolean().optional(),
8098
8170
  videoSeconds: VideoSecondsLimitsSchema.optional(),
8099
8171
  videoPixels: VideoPixelLimitsSchema.optional(),
8172
+ videoFps: VideoFpsLimitsSchema.optional(),
8173
+ videoMaxBytes: import_zod3.z.number().positive().optional(),
8174
+ imagePixels: VideoPixelLimitsSchema.optional(),
8175
+ imageAspect: import_zod3.z.looseObject({
8176
+ min: import_zod3.z.number().positive().optional(),
8177
+ max: import_zod3.z.number().positive().optional()
8178
+ }).optional(),
8100
8179
  audioSeconds: import_zod3.z.looseObject({
8101
8180
  min: import_zod3.z.number().optional(),
8102
8181
  max: import_zod3.z.number().optional(),
@@ -9079,9 +9158,6 @@ function applyImageOutputRules(model, req, onUnsupported, warnings) {
9079
9158
  }
9080
9159
  if (req.outputFormat === "svg") {
9081
9160
  if (!c.svgModel) refuse(model, `${model.id} names no svgModel to write the SVG`);
9082
- if ((req.references ?? []).length > 0) {
9083
- refuse(model, `${model.label} cannot make an SVG from reference images`);
9084
- }
9085
9161
  if ((req.count ?? 1) > 1) {
9086
9162
  if (onUnsupported === "error") {
9087
9163
  refuse(model, `${model.label} makes one SVG per call`);
@@ -9216,6 +9292,27 @@ var QWEN_EXACT = {
9216
9292
  maxArea: 2048 * 2048,
9217
9293
  multipleOf: 1
9218
9294
  };
9295
+ var MINIMAX_H3_IMAGE_EXACT = {
9296
+ minSide: 1,
9297
+ maxSide: 14142,
9298
+ minArea: 655360,
9299
+ maxArea: 4096 * 4096,
9300
+ multipleOf: 1,
9301
+ maxAspect: 3,
9302
+ topTier: "4K"
9303
+ };
9304
+ function minimaxH3ImageSpec(label) {
9305
+ return {
9306
+ label,
9307
+ maxReferences: 16,
9308
+ maxCount: 10,
9309
+ outputFormats: ALL_FORMATS,
9310
+ promptMax: 32e3,
9311
+ promptRequired: true,
9312
+ aspectRatios: WIDE_RATIOS,
9313
+ exactSize: MINIMAX_H3_IMAGE_EXACT
9314
+ };
9315
+ }
9219
9316
  var FAL_IMAGE_SPECS = /* @__PURE__ */ new Map([
9220
9317
  [
9221
9318
  "krea/v3/text-to-image",
@@ -9257,6 +9354,8 @@ var FAL_IMAGE_SPECS = /* @__PURE__ */ new Map([
9257
9354
  exactSize: QWEN_EXACT
9258
9355
  }
9259
9356
  ],
9357
+ ["minimax/h3-image/text-to-image", minimaxH3ImageSpec("MiniMax H3 Image")],
9358
+ ["minimax/h3-image/highspeed/text-to-image", minimaxH3ImageSpec("MiniMax H3 Image Highspeed")],
9260
9359
  [
9261
9360
  "fal-ai/kling-image/o3/text-to-image",
9262
9361
  {
@@ -9320,6 +9419,7 @@ function falImageSpec(providerModelId) {
9320
9419
  return FAL_IMAGE_SPECS.get(providerModelId.toLowerCase());
9321
9420
  }
9322
9421
  var AREA_1K = 1024 * 1024;
9422
+ var AREA_2K = 2048 * 2048;
9323
9423
  function checkExactSize(exact, b) {
9324
9424
  const match = /^(\d+)x(\d+)$/.exec(exact);
9325
9425
  if (match === null) {
@@ -9331,14 +9431,21 @@ function checkExactSize(exact, b) {
9331
9431
  const sideOk = [width, height].every(
9332
9432
  (side) => side >= b.minSide && side <= b.maxSide && side % b.multipleOf === 0
9333
9433
  );
9334
- if (!sideOk || area < b.minArea || area > b.maxArea) {
9434
+ const aspectOk = b.maxAspect === void 0 || Math.max(width, height) <= b.maxAspect * Math.min(width, height);
9435
+ if (!sideOk || !aspectOk || area < b.minArea || area > b.maxArea) {
9335
9436
  const step = b.multipleOf > 1 ? `, multiples of ${b.multipleOf}` : "";
9437
+ const aspectLimit = b.maxAspect === void 0 ? "" : `, at most ${b.maxAspect}:1,`;
9336
9438
  return {
9337
9439
  ok: false,
9338
- message: `takes an exactSize with sides of ${b.minSide} to ${b.maxSide} px${step} and ${b.minArea} to ${b.maxArea} px in total; got ${exact}`
9440
+ message: `takes an exactSize with sides of ${b.minSide} to ${b.maxSide} px${step}${aspectLimit} and ${b.minArea} to ${b.maxArea} px in total; got ${exact}`
9339
9441
  };
9340
9442
  }
9341
- return { ok: true, size: { width, height, tier: area <= AREA_1K ? "1K" : "2K" } };
9443
+ return { ok: true, size: { width, height, tier: exactTier(area, b) } };
9444
+ }
9445
+ function exactTier(area, b) {
9446
+ if (area <= AREA_1K) return "1K";
9447
+ if (b.topTier === void 0 || area <= AREA_2K) return "2K";
9448
+ return b.topTier;
9342
9449
  }
9343
9450
  function unsupported(message) {
9344
9451
  return { code: "unsupported_option", message };
@@ -10739,4 +10846,124 @@ function resolveOptions(model, call, onUnsupported = "error") {
10739
10846
  return { method: call.method, ...resolveVideoToolCall(model, call.request) };
10740
10847
  }
10741
10848
  }
10849
+
10850
+ // src/reference-video-conform.ts
10851
+ var REFERENCE_VIDEO_CONFORM_PROFILE = "model-safe-v1";
10852
+ var SHRINK_MARGIN = 0.998;
10853
+ var GROW_MARGIN = 1.002;
10854
+ var LOW_FPS_TARGET = 24;
10855
+ var HIGH_FPS_TARGET = 30;
10856
+ function measured(value) {
10857
+ return value !== void 0 && Number.isFinite(value) && value > 0;
10858
+ }
10859
+ function evenDown(value) {
10860
+ return Math.max(2, Math.floor(value / 2) * 2);
10861
+ }
10862
+ function evenUp(value) {
10863
+ return Math.max(2, Math.ceil(value / 2) * 2);
10864
+ }
10865
+ function sizeFix(limits, width, height) {
10866
+ if (!limits) return null;
10867
+ const pixels = width * height;
10868
+ const long = Math.max(width, height);
10869
+ const shrink = [];
10870
+ const grow = [];
10871
+ const reasons = [];
10872
+ if (limits.maxPixels !== void 0 && pixels > limits.maxPixels) {
10873
+ shrink.push(Math.sqrt(limits.maxPixels / pixels) * SHRINK_MARGIN);
10874
+ reasons.push("pixels_over");
10875
+ }
10876
+ if (limits.maxSide !== void 0 && long > limits.maxSide) {
10877
+ shrink.push(limits.maxSide / long * SHRINK_MARGIN);
10878
+ reasons.push("side_over");
10879
+ }
10880
+ if (shrink.length > 0) return { scale: Math.min(...shrink), up: false, reasons };
10881
+ if (limits.minPixels !== void 0 && pixels < limits.minPixels) {
10882
+ grow.push(Math.sqrt(limits.minPixels / pixels) * GROW_MARGIN);
10883
+ reasons.push("pixels_under");
10884
+ }
10885
+ const sideUnder = [
10886
+ limits.minWidth !== void 0 && width < limits.minWidth ? limits.minWidth / width * GROW_MARGIN : 0,
10887
+ limits.minHeight !== void 0 && height < limits.minHeight ? limits.minHeight / height * GROW_MARGIN : 0
10888
+ ].filter((scale) => scale > 0);
10889
+ if (sideUnder.length > 0) {
10890
+ grow.push(...sideUnder);
10891
+ reasons.push("side_under");
10892
+ }
10893
+ if (grow.length > 0) return { scale: Math.max(...grow), up: true, reasons };
10894
+ return null;
10895
+ }
10896
+ function fpsFix(model, fps) {
10897
+ const limits = model.constraints.references?.videoFps;
10898
+ if (!limits || !measured(fps)) return void 0;
10899
+ const inRange = (rate) => (limits.min === void 0 || rate >= limits.min) && (limits.max === void 0 || rate <= limits.max);
10900
+ if (limits.min !== void 0 && fps < limits.min) {
10901
+ const target = inRange(LOW_FPS_TARGET) ? LOW_FPS_TARGET : Math.ceil(limits.min);
10902
+ return { fps: target, reason: "fps_under" };
10903
+ }
10904
+ if (limits.max !== void 0 && fps > limits.max) {
10905
+ const target = inRange(HIGH_FPS_TARGET) ? HIGH_FPS_TARGET : Math.floor(limits.max);
10906
+ return { fps: target, reason: "fps_over" };
10907
+ }
10908
+ return void 0;
10909
+ }
10910
+ function referenceVideoConformPlan(model, probe) {
10911
+ const rate = fpsFix(model, probe.fps);
10912
+ const maxBytes = model.constraints.references?.videoMaxBytes;
10913
+ const overBytes = maxBytes !== void 0 && measured(probe.bytes) && probe.bytes > maxBytes;
10914
+ const { width: probedWidth, height: probedHeight } = probe;
10915
+ if (!measured(probedWidth) || !measured(probedHeight)) return null;
10916
+ const width = Math.round(probedWidth);
10917
+ const height = Math.round(probedHeight);
10918
+ const size = sizeFix(model.constraints.references?.videoPixels, width, height);
10919
+ if (!size && !rate && !overBytes) return null;
10920
+ const round = size?.up ? evenUp : evenDown;
10921
+ const scale = size?.scale ?? 1;
10922
+ const reasons = [...size?.reasons ?? []];
10923
+ if (rate) reasons.push(rate.reason);
10924
+ if (overBytes) reasons.push("bytes_over");
10925
+ const plan = {
10926
+ width: round(width * scale),
10927
+ height: round(height * scale),
10928
+ reasons
10929
+ };
10930
+ if (rate) plan.fps = rate.fps;
10931
+ if (maxBytes !== void 0) plan.maxBytes = maxBytes;
10932
+ return plan;
10933
+ }
10934
+ function referenceImageConformPlan(model, probe) {
10935
+ const { width: probedWidth, height: probedHeight } = probe;
10936
+ if (!measured(probedWidth) || !measured(probedHeight)) return null;
10937
+ const references = model.constraints.references;
10938
+ const width = Math.round(probedWidth);
10939
+ const height = Math.round(probedHeight);
10940
+ const reasons = [];
10941
+ let frameWidth = width;
10942
+ let frameHeight = height;
10943
+ const aspect = references?.imageAspect;
10944
+ if (aspect?.min !== void 0 && width / height < aspect.min) {
10945
+ frameWidth = Math.ceil(height * aspect.min);
10946
+ reasons.push("aspect");
10947
+ } else if (aspect?.max !== void 0 && width / height > aspect.max) {
10948
+ frameHeight = Math.ceil(width / aspect.max);
10949
+ reasons.push("aspect");
10950
+ }
10951
+ const size = sizeFix(references?.imagePixels, frameWidth, frameHeight);
10952
+ if (!size && reasons.length === 0) return null;
10953
+ if (size) reasons.push(...size.reasons);
10954
+ const scale = size?.scale ?? 1;
10955
+ const round = size?.up ? Math.ceil : Math.floor;
10956
+ const frame = {
10957
+ width: Math.max(1, round(frameWidth * scale)),
10958
+ height: Math.max(1, round(frameHeight * scale))
10959
+ };
10960
+ const image = frameWidth > width ? {
10961
+ width: Math.max(1, Math.round(frame.height * width / height)),
10962
+ height: frame.height
10963
+ } : frameHeight > height ? {
10964
+ width: frame.width,
10965
+ height: Math.max(1, Math.round(frame.width * height / width))
10966
+ } : { ...frame };
10967
+ return { ...frame, image, reasons };
10968
+ }
10742
10969
  //# sourceMappingURL=catalog.cjs.map