@shop-os/modelkit 0.18.2 → 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/dist/index.cjs CHANGED
@@ -51,6 +51,7 @@ __export(index_exports, {
51
51
  MODEL3D_MODELS: () => MODEL3D_MODELS,
52
52
  MODELS: () => MODELS,
53
53
  ModelKitError: () => ModelKitError,
54
+ REFERENCE_VIDEO_CONFORM_PROFILE: () => REFERENCE_VIDEO_CONFORM_PROFILE,
54
55
  SURFACES: () => SURFACES2,
55
56
  SurfaceSchema: () => SurfaceSchema,
56
57
  VIDEO_INPUT_SPEC_KEYS: () => VIDEO_INPUT_SPEC_KEYS,
@@ -118,6 +119,8 @@ __export(index_exports, {
118
119
  primeCatalog: () => primeCatalog,
119
120
  prodiaAdapter: () => prodiaAdapter,
120
121
  readErrorBody: () => readErrorBody,
122
+ referenceImageConformPlan: () => referenceImageConformPlan,
123
+ referenceVideoConformPlan: () => referenceVideoConformPlan,
121
124
  replicateAdapter: () => replicateAdapter,
122
125
  resetLiveCatalog: () => resetLiveCatalog,
123
126
  resolutionTier: () => resolutionTier,
@@ -308,6 +311,7 @@ function isListed(row2) {
308
311
  var IMAGE_USAGE = { unit: "images" };
309
312
  var EXPOSURE = ["cowork", "space_builder"];
310
313
  var LOBE = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light";
314
+ var MINIMAX_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
311
315
  var SIZED_RATIOS = [
312
316
  "1:1",
313
317
  "16:9",
@@ -333,6 +337,36 @@ var RECRAFT_RATIOS = [
333
337
  "5:4",
334
338
  "4:5"
335
339
  ];
340
+ function minimaxH3ImageRow(row2) {
341
+ return {
342
+ id: row2.id,
343
+ aliases: [],
344
+ label: row2.label,
345
+ type: "image",
346
+ adapter: "fal",
347
+ providerModelId: row2.providerModelId,
348
+ lifecycle: "active",
349
+ exposure: EXPOSURE,
350
+ constraints: {
351
+ aspectRatios: [...SIZED_RATIOS],
352
+ sizes: ["1K", "2K", "4K"],
353
+ references: {
354
+ images: 16,
355
+ imagePixels: { minWidth: 128, minHeight: 128, maxSide: 8192 }
356
+ },
357
+ supports: ["count", "outputFormat"],
358
+ prompt: { referenceSyntax: "numbered", maxChars: 32e3 }
359
+ },
360
+ defaults: { size: "2K", aspectRatio: "1:1", count: 1 },
361
+ usage: { ...IMAGE_USAGE },
362
+ pricingKind: "image_size",
363
+ display: {
364
+ provider: "minimax",
365
+ description: row2.description,
366
+ logo: MINIMAX_LOGO
367
+ }
368
+ };
369
+ }
336
370
  var FAL_IMAGE_MODELS = [
337
371
  {
338
372
  // krea/v3/text-to-image; references switch to krea/v3/edit (1-8 images). Billed per
@@ -416,6 +450,22 @@ var FAL_IMAGE_MODELS = [
416
450
  logo: `${LOBE}/qwen-color.png`
417
451
  }
418
452
  },
453
+ minimaxH3ImageRow({
454
+ // minimax/h3-image/text-to-image; references switch to minimax/h3-image/edit. Billed on
455
+ // tokens: $2.30/M input text, $1.50/M input image, $3.80/M output image.
456
+ id: "minimax-h3-image",
457
+ label: "MiniMax H3 Image",
458
+ providerModelId: "minimax/h3-image/text-to-image",
459
+ 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."
460
+ }),
461
+ minimaxH3ImageRow({
462
+ // minimax/h3-image/highspeed/text-to-image; references switch to .../highspeed/edit.
463
+ // Billed on tokens: $2.30/M input text, $3.00/M input image, $7.60/M output image.
464
+ id: "minimax-h3-image-highspeed",
465
+ label: "MiniMax H3 Image Highspeed",
466
+ providerModelId: "minimax/h3-image/highspeed/text-to-image",
467
+ 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."
468
+ }),
419
469
  {
420
470
  // fal-ai/kling-image/o3/text-to-image; references switch to .../o3/image-to-image (up to
421
471
  // 10, "@Image1".."@Image10"). $0.028 per image at 1K and 2K, double at 4K.
@@ -3914,7 +3964,7 @@ var MINIMAX_VOICES = [
3914
3964
  // src/catalog/media-nodes.ts
3915
3965
  var ELEVENLABS_LOGO2 = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/elevenlabs.png";
3916
3966
  var GOOGLE_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/192485d2-a76a-4657-9c06-930b2c70badd_compressed.png";
3917
- var MINIMAX_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
3967
+ var MINIMAX_LOGO2 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
3918
3968
  var SYNC_LOGO = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/sync.png";
3919
3969
  var PER_CALL3 = { unit: "images" };
3920
3970
  var EXPOSURE5 = ["cowork", "space_builder"];
@@ -4049,7 +4099,7 @@ var MEDIA_NODE_MODELS = [
4049
4099
  pricingKind: "flat",
4050
4100
  display: {
4051
4101
  provider: "minimax",
4052
- logo: MINIMAX_LOGO,
4102
+ logo: MINIMAX_LOGO2,
4053
4103
  description: "MiniMax Speech 2.8 HD text to speech; studio-quality narration in over 300 voices, with pause and interjection tags."
4054
4104
  },
4055
4105
  capabilities: {}
@@ -4176,7 +4226,7 @@ var MEDIA_NODE_MODELS = [
4176
4226
  pricingKind: "video_per_second",
4177
4227
  display: {
4178
4228
  provider: "minimax",
4179
- logo: MINIMAX_LOGO,
4229
+ logo: MINIMAX_LOGO2,
4180
4230
  description: "MiniMax H3 Max lip sync; animates a portrait image into a talking video as long as the speech, up to 2K."
4181
4231
  },
4182
4232
  capabilities: {}
@@ -4406,7 +4456,7 @@ var MODEL3D_MODELS = [
4406
4456
  // src/catalog/other.ts
4407
4457
  var GOOGLE_LOGO2 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/192485d2-a76a-4657-9c06-930b2c70badd_compressed.png";
4408
4458
  var ELEVENLABS_LOGO3 = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/elevenlabs.png";
4409
- var MINIMAX_LOGO2 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
4459
+ var MINIMAX_LOGO3 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
4410
4460
  var OTHER_MODELS = [
4411
4461
  {
4412
4462
  id: "lyria-3-clip-preview",
@@ -4595,7 +4645,7 @@ var OTHER_MODELS = [
4595
4645
  pricingKind: "flat",
4596
4646
  display: {
4597
4647
  provider: "minimax",
4598
- logo: MINIMAX_LOGO2,
4648
+ logo: MINIMAX_LOGO3,
4599
4649
  description: "MiniMax Music 3 songs from a style prompt and your lyrics (or instrumental), up to 5 minutes."
4600
4650
  },
4601
4651
  capabilities: {}
@@ -5293,7 +5343,7 @@ var TEXT_MODELS = [
5293
5343
  var VIDEO_USAGE = { unit: "seconds" };
5294
5344
  var MB = 1024 * 1024;
5295
5345
  var KLING_LOGO = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/kling-color.png";
5296
- var MINIMAX_LOGO3 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
5346
+ var MINIMAX_LOGO4 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
5297
5347
  var BYTEDANCE_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/3bba5d81-4e57-4e71-911b-cdfa05acca2c_compressed.png";
5298
5348
  var XAI_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/858b7fcc-9bd5-411d-aea1-a7b35ecfffab_compressed.png";
5299
5349
  var H3_RATIOS = ["21:9", "16:9", "4:3", "1:1", "3:4", "9:16"];
@@ -5445,7 +5495,8 @@ var VIDEO_FAMILY_MODELS = [
5445
5495
  images: 10,
5446
5496
  videos: 5,
5447
5497
  videoSeconds: { min: 3, max: 30.05, total: 30 },
5448
- videoPixels: { minWidth: 700, minHeight: 700 }
5498
+ videoPixels: { minWidth: 700, minHeight: 700 },
5499
+ videoFps: { min: 23.9, max: 60.05 }
5449
5500
  },
5450
5501
  supports: ["lastFrame"],
5451
5502
  prompt: KLING_V4_PROMPT,
@@ -5611,7 +5662,7 @@ var VIDEO_FAMILY_MODELS = [
5611
5662
  pricingKind: "video_per_second",
5612
5663
  display: {
5613
5664
  provider: "minimax",
5614
- logo: MINIMAX_LOGO3,
5665
+ logo: MINIMAX_LOGO4,
5615
5666
  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."
5616
5667
  },
5617
5668
  capabilities: {}
@@ -5641,7 +5692,7 @@ var VIDEO_FAMILY_MODELS = [
5641
5692
  pricingKind: "video_per_second",
5642
5693
  display: {
5643
5694
  provider: "minimax",
5644
- logo: MINIMAX_LOGO3,
5695
+ logo: MINIMAX_LOGO4,
5645
5696
  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."
5646
5697
  },
5647
5698
  capabilities: { acceptsSourceVideo: true, videoEdit: true }
@@ -5670,7 +5721,7 @@ var VIDEO_FAMILY_MODELS = [
5670
5721
  pricingKind: "video_per_second",
5671
5722
  display: {
5672
5723
  provider: "minimax",
5673
- logo: MINIMAX_LOGO3,
5724
+ logo: MINIMAX_LOGO4,
5674
5725
  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."
5675
5726
  },
5676
5727
  capabilities: { acceptsSourceVideo: true, videoEdit: true }
@@ -5701,7 +5752,7 @@ var VIDEO_FAMILY_MODELS = [
5701
5752
  pricingKind: "video_per_second",
5702
5753
  display: {
5703
5754
  provider: "minimax",
5704
- logo: MINIMAX_LOGO3,
5755
+ logo: MINIMAX_LOGO4,
5705
5756
  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."
5706
5757
  },
5707
5758
  capabilities: { acceptsSourceVideo: true, videoEdit: true }
@@ -6013,6 +6064,11 @@ var SEEDANCE_2_AUDIO = {
6013
6064
  audioFormats: ["wav", "mp3"],
6014
6065
  audioMaxBytes: 15 * 1024 * 1024
6015
6066
  };
6067
+ var SEEDANCE_REFERENCE_MEDIA = {
6068
+ videoPixels: { minPixels: 407696, maxPixels: 8295044 },
6069
+ videoFps: { min: 23.8, max: 60 },
6070
+ imagePixels: { minPixels: 9e4 }
6071
+ };
6016
6072
  var H3_PROMPT2 = { referenceSyntax: "numbered", maxChars: 5e4 };
6017
6073
  var WAN_PROMPT = { referenceSyntax: "numbered", maxChars: 2e4 };
6018
6074
  var OMNI_PROMPT = { referenceSyntax: "caption", maxChars: 5e4 };
@@ -6257,6 +6313,7 @@ var VIDEO_MODELS = [
6257
6313
  audios: 3,
6258
6314
  audioOnly: false,
6259
6315
  videoSeconds: { min: 2, max: 15, total: 15 },
6316
+ ...SEEDANCE_REFERENCE_MEDIA,
6260
6317
  ...SEEDANCE_2_AUDIO
6261
6318
  },
6262
6319
  sourceVideoSeconds: { min: 2, max: 15, inReferenceTotal: true },
@@ -6300,6 +6357,7 @@ var VIDEO_MODELS = [
6300
6357
  audios: 3,
6301
6358
  audioOnly: false,
6302
6359
  videoSeconds: { min: 2, max: 15, total: 15 },
6360
+ ...SEEDANCE_REFERENCE_MEDIA,
6303
6361
  ...SEEDANCE_2_AUDIO
6304
6362
  },
6305
6363
  sourceVideoSeconds: { min: 2, max: 15, inReferenceTotal: true },
@@ -6343,6 +6401,7 @@ var VIDEO_MODELS = [
6343
6401
  videos: 10,
6344
6402
  audios: 10,
6345
6403
  videoSeconds: { min: 2, max: 30, total: 30, editMin: 4 },
6404
+ ...SEEDANCE_REFERENCE_MEDIA,
6346
6405
  // BytePlus: 2-30 s per clip, 30 s in all, wav/mp3, 15 MB each.
6347
6406
  audioSeconds: { min: 2, max: 30, total: 30 },
6348
6407
  audioFormats: ["wav", "mp3"],
@@ -8161,7 +8220,14 @@ var VideoSecondsLimitsSchema = import_zod3.z.looseObject({
8161
8220
  });
8162
8221
  var VideoPixelLimitsSchema = import_zod3.z.looseObject({
8163
8222
  minWidth: import_zod3.z.number().int().positive().optional(),
8164
- minHeight: import_zod3.z.number().int().positive().optional()
8223
+ minHeight: import_zod3.z.number().int().positive().optional(),
8224
+ minPixels: import_zod3.z.number().int().positive().optional(),
8225
+ maxPixels: import_zod3.z.number().int().positive().optional(),
8226
+ maxSide: import_zod3.z.number().int().positive().optional()
8227
+ });
8228
+ var VideoFpsLimitsSchema = import_zod3.z.looseObject({
8229
+ min: import_zod3.z.number().positive().optional(),
8230
+ max: import_zod3.z.number().positive().optional()
8165
8231
  });
8166
8232
  var ReferenceLimitsSchema = import_zod3.z.looseObject({
8167
8233
  images: import_zod3.z.number().optional(),
@@ -8172,6 +8238,13 @@ var ReferenceLimitsSchema = import_zod3.z.looseObject({
8172
8238
  audioOnly: import_zod3.z.boolean().optional(),
8173
8239
  videoSeconds: VideoSecondsLimitsSchema.optional(),
8174
8240
  videoPixels: VideoPixelLimitsSchema.optional(),
8241
+ videoFps: VideoFpsLimitsSchema.optional(),
8242
+ videoMaxBytes: import_zod3.z.number().positive().optional(),
8243
+ imagePixels: VideoPixelLimitsSchema.optional(),
8244
+ imageAspect: import_zod3.z.looseObject({
8245
+ min: import_zod3.z.number().positive().optional(),
8246
+ max: import_zod3.z.number().positive().optional()
8247
+ }).optional(),
8175
8248
  audioSeconds: import_zod3.z.looseObject({
8176
8249
  min: import_zod3.z.number().optional(),
8177
8250
  max: import_zod3.z.number().optional(),
@@ -10489,6 +10562,27 @@ var QWEN_EXACT = {
10489
10562
  maxArea: 2048 * 2048,
10490
10563
  multipleOf: 1
10491
10564
  };
10565
+ var MINIMAX_H3_IMAGE_EXACT = {
10566
+ minSide: 1,
10567
+ maxSide: 14142,
10568
+ minArea: 655360,
10569
+ maxArea: 4096 * 4096,
10570
+ multipleOf: 1,
10571
+ maxAspect: 3,
10572
+ topTier: "4K"
10573
+ };
10574
+ function minimaxH3ImageSpec(label) {
10575
+ return {
10576
+ label,
10577
+ maxReferences: 16,
10578
+ maxCount: 10,
10579
+ outputFormats: ALL_FORMATS,
10580
+ promptMax: 32e3,
10581
+ promptRequired: true,
10582
+ aspectRatios: WIDE_RATIOS,
10583
+ exactSize: MINIMAX_H3_IMAGE_EXACT
10584
+ };
10585
+ }
10492
10586
  var FAL_IMAGE_SPECS = /* @__PURE__ */ new Map([
10493
10587
  [
10494
10588
  "krea/v3/text-to-image",
@@ -10530,6 +10624,8 @@ var FAL_IMAGE_SPECS = /* @__PURE__ */ new Map([
10530
10624
  exactSize: QWEN_EXACT
10531
10625
  }
10532
10626
  ],
10627
+ ["minimax/h3-image/text-to-image", minimaxH3ImageSpec("MiniMax H3 Image")],
10628
+ ["minimax/h3-image/highspeed/text-to-image", minimaxH3ImageSpec("MiniMax H3 Image Highspeed")],
10533
10629
  [
10534
10630
  "fal-ai/kling-image/o3/text-to-image",
10535
10631
  {
@@ -10593,6 +10689,7 @@ function falImageSpec(providerModelId) {
10593
10689
  return FAL_IMAGE_SPECS.get(providerModelId.toLowerCase());
10594
10690
  }
10595
10691
  var AREA_1K = 1024 * 1024;
10692
+ var AREA_2K = 2048 * 2048;
10596
10693
  function checkExactSize(exact, b) {
10597
10694
  const match = /^(\d+)x(\d+)$/.exec(exact);
10598
10695
  if (match === null) {
@@ -10604,14 +10701,21 @@ function checkExactSize(exact, b) {
10604
10701
  const sideOk = [width, height].every(
10605
10702
  (side) => side >= b.minSide && side <= b.maxSide && side % b.multipleOf === 0
10606
10703
  );
10607
- if (!sideOk || area < b.minArea || area > b.maxArea) {
10704
+ const aspectOk = b.maxAspect === void 0 || Math.max(width, height) <= b.maxAspect * Math.min(width, height);
10705
+ if (!sideOk || !aspectOk || area < b.minArea || area > b.maxArea) {
10608
10706
  const step = b.multipleOf > 1 ? `, multiples of ${b.multipleOf}` : "";
10707
+ const aspectLimit = b.maxAspect === void 0 ? "" : `, at most ${b.maxAspect}:1,`;
10609
10708
  return {
10610
10709
  ok: false,
10611
- 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}`
10710
+ 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}`
10612
10711
  };
10613
10712
  }
10614
- return { ok: true, size: { width, height, tier: area <= AREA_1K ? "1K" : "2K" } };
10713
+ return { ok: true, size: { width, height, tier: exactTier(area, b) } };
10714
+ }
10715
+ function exactTier(area, b) {
10716
+ if (area <= AREA_1K) return "1K";
10717
+ if (b.topTier === void 0 || area <= AREA_2K) return "2K";
10718
+ return b.topTier;
10615
10719
  }
10616
10720
  function unsupported(message) {
10617
10721
  return { code: "unsupported_option", message };
@@ -10817,17 +10921,17 @@ function pick(model, label, field, value, table) {
10817
10921
  }
10818
10922
  return mapped;
10819
10923
  }
10820
- function familyImageSize(model, call) {
10821
- if (call.exact === void 0) return { dims: sizedDimensions(model, call) };
10924
+ function familyImageSize(model, call, areas = TIER_AREAS) {
10925
+ if (call.exact === void 0) return { dims: sizedDimensions(model, call, areas) };
10822
10926
  const { width, height, tier } = call.exact;
10823
10927
  return { dims: { width, height }, imageSize: tier };
10824
10928
  }
10825
- function sizedDimensions(model, { label, req }) {
10929
+ function sizedDimensions(model, { label, req }, areas) {
10826
10930
  const aspectRatio = req.aspectRatio ?? "1:1";
10827
10931
  const size = req.size ?? "1K";
10828
- pick(model, label, "size", size, TIER_AREAS);
10932
+ pick(model, label, "size", size, areas);
10829
10933
  const dims = dimensionsFor(
10830
- { field: "image_size", areas: { ...TIER_AREAS }, multipleOf: 16 },
10934
+ { field: "image_size", areas: { ...areas }, multipleOf: 16 },
10831
10935
  { prompt: req.prompt, aspectRatio, size }
10832
10936
  );
10833
10937
  if (dims === void 0) throw fail2(model, `${label} has no size for ${aspectRatio}`);
@@ -10840,8 +10944,8 @@ function withCommon(input, req, opts) {
10840
10944
  return input;
10841
10945
  }
10842
10946
  var AREA_1K2 = 1024 * 1024;
10843
- var AREA_2K = 2048 * 2048;
10844
- var TIER_AREAS = { "1K": AREA_1K2, "2K": AREA_2K };
10947
+ var AREA_2K2 = 2048 * 2048;
10948
+ var TIER_AREAS = { "1K": AREA_1K2, "2K": AREA_2K2 };
10845
10949
  var KREA = {
10846
10950
  editEndpoint: "krea/v3/edit",
10847
10951
  build(call, model) {
@@ -10899,6 +11003,24 @@ var QWEN = {
10899
11003
  };
10900
11004
  }
10901
11005
  };
11006
+ function minimaxH3Image(editEndpoint) {
11007
+ return {
11008
+ editEndpoint,
11009
+ build(call, model) {
11010
+ const { req, refs } = call;
11011
+ const size = familyImageSize(model, call, H3_IMAGE_AREAS);
11012
+ const input = { prompt: req.prompt, image_size: { ...size.dims } };
11013
+ if (refs.length > 0) input["image_urls"] = refs;
11014
+ return {
11015
+ input: withCommon(input, req, { count: true, seed: false }),
11016
+ ...size.imageSize !== void 0 && { imageSize: size.imageSize }
11017
+ };
11018
+ }
11019
+ };
11020
+ }
11021
+ var H3_IMAGE_AREAS = { ...TIER_AREAS, "4K": 4096 * 4096 };
11022
+ var MINIMAX_H3_IMAGE = minimaxH3Image("minimax/h3-image/edit");
11023
+ var MINIMAX_H3_IMAGE_HIGHSPEED = minimaxH3Image("minimax/h3-image/highspeed/edit");
10902
11024
  function klingImage(editEndpoint, sizes, field) {
10903
11025
  return {
10904
11026
  editEndpoint,
@@ -10980,6 +11102,8 @@ var FAMILIES = /* @__PURE__ */ new Map([
10980
11102
  ["krea/v3/text-to-image", KREA],
10981
11103
  ["xai/grok-imagine-image/v2.0/text-to-image", GROK],
10982
11104
  ["alibaba/qwen-image-3/text-to-image", QWEN],
11105
+ ["minimax/h3-image/text-to-image", MINIMAX_H3_IMAGE],
11106
+ ["minimax/h3-image/highspeed/text-to-image", MINIMAX_H3_IMAGE_HIGHSPEED],
10983
11107
  ["fal-ai/kling-image/o3/text-to-image", KLING_O3],
10984
11108
  ["fal-ai/kling-image/v3/text-to-image", KLING_V3],
10985
11109
  ["recraft/v4.1/flash/text-to-image", RECRAFT_FLASH],
@@ -15851,8 +15975,8 @@ function checkGenerateSeconds(req, ctx) {
15851
15975
  }
15852
15976
  var MAX_PLAUSIBLE_SECONDS = 60;
15853
15977
  function editedSeconds(req, bytes) {
15854
- const measured = mp4DurationSeconds(bytes);
15855
- const length = measured !== void 0 && measured > 0 && measured <= MAX_PLAUSIBLE_SECONDS ? measured : req.sourceVideo?.durationSeconds;
15978
+ const measured2 = mp4DurationSeconds(bytes);
15979
+ const length = measured2 !== void 0 && measured2 > 0 && measured2 <= MAX_PLAUSIBLE_SECONDS ? measured2 : req.sourceVideo?.durationSeconds;
15856
15980
  return Math.max(length ?? 0, GENERATE_SECONDS);
15857
15981
  }
15858
15982
  function videoUsage4(ctx, req, mode, seconds3) {
@@ -16222,15 +16346,6 @@ var openaiImageAdapter = {
16222
16346
  });
16223
16347
  outputFormat = "png";
16224
16348
  }
16225
- if (isEdit && outputFormat === "svg") {
16226
- throw new ModelKitError({
16227
- code: "unsupported_option",
16228
- message: `${ctx.model.id} cannot make an SVG from reference images`,
16229
- provider: "openai-image",
16230
- model: ctx.model.id,
16231
- retryable: false
16232
- });
16233
- }
16234
16349
  const svgModel = ctx.model.constraints.svgModel;
16235
16350
  if (outputFormat === "svg" && !svgModel) {
16236
16351
  throw new ModelKitError({
@@ -18006,9 +18121,6 @@ function applyImageOutputRules(model, req, onUnsupported, warnings) {
18006
18121
  }
18007
18122
  if (req.outputFormat === "svg") {
18008
18123
  if (!c.svgModel) refuse(model, `${model.id} names no svgModel to write the SVG`);
18009
- if ((req.references ?? []).length > 0) {
18010
- refuse(model, `${model.label} cannot make an SVG from reference images`);
18011
- }
18012
18124
  if ((req.count ?? 1) > 1) {
18013
18125
  if (onUnsupported === "error") {
18014
18126
  refuse(model, `${model.label} makes one SVG per call`);
@@ -18980,6 +19092,126 @@ function resolveVoiceDesignOptions(model, request, onUnsupported = "error") {
18980
19092
  return { request: resolved, warnings };
18981
19093
  }
18982
19094
 
19095
+ // src/reference-video-conform.ts
19096
+ var REFERENCE_VIDEO_CONFORM_PROFILE = "model-safe-v1";
19097
+ var SHRINK_MARGIN = 0.998;
19098
+ var GROW_MARGIN = 1.002;
19099
+ var LOW_FPS_TARGET = 24;
19100
+ var HIGH_FPS_TARGET = 30;
19101
+ function measured(value) {
19102
+ return value !== void 0 && Number.isFinite(value) && value > 0;
19103
+ }
19104
+ function evenDown(value) {
19105
+ return Math.max(2, Math.floor(value / 2) * 2);
19106
+ }
19107
+ function evenUp(value) {
19108
+ return Math.max(2, Math.ceil(value / 2) * 2);
19109
+ }
19110
+ function sizeFix(limits, width, height) {
19111
+ if (!limits) return null;
19112
+ const pixels = width * height;
19113
+ const long = Math.max(width, height);
19114
+ const shrink = [];
19115
+ const grow = [];
19116
+ const reasons = [];
19117
+ if (limits.maxPixels !== void 0 && pixels > limits.maxPixels) {
19118
+ shrink.push(Math.sqrt(limits.maxPixels / pixels) * SHRINK_MARGIN);
19119
+ reasons.push("pixels_over");
19120
+ }
19121
+ if (limits.maxSide !== void 0 && long > limits.maxSide) {
19122
+ shrink.push(limits.maxSide / long * SHRINK_MARGIN);
19123
+ reasons.push("side_over");
19124
+ }
19125
+ if (shrink.length > 0) return { scale: Math.min(...shrink), up: false, reasons };
19126
+ if (limits.minPixels !== void 0 && pixels < limits.minPixels) {
19127
+ grow.push(Math.sqrt(limits.minPixels / pixels) * GROW_MARGIN);
19128
+ reasons.push("pixels_under");
19129
+ }
19130
+ const sideUnder = [
19131
+ limits.minWidth !== void 0 && width < limits.minWidth ? limits.minWidth / width * GROW_MARGIN : 0,
19132
+ limits.minHeight !== void 0 && height < limits.minHeight ? limits.minHeight / height * GROW_MARGIN : 0
19133
+ ].filter((scale) => scale > 0);
19134
+ if (sideUnder.length > 0) {
19135
+ grow.push(...sideUnder);
19136
+ reasons.push("side_under");
19137
+ }
19138
+ if (grow.length > 0) return { scale: Math.max(...grow), up: true, reasons };
19139
+ return null;
19140
+ }
19141
+ function fpsFix(model, fps) {
19142
+ const limits = model.constraints.references?.videoFps;
19143
+ if (!limits || !measured(fps)) return void 0;
19144
+ const inRange = (rate) => (limits.min === void 0 || rate >= limits.min) && (limits.max === void 0 || rate <= limits.max);
19145
+ if (limits.min !== void 0 && fps < limits.min) {
19146
+ const target = inRange(LOW_FPS_TARGET) ? LOW_FPS_TARGET : Math.ceil(limits.min);
19147
+ return { fps: target, reason: "fps_under" };
19148
+ }
19149
+ if (limits.max !== void 0 && fps > limits.max) {
19150
+ const target = inRange(HIGH_FPS_TARGET) ? HIGH_FPS_TARGET : Math.floor(limits.max);
19151
+ return { fps: target, reason: "fps_over" };
19152
+ }
19153
+ return void 0;
19154
+ }
19155
+ function referenceVideoConformPlan(model, probe) {
19156
+ const rate = fpsFix(model, probe.fps);
19157
+ const maxBytes = model.constraints.references?.videoMaxBytes;
19158
+ const overBytes = maxBytes !== void 0 && measured(probe.bytes) && probe.bytes > maxBytes;
19159
+ const { width: probedWidth, height: probedHeight } = probe;
19160
+ if (!measured(probedWidth) || !measured(probedHeight)) return null;
19161
+ const width = Math.round(probedWidth);
19162
+ const height = Math.round(probedHeight);
19163
+ const size = sizeFix(model.constraints.references?.videoPixels, width, height);
19164
+ if (!size && !rate && !overBytes) return null;
19165
+ const round = size?.up ? evenUp : evenDown;
19166
+ const scale = size?.scale ?? 1;
19167
+ const reasons = [...size?.reasons ?? []];
19168
+ if (rate) reasons.push(rate.reason);
19169
+ if (overBytes) reasons.push("bytes_over");
19170
+ const plan4 = {
19171
+ width: round(width * scale),
19172
+ height: round(height * scale),
19173
+ reasons
19174
+ };
19175
+ if (rate) plan4.fps = rate.fps;
19176
+ if (maxBytes !== void 0) plan4.maxBytes = maxBytes;
19177
+ return plan4;
19178
+ }
19179
+ function referenceImageConformPlan(model, probe) {
19180
+ const { width: probedWidth, height: probedHeight } = probe;
19181
+ if (!measured(probedWidth) || !measured(probedHeight)) return null;
19182
+ const references = model.constraints.references;
19183
+ const width = Math.round(probedWidth);
19184
+ const height = Math.round(probedHeight);
19185
+ const reasons = [];
19186
+ let frameWidth = width;
19187
+ let frameHeight = height;
19188
+ const aspect = references?.imageAspect;
19189
+ if (aspect?.min !== void 0 && width / height < aspect.min) {
19190
+ frameWidth = Math.ceil(height * aspect.min);
19191
+ reasons.push("aspect");
19192
+ } else if (aspect?.max !== void 0 && width / height > aspect.max) {
19193
+ frameHeight = Math.ceil(width / aspect.max);
19194
+ reasons.push("aspect");
19195
+ }
19196
+ const size = sizeFix(references?.imagePixels, frameWidth, frameHeight);
19197
+ if (!size && reasons.length === 0) return null;
19198
+ if (size) reasons.push(...size.reasons);
19199
+ const scale = size?.scale ?? 1;
19200
+ const round = size?.up ? Math.ceil : Math.floor;
19201
+ const frame = {
19202
+ width: Math.max(1, round(frameWidth * scale)),
19203
+ height: Math.max(1, round(frameHeight * scale))
19204
+ };
19205
+ const image = frameWidth > width ? {
19206
+ width: Math.max(1, Math.round(frame.height * width / height)),
19207
+ height: frame.height
19208
+ } : frameHeight > height ? {
19209
+ width: frame.width,
19210
+ height: Math.max(1, Math.round(frame.width * height / width))
19211
+ } : { ...frame };
19212
+ return { ...frame, image, reasons };
19213
+ }
19214
+
18983
19215
  // src/keys.ts
18984
19216
  var ADAPTER_KEYS = {
18985
19217
  "ai-sdk-text": [],
@@ -20463,6 +20695,7 @@ var describe = (modelId) => createDefaultModelKit().describe(modelId);
20463
20695
  MODEL3D_MODELS,
20464
20696
  MODELS,
20465
20697
  ModelKitError,
20698
+ REFERENCE_VIDEO_CONFORM_PROFILE,
20466
20699
  SURFACES,
20467
20700
  SurfaceSchema,
20468
20701
  VIDEO_INPUT_SPEC_KEYS,
@@ -20530,6 +20763,8 @@ var describe = (modelId) => createDefaultModelKit().describe(modelId);
20530
20763
  primeCatalog,
20531
20764
  prodiaAdapter,
20532
20765
  readErrorBody,
20766
+ referenceImageConformPlan,
20767
+ referenceVideoConformPlan,
20533
20768
  replicateAdapter,
20534
20769
  resetLiveCatalog,
20535
20770
  resolutionTier,