@shop-os/modelkit 0.18.2 → 0.19.1

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,59 @@ header in the release PR.
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+ ## [0.19.1] - Unreleased
13
+
14
+ ### Added
15
+ - `seedream-5.5` (ENG-3884): ByteDance Seedream 5.5 on the `ark` adapter
16
+ (`dola-seedream-5-5-261028`, BytePlus Early Access). 1K or 2K (the model has no 4K), 11 aspect
17
+ ratios, up to 10 references, seed and png/jpeg output. `pricingKind: "image_size"`: pro-backend
18
+ needs image pricing rows before it lists.
19
+ - The `ark` adapter sends `background` (`auto` / `opaque` / `transparent`) for rows that list
20
+ `constraints.backgrounds` (only `seedream-5.5`). A transparent request asked for as jpeg is sent
21
+ as png with an `option_ignored` warning, because Ark refuses a transparent jpeg.
22
+
23
+ ## [0.19.0] - 2026-11-10
24
+
25
+ ### Added
26
+ - `minimax-h3-image` and `minimax-h3-image-highspeed` (ENG-3864): MiniMax H3 Image on fal
27
+ (`minimax/h3-image/text-to-image` and `minimax/h3-image/highspeed/text-to-image`; references
28
+ switch to the matching `/edit` endpoint). 1K, 2K or 4K (default 2K: the model renders at least
29
+ 2048², so 1K costs the same), 1 to 10 images per call, up to 16 references (`Image 1`..), each
30
+ side 128 to 8192 px, prompts up to 32,000 characters, `exactSize` from 655,360 px to 4096² at up
31
+ to 3:1. Prompt expansion stays at fal's default (on); there is no seed. Live-checked 2026-11-10
32
+ on every endpoint. Both rows are `pricingKind: "image_size"`: pro-backend needs image pricing
33
+ rows before they list.
34
+ - Reference-video limits beyond the minimum side: `references.videoPixels` gains `minPixels`,
35
+ `maxPixels` and `maxSide`; `references.videoFps` (`{ min, max }`) and `references.videoMaxBytes`
36
+ are new. Reference-image limits: `references.imagePixels` (the same keys) and
37
+ `references.imageAspect` (width over height, `{ min, max }`). All optional; older kits read rows
38
+ loosely and ignore them, so a live row carrying them stays valid for older consumers.
39
+ - `referenceVideoConformPlan(model, probe)` (both entries): from a measured reference video
40
+ (displayed width and height, fps, bytes) it returns `null` when the row takes the video as it
41
+ is, or the target a re-encode must hit: even `width` / `height` scaled by pixel count to keep the
42
+ shape (shrinking wins a conflict, rounded down when shrinking and up when growing), `fps` (24
43
+ under the floor, 30 over the ceiling, or the nearest in-range whole rate), the row's `maxBytes`,
44
+ and `reasons`. It never changes a video's length. An unmeasured size gives `null`.
45
+ `REFERENCE_VIDEO_CONFORM_PROFILE` (`model-safe-v1`) names the rules for cache keys.
46
+ - `referenceImageConformPlan(model, probe)`: the same for a reference image. A frame outside
47
+ `imageAspect` is padded (never stretched) to it, then scaled by pixel count; the plan gives the
48
+ frame size and the picture's size inside it.
49
+ - `seedance-2.0`, `seedance-2.0-fast` and `seedance-2.5` set `videoPixels: { minPixels: 407696,
50
+ maxPixels: 8295044 }`, `videoFps: { min: 23.8, max: 60 }` and `imagePixels: { minPixels: 90000 }`.
51
+ Evidence: Ark's errors on 2.0 (prod 2026-10-06 and 2026-11-07); on 2.5 the video minimum (5 prod
52
+ generations, 2026-10-12..29), the video maximum (one probe, 2026-11-07) and the image minimum
53
+ (about 10 prod generations). 2.5's frame-rate range and 2.0's image minimum are assumed, not
54
+ seen. No image aspect rule is set: none has been seen. `kling-4.0` sets
55
+ `videoFps: { min: 23.9, max: 60.05 }` (fal schema). **Live rows:** add the same keys to these
56
+ four rows in pro-admin after the publish.
57
+
58
+ ### Changed
59
+ - `openai-image`: GIF and SVG output now take reference images. Both go to `images.edit` with the
60
+ same `frame_count`, `frame_duration_ms` and `svg` fields as a generation (live-checked
61
+ 2026-11-07 on `gpt-image-2.6-sunburst` with one reference: an 8-frame animated GIF and an SVG).
62
+ `resolveImageOptions` no longer refuses SVG with references, and the adapter no longer throws
63
+ `unsupported_option` for it.
64
+
12
65
  ## [0.18.2] - Unreleased
13
66
 
14
67
  Two live catalog values move into the kit (ENG-3795). pro-backend's catalog seed is about to sync
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.
@@ -917,6 +967,46 @@ var IMAGE_MODELS = [
917
967
  description: "ByteDance Seedream 5.0 Pro text-to-image and multi-reference image-to-image (up to 10 inputs) with region editing; outputs 1K or 2K."
918
968
  }
919
969
  },
970
+ // Seedream 5.5 (Early Access, 2026-11-11): 1K / 1.5K / 2K, no 4K; exact sizes must total
971
+ // 921,600 to 4,624,220 px, which every SEEDREAM_SIZES 1K and 2K entry does. Up to 10
972
+ // references; `background: "transparent"` returns an RGBA PNG.
973
+ {
974
+ id: "seedream-5.5",
975
+ aliases: [],
976
+ label: "Seedream 5.5",
977
+ type: "image",
978
+ adapter: "ark",
979
+ providerModelId: "dola-seedream-5-5-261028",
980
+ lifecycle: "active",
981
+ exposure: ["cowork", "space_builder"],
982
+ constraints: {
983
+ aspectRatios: [
984
+ "1:1",
985
+ "4:3",
986
+ "3:4",
987
+ "16:9",
988
+ "9:16",
989
+ "3:2",
990
+ "2:3",
991
+ "21:9",
992
+ "9:21",
993
+ "4:5",
994
+ "5:4"
995
+ ],
996
+ sizes: ["1K", "2K"],
997
+ references: { images: 10 },
998
+ supports: ["seed", "outputFormat"],
999
+ backgrounds: ["auto", "opaque", "transparent"]
1000
+ },
1001
+ defaults: { size: "1K", aspectRatio: "1:1" },
1002
+ usage: { ...IMAGE_USAGE3 },
1003
+ pricingKind: "image_size",
1004
+ display: {
1005
+ provider: "bytedance",
1006
+ logo: "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/3bba5d81-4e57-4e71-911b-cdfa05acca2c_compressed.png",
1007
+ description: "ByteDance Seedream 5.5 text-to-image and multi-reference editing (up to 10 inputs): edits that keep what you did not ask to change, transparent PNG output and sharper text; outputs 1K or 2K."
1008
+ }
1009
+ },
920
1010
  {
921
1011
  id: "seedream-4.5",
922
1012
  aliases: [],
@@ -3839,7 +3929,7 @@ var MINIMAX_VOICES = [
3839
3929
  // src/catalog/media-nodes.ts
3840
3930
  var ELEVENLABS_LOGO2 = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/elevenlabs.png";
3841
3931
  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";
3932
+ var MINIMAX_LOGO2 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
3843
3933
  var SYNC_LOGO = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/sync.png";
3844
3934
  var PER_CALL3 = { unit: "images" };
3845
3935
  var EXPOSURE5 = ["cowork", "space_builder"];
@@ -3974,7 +4064,7 @@ var MEDIA_NODE_MODELS = [
3974
4064
  pricingKind: "flat",
3975
4065
  display: {
3976
4066
  provider: "minimax",
3977
- logo: MINIMAX_LOGO,
4067
+ logo: MINIMAX_LOGO2,
3978
4068
  description: "MiniMax Speech 2.8 HD text to speech; studio-quality narration in over 300 voices, with pause and interjection tags."
3979
4069
  },
3980
4070
  capabilities: {}
@@ -4101,7 +4191,7 @@ var MEDIA_NODE_MODELS = [
4101
4191
  pricingKind: "video_per_second",
4102
4192
  display: {
4103
4193
  provider: "minimax",
4104
- logo: MINIMAX_LOGO,
4194
+ logo: MINIMAX_LOGO2,
4105
4195
  description: "MiniMax H3 Max lip sync; animates a portrait image into a talking video as long as the speech, up to 2K."
4106
4196
  },
4107
4197
  capabilities: {}
@@ -4331,7 +4421,7 @@ var MODEL3D_MODELS = [
4331
4421
  // src/catalog/other.ts
4332
4422
  var GOOGLE_LOGO2 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/192485d2-a76a-4657-9c06-930b2c70badd_compressed.png";
4333
4423
  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";
4424
+ var MINIMAX_LOGO3 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
4335
4425
  var OTHER_MODELS = [
4336
4426
  {
4337
4427
  id: "lyria-3-clip-preview",
@@ -4520,7 +4610,7 @@ var OTHER_MODELS = [
4520
4610
  pricingKind: "flat",
4521
4611
  display: {
4522
4612
  provider: "minimax",
4523
- logo: MINIMAX_LOGO2,
4613
+ logo: MINIMAX_LOGO3,
4524
4614
  description: "MiniMax Music 3 songs from a style prompt and your lyrics (or instrumental), up to 5 minutes."
4525
4615
  },
4526
4616
  capabilities: {}
@@ -5218,7 +5308,7 @@ var TEXT_MODELS = [
5218
5308
  var VIDEO_USAGE = { unit: "seconds" };
5219
5309
  var MB = 1024 * 1024;
5220
5310
  var KLING_LOGO = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/kling-color.png";
5221
- var MINIMAX_LOGO3 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
5311
+ var MINIMAX_LOGO4 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
5222
5312
  var BYTEDANCE_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/3bba5d81-4e57-4e71-911b-cdfa05acca2c_compressed.png";
5223
5313
  var XAI_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/858b7fcc-9bd5-411d-aea1-a7b35ecfffab_compressed.png";
5224
5314
  var H3_RATIOS = ["21:9", "16:9", "4:3", "1:1", "3:4", "9:16"];
@@ -5370,7 +5460,8 @@ var VIDEO_FAMILY_MODELS = [
5370
5460
  images: 10,
5371
5461
  videos: 5,
5372
5462
  videoSeconds: { min: 3, max: 30.05, total: 30 },
5373
- videoPixels: { minWidth: 700, minHeight: 700 }
5463
+ videoPixels: { minWidth: 700, minHeight: 700 },
5464
+ videoFps: { min: 23.9, max: 60.05 }
5374
5465
  },
5375
5466
  supports: ["lastFrame"],
5376
5467
  prompt: KLING_V4_PROMPT,
@@ -5536,7 +5627,7 @@ var VIDEO_FAMILY_MODELS = [
5536
5627
  pricingKind: "video_per_second",
5537
5628
  display: {
5538
5629
  provider: "minimax",
5539
- logo: MINIMAX_LOGO3,
5630
+ logo: MINIMAX_LOGO4,
5540
5631
  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."
5541
5632
  },
5542
5633
  capabilities: {}
@@ -5566,7 +5657,7 @@ var VIDEO_FAMILY_MODELS = [
5566
5657
  pricingKind: "video_per_second",
5567
5658
  display: {
5568
5659
  provider: "minimax",
5569
- logo: MINIMAX_LOGO3,
5660
+ logo: MINIMAX_LOGO4,
5570
5661
  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."
5571
5662
  },
5572
5663
  capabilities: { acceptsSourceVideo: true, videoEdit: true }
@@ -5595,7 +5686,7 @@ var VIDEO_FAMILY_MODELS = [
5595
5686
  pricingKind: "video_per_second",
5596
5687
  display: {
5597
5688
  provider: "minimax",
5598
- logo: MINIMAX_LOGO3,
5689
+ logo: MINIMAX_LOGO4,
5599
5690
  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."
5600
5691
  },
5601
5692
  capabilities: { acceptsSourceVideo: true, videoEdit: true }
@@ -5626,7 +5717,7 @@ var VIDEO_FAMILY_MODELS = [
5626
5717
  pricingKind: "video_per_second",
5627
5718
  display: {
5628
5719
  provider: "minimax",
5629
- logo: MINIMAX_LOGO3,
5720
+ logo: MINIMAX_LOGO4,
5630
5721
  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."
5631
5722
  },
5632
5723
  capabilities: { acceptsSourceVideo: true, videoEdit: true }
@@ -5938,6 +6029,11 @@ var SEEDANCE_2_AUDIO = {
5938
6029
  audioFormats: ["wav", "mp3"],
5939
6030
  audioMaxBytes: 15 * 1024 * 1024
5940
6031
  };
6032
+ var SEEDANCE_REFERENCE_MEDIA = {
6033
+ videoPixels: { minPixels: 407696, maxPixels: 8295044 },
6034
+ videoFps: { min: 23.8, max: 60 },
6035
+ imagePixels: { minPixels: 9e4 }
6036
+ };
5941
6037
  var H3_PROMPT2 = { referenceSyntax: "numbered", maxChars: 5e4 };
5942
6038
  var WAN_PROMPT = { referenceSyntax: "numbered", maxChars: 2e4 };
5943
6039
  var OMNI_PROMPT = { referenceSyntax: "caption", maxChars: 5e4 };
@@ -6182,6 +6278,7 @@ var VIDEO_MODELS = [
6182
6278
  audios: 3,
6183
6279
  audioOnly: false,
6184
6280
  videoSeconds: { min: 2, max: 15, total: 15 },
6281
+ ...SEEDANCE_REFERENCE_MEDIA,
6185
6282
  ...SEEDANCE_2_AUDIO
6186
6283
  },
6187
6284
  sourceVideoSeconds: { min: 2, max: 15, inReferenceTotal: true },
@@ -6225,6 +6322,7 @@ var VIDEO_MODELS = [
6225
6322
  audios: 3,
6226
6323
  audioOnly: false,
6227
6324
  videoSeconds: { min: 2, max: 15, total: 15 },
6325
+ ...SEEDANCE_REFERENCE_MEDIA,
6228
6326
  ...SEEDANCE_2_AUDIO
6229
6327
  },
6230
6328
  sourceVideoSeconds: { min: 2, max: 15, inReferenceTotal: true },
@@ -6268,6 +6366,7 @@ var VIDEO_MODELS = [
6268
6366
  videos: 10,
6269
6367
  audios: 10,
6270
6368
  videoSeconds: { min: 2, max: 30, total: 30, editMin: 4 },
6369
+ ...SEEDANCE_REFERENCE_MEDIA,
6271
6370
  // BytePlus: 2-30 s per clip, 30 s in all, wav/mp3, 15 MB each.
6272
6371
  audioSeconds: { min: 2, max: 30, total: 30 },
6273
6372
  audioFormats: ["wav", "mp3"],
@@ -8092,7 +8191,14 @@ var VideoSecondsLimitsSchema = import_zod3.z.looseObject({
8092
8191
  });
8093
8192
  var VideoPixelLimitsSchema = import_zod3.z.looseObject({
8094
8193
  minWidth: import_zod3.z.number().int().positive().optional(),
8095
- minHeight: import_zod3.z.number().int().positive().optional()
8194
+ minHeight: import_zod3.z.number().int().positive().optional(),
8195
+ minPixels: import_zod3.z.number().int().positive().optional(),
8196
+ maxPixels: import_zod3.z.number().int().positive().optional(),
8197
+ maxSide: import_zod3.z.number().int().positive().optional()
8198
+ });
8199
+ var VideoFpsLimitsSchema = import_zod3.z.looseObject({
8200
+ min: import_zod3.z.number().positive().optional(),
8201
+ max: import_zod3.z.number().positive().optional()
8096
8202
  });
8097
8203
  var ReferenceLimitsSchema = import_zod3.z.looseObject({
8098
8204
  images: import_zod3.z.number().optional(),
@@ -8103,6 +8209,13 @@ var ReferenceLimitsSchema = import_zod3.z.looseObject({
8103
8209
  audioOnly: import_zod3.z.boolean().optional(),
8104
8210
  videoSeconds: VideoSecondsLimitsSchema.optional(),
8105
8211
  videoPixels: VideoPixelLimitsSchema.optional(),
8212
+ videoFps: VideoFpsLimitsSchema.optional(),
8213
+ videoMaxBytes: import_zod3.z.number().positive().optional(),
8214
+ imagePixels: VideoPixelLimitsSchema.optional(),
8215
+ imageAspect: import_zod3.z.looseObject({
8216
+ min: import_zod3.z.number().positive().optional(),
8217
+ max: import_zod3.z.number().positive().optional()
8218
+ }).optional(),
8106
8219
  audioSeconds: import_zod3.z.looseObject({
8107
8220
  min: import_zod3.z.number().optional(),
8108
8221
  max: import_zod3.z.number().optional(),
@@ -9085,9 +9198,6 @@ function applyImageOutputRules(model, req, onUnsupported, warnings) {
9085
9198
  }
9086
9199
  if (req.outputFormat === "svg") {
9087
9200
  if (!c.svgModel) refuse(model, `${model.id} names no svgModel to write the SVG`);
9088
- if ((req.references ?? []).length > 0) {
9089
- refuse(model, `${model.label} cannot make an SVG from reference images`);
9090
- }
9091
9201
  if ((req.count ?? 1) > 1) {
9092
9202
  if (onUnsupported === "error") {
9093
9203
  refuse(model, `${model.label} makes one SVG per call`);
@@ -9222,6 +9332,27 @@ var QWEN_EXACT = {
9222
9332
  maxArea: 2048 * 2048,
9223
9333
  multipleOf: 1
9224
9334
  };
9335
+ var MINIMAX_H3_IMAGE_EXACT = {
9336
+ minSide: 1,
9337
+ maxSide: 14142,
9338
+ minArea: 655360,
9339
+ maxArea: 4096 * 4096,
9340
+ multipleOf: 1,
9341
+ maxAspect: 3,
9342
+ topTier: "4K"
9343
+ };
9344
+ function minimaxH3ImageSpec(label) {
9345
+ return {
9346
+ label,
9347
+ maxReferences: 16,
9348
+ maxCount: 10,
9349
+ outputFormats: ALL_FORMATS,
9350
+ promptMax: 32e3,
9351
+ promptRequired: true,
9352
+ aspectRatios: WIDE_RATIOS,
9353
+ exactSize: MINIMAX_H3_IMAGE_EXACT
9354
+ };
9355
+ }
9225
9356
  var FAL_IMAGE_SPECS = /* @__PURE__ */ new Map([
9226
9357
  [
9227
9358
  "krea/v3/text-to-image",
@@ -9263,6 +9394,8 @@ var FAL_IMAGE_SPECS = /* @__PURE__ */ new Map([
9263
9394
  exactSize: QWEN_EXACT
9264
9395
  }
9265
9396
  ],
9397
+ ["minimax/h3-image/text-to-image", minimaxH3ImageSpec("MiniMax H3 Image")],
9398
+ ["minimax/h3-image/highspeed/text-to-image", minimaxH3ImageSpec("MiniMax H3 Image Highspeed")],
9266
9399
  [
9267
9400
  "fal-ai/kling-image/o3/text-to-image",
9268
9401
  {
@@ -9326,6 +9459,7 @@ function falImageSpec(providerModelId) {
9326
9459
  return FAL_IMAGE_SPECS.get(providerModelId.toLowerCase());
9327
9460
  }
9328
9461
  var AREA_1K = 1024 * 1024;
9462
+ var AREA_2K = 2048 * 2048;
9329
9463
  function checkExactSize(exact, b) {
9330
9464
  const match = /^(\d+)x(\d+)$/.exec(exact);
9331
9465
  if (match === null) {
@@ -9337,14 +9471,21 @@ function checkExactSize(exact, b) {
9337
9471
  const sideOk = [width, height].every(
9338
9472
  (side) => side >= b.minSide && side <= b.maxSide && side % b.multipleOf === 0
9339
9473
  );
9340
- if (!sideOk || area < b.minArea || area > b.maxArea) {
9474
+ const aspectOk = b.maxAspect === void 0 || Math.max(width, height) <= b.maxAspect * Math.min(width, height);
9475
+ if (!sideOk || !aspectOk || area < b.minArea || area > b.maxArea) {
9341
9476
  const step = b.multipleOf > 1 ? `, multiples of ${b.multipleOf}` : "";
9477
+ const aspectLimit = b.maxAspect === void 0 ? "" : `, at most ${b.maxAspect}:1,`;
9342
9478
  return {
9343
9479
  ok: false,
9344
- 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}`
9480
+ 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}`
9345
9481
  };
9346
9482
  }
9347
- return { ok: true, size: { width, height, tier: area <= AREA_1K ? "1K" : "2K" } };
9483
+ return { ok: true, size: { width, height, tier: exactTier(area, b) } };
9484
+ }
9485
+ function exactTier(area, b) {
9486
+ if (area <= AREA_1K) return "1K";
9487
+ if (b.topTier === void 0 || area <= AREA_2K) return "2K";
9488
+ return b.topTier;
9348
9489
  }
9349
9490
  function unsupported(message) {
9350
9491
  return { code: "unsupported_option", message };
@@ -10745,4 +10886,124 @@ function resolveOptions(model, call, onUnsupported = "error") {
10745
10886
  return { method: call.method, ...resolveVideoToolCall(model, call.request) };
10746
10887
  }
10747
10888
  }
10889
+
10890
+ // src/reference-video-conform.ts
10891
+ var REFERENCE_VIDEO_CONFORM_PROFILE = "model-safe-v1";
10892
+ var SHRINK_MARGIN = 0.998;
10893
+ var GROW_MARGIN = 1.002;
10894
+ var LOW_FPS_TARGET = 24;
10895
+ var HIGH_FPS_TARGET = 30;
10896
+ function measured(value) {
10897
+ return value !== void 0 && Number.isFinite(value) && value > 0;
10898
+ }
10899
+ function evenDown(value) {
10900
+ return Math.max(2, Math.floor(value / 2) * 2);
10901
+ }
10902
+ function evenUp(value) {
10903
+ return Math.max(2, Math.ceil(value / 2) * 2);
10904
+ }
10905
+ function sizeFix(limits, width, height) {
10906
+ if (!limits) return null;
10907
+ const pixels = width * height;
10908
+ const long = Math.max(width, height);
10909
+ const shrink = [];
10910
+ const grow = [];
10911
+ const reasons = [];
10912
+ if (limits.maxPixels !== void 0 && pixels > limits.maxPixels) {
10913
+ shrink.push(Math.sqrt(limits.maxPixels / pixels) * SHRINK_MARGIN);
10914
+ reasons.push("pixels_over");
10915
+ }
10916
+ if (limits.maxSide !== void 0 && long > limits.maxSide) {
10917
+ shrink.push(limits.maxSide / long * SHRINK_MARGIN);
10918
+ reasons.push("side_over");
10919
+ }
10920
+ if (shrink.length > 0) return { scale: Math.min(...shrink), up: false, reasons };
10921
+ if (limits.minPixels !== void 0 && pixels < limits.minPixels) {
10922
+ grow.push(Math.sqrt(limits.minPixels / pixels) * GROW_MARGIN);
10923
+ reasons.push("pixels_under");
10924
+ }
10925
+ const sideUnder = [
10926
+ limits.minWidth !== void 0 && width < limits.minWidth ? limits.minWidth / width * GROW_MARGIN : 0,
10927
+ limits.minHeight !== void 0 && height < limits.minHeight ? limits.minHeight / height * GROW_MARGIN : 0
10928
+ ].filter((scale) => scale > 0);
10929
+ if (sideUnder.length > 0) {
10930
+ grow.push(...sideUnder);
10931
+ reasons.push("side_under");
10932
+ }
10933
+ if (grow.length > 0) return { scale: Math.max(...grow), up: true, reasons };
10934
+ return null;
10935
+ }
10936
+ function fpsFix(model, fps) {
10937
+ const limits = model.constraints.references?.videoFps;
10938
+ if (!limits || !measured(fps)) return void 0;
10939
+ const inRange = (rate) => (limits.min === void 0 || rate >= limits.min) && (limits.max === void 0 || rate <= limits.max);
10940
+ if (limits.min !== void 0 && fps < limits.min) {
10941
+ const target = inRange(LOW_FPS_TARGET) ? LOW_FPS_TARGET : Math.ceil(limits.min);
10942
+ return { fps: target, reason: "fps_under" };
10943
+ }
10944
+ if (limits.max !== void 0 && fps > limits.max) {
10945
+ const target = inRange(HIGH_FPS_TARGET) ? HIGH_FPS_TARGET : Math.floor(limits.max);
10946
+ return { fps: target, reason: "fps_over" };
10947
+ }
10948
+ return void 0;
10949
+ }
10950
+ function referenceVideoConformPlan(model, probe) {
10951
+ const rate = fpsFix(model, probe.fps);
10952
+ const maxBytes = model.constraints.references?.videoMaxBytes;
10953
+ const overBytes = maxBytes !== void 0 && measured(probe.bytes) && probe.bytes > maxBytes;
10954
+ const { width: probedWidth, height: probedHeight } = probe;
10955
+ if (!measured(probedWidth) || !measured(probedHeight)) return null;
10956
+ const width = Math.round(probedWidth);
10957
+ const height = Math.round(probedHeight);
10958
+ const size = sizeFix(model.constraints.references?.videoPixels, width, height);
10959
+ if (!size && !rate && !overBytes) return null;
10960
+ const round = size?.up ? evenUp : evenDown;
10961
+ const scale = size?.scale ?? 1;
10962
+ const reasons = [...size?.reasons ?? []];
10963
+ if (rate) reasons.push(rate.reason);
10964
+ if (overBytes) reasons.push("bytes_over");
10965
+ const plan = {
10966
+ width: round(width * scale),
10967
+ height: round(height * scale),
10968
+ reasons
10969
+ };
10970
+ if (rate) plan.fps = rate.fps;
10971
+ if (maxBytes !== void 0) plan.maxBytes = maxBytes;
10972
+ return plan;
10973
+ }
10974
+ function referenceImageConformPlan(model, probe) {
10975
+ const { width: probedWidth, height: probedHeight } = probe;
10976
+ if (!measured(probedWidth) || !measured(probedHeight)) return null;
10977
+ const references = model.constraints.references;
10978
+ const width = Math.round(probedWidth);
10979
+ const height = Math.round(probedHeight);
10980
+ const reasons = [];
10981
+ let frameWidth = width;
10982
+ let frameHeight = height;
10983
+ const aspect = references?.imageAspect;
10984
+ if (aspect?.min !== void 0 && width / height < aspect.min) {
10985
+ frameWidth = Math.ceil(height * aspect.min);
10986
+ reasons.push("aspect");
10987
+ } else if (aspect?.max !== void 0 && width / height > aspect.max) {
10988
+ frameHeight = Math.ceil(width / aspect.max);
10989
+ reasons.push("aspect");
10990
+ }
10991
+ const size = sizeFix(references?.imagePixels, frameWidth, frameHeight);
10992
+ if (!size && reasons.length === 0) return null;
10993
+ if (size) reasons.push(...size.reasons);
10994
+ const scale = size?.scale ?? 1;
10995
+ const round = size?.up ? Math.ceil : Math.floor;
10996
+ const frame = {
10997
+ width: Math.max(1, round(frameWidth * scale)),
10998
+ height: Math.max(1, round(frameHeight * scale))
10999
+ };
11000
+ const image = frameWidth > width ? {
11001
+ width: Math.max(1, Math.round(frame.height * width / height)),
11002
+ height: frame.height
11003
+ } : frameHeight > height ? {
11004
+ width: frame.width,
11005
+ height: Math.max(1, Math.round(frame.width * height / width))
11006
+ } : { ...frame };
11007
+ return { ...frame, image, reasons };
11008
+ }
10748
11009
  //# sourceMappingURL=catalog.cjs.map