@shop-os/modelkit 0.14.0 → 0.15.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/dist/index.cjs CHANGED
@@ -136,6 +136,7 @@ __export(index_exports, {
136
136
  toGeneratedImage: () => toGeneratedImage,
137
137
  validateInputSpec: () => validateInputSpec,
138
138
  videoLengthViolation: () => videoLengthViolation,
139
+ videoSizeViolation: () => videoSizeViolation,
139
140
  videoToolConstraints: () => videoToolConstraints,
140
141
  withRetry: () => withRetry,
141
142
  xaiVideoAdapter: () => xaiVideoAdapter
@@ -703,7 +704,7 @@ var IMAGE_MODELS = [
703
704
  // Cowork "auto" lets OpenAI pick the size; the canonical equivalent is adaptive.
704
705
  id: "gpt-image-2",
705
706
  aliases: [],
706
- label: "GPT-image-2",
707
+ label: "GPT Image 2",
707
708
  type: "image",
708
709
  adapter: "openai-image",
709
710
  providerModelId: "gpt-image-2",
@@ -890,7 +891,7 @@ var IMAGE_MODELS = [
890
891
  display: {
891
892
  provider: "bytedance",
892
893
  logo: "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/3bba5d81-4e57-4e71-911b-cdfa05acca2c_compressed.png",
893
- description: "ByteDance Seedream 5.0 Pro text-to-image and multi-reference image-to-image (up to 10 inputs) with region editing; outputs 1K, 1.5K, or 2K."
894
+ 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."
894
895
  }
895
896
  },
896
897
  {
@@ -933,7 +934,7 @@ var IMAGE_MODELS = [
933
934
  {
934
935
  id: "flux-2-pro",
935
936
  aliases: [],
936
- label: "Flux 2 Pro",
937
+ label: "FLUX 2 Pro",
937
938
  type: "image",
938
939
  adapter: "prodia",
939
940
  providerModelId: "flux-2-pro",
@@ -954,7 +955,7 @@ var IMAGE_MODELS = [
954
955
  display: {
955
956
  provider: "black-forest-labs",
956
957
  logo: "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/flux.png",
957
- description: "Black Forest Labs FLUX.2 [pro] text-to-image and multi-reference editing model served via Prodia; takes a prompt and up to 8 input images and outputs up to 4096x4096."
958
+ description: "Black Forest Labs FLUX.2 [pro] text-to-image and multi-reference editing model; takes a prompt and up to 8 input images and outputs 1K images."
958
959
  }
959
960
  },
960
961
  {
@@ -1014,7 +1015,7 @@ var IMAGE_MODELS = [
1014
1015
  // https://replicate.com/wan-video/wan-2.7-image-pro (input schema)
1015
1016
  id: "wan-2.7-image-pro",
1016
1017
  aliases: [],
1017
- label: "WAN 2.7 Image Pro",
1018
+ label: "Wan 2.7 Image Pro",
1018
1019
  type: "image",
1019
1020
  adapter: "replicate",
1020
1021
  providerModelId: "wan-video/wan-2.7-image-pro",
@@ -1338,7 +1339,7 @@ var SAM_3_IMAGE = {
1338
1339
  display: {
1339
1340
  provider: "meta",
1340
1341
  logo: META_LOGO,
1341
- description: "Meta SAM 3 on fal; finds every object a prompt names in one image and returns a black-and-white mask for each."
1342
+ description: "Meta SAM 3; finds every object a prompt names in one image and returns a black-and-white mask for each."
1342
1343
  }
1343
1344
  };
1344
1345
  var VEED_SUBTITLES = {
@@ -2180,7 +2181,7 @@ var FISH_MODELS = [
2180
2181
  "fish-s2.1-pro-free",
2181
2182
  "Fish Audio S2.1 Pro Free",
2182
2183
  "s2.1-pro-free",
2183
- "Fish Audio S2.1 Pro on the free developer tier: the same voices at no cost, without latency or data-processing guarantees."
2184
+ "Fish Audio S2.1 Pro text to speech, with the same voices as S2.1 Pro."
2184
2185
  ),
2185
2186
  fishTts(
2186
2187
  "fish-drama-3",
@@ -3918,7 +3919,7 @@ var MEDIA_NODE_MODELS = [
3918
3919
  formats: false,
3919
3920
  // fal's schema states no limit; ElevenLabs documents 10,000 characters per request.
3920
3921
  maxChars: 1e4,
3921
- description: "ElevenLabs Multilingual v2 text to speech in 29 languages; the voice the canvas TTS node has always used."
3922
+ description: "ElevenLabs Multilingual v2 text to speech in 29 languages."
3922
3923
  }),
3923
3924
  geminiTts(
3924
3925
  "gemini-3.8-flash-tts",
@@ -4014,7 +4015,7 @@ var MEDIA_NODE_MODELS = [
4014
4015
  "Sync Lipsync 2",
4015
4016
  "fal-ai/sync-lipsync/v2",
4016
4017
  "lipsync-2",
4017
- "Sync Lipsync 2 re-times the mouth in a video to new speech; the canvas Lipsync node's original model."
4018
+ "Sync Lipsync 2 re-times the mouth in a video to new speech."
4018
4019
  ),
4019
4020
  syncLipsync(
4020
4021
  "lipsync-2-pro",
@@ -4052,7 +4053,7 @@ var MEDIA_NODE_MODELS = [
4052
4053
  display: {
4053
4054
  provider: "veed",
4054
4055
  logo: "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/d540d2bb-0022-4371-8889-48aefaf46bbe.png",
4055
- description: "VEED Lipsync v2 re-times the mouth in a video to a new audio track; billed per second of output."
4056
+ description: "VEED Lipsync v2 re-times the mouth in a video to a new audio track."
4056
4057
  },
4057
4058
  capabilities: { acceptsSourceVideo: true }
4058
4059
  },
@@ -4397,7 +4398,7 @@ var OTHER_MODELS = [
4397
4398
  pricingKind: "flat",
4398
4399
  display: {
4399
4400
  provider: "mmaudio",
4400
- description: "MMAudio V2 video-to-audio model on Replicate; takes a source video and prompt and synthesizes synchronized environmental, action, and speech-like audio."
4401
+ description: "MMAudio V2 video-to-audio model; takes a source video and a prompt and synthesizes synchronized environmental, action, and speech-like audio."
4401
4402
  },
4402
4403
  capabilities: {}
4403
4404
  },
@@ -4607,7 +4608,7 @@ var OTHER_MODELS = [
4607
4608
  display: {
4608
4609
  provider: "topaz",
4609
4610
  logo: "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/topazlabs.png",
4610
- description: "Topaz Labs AI image upscaling on Replicate; takes one input image and upscales up to 6x with selectable enhancement models and optional face enhancement."
4611
+ description: "Topaz Labs AI image upscaling; takes one input image and upscales up to 6x with selectable enhancement models and optional face enhancement."
4611
4612
  }
4612
4613
  },
4613
4614
  {
@@ -4633,7 +4634,7 @@ var OTHER_MODELS = [
4633
4634
  display: {
4634
4635
  provider: "bytedance",
4635
4636
  logo: "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/3bba5d81-4e57-4e71-911b-cdfa05acca2c_compressed.png",
4636
- description: "ByteDance SeedVR2 one-step image upscaling and restoration on fal; takes one input image and upscales it 2x or 4x with sharp, faithful detail."
4637
+ description: "ByteDance SeedVR2 one-step image upscaling and restoration; takes one input image and upscales it 2x or 4x with sharp, faithful detail."
4637
4638
  }
4638
4639
  },
4639
4640
  {
@@ -4657,7 +4658,7 @@ var OTHER_MODELS = [
4657
4658
  pricingKind: "flat",
4658
4659
  display: {
4659
4660
  provider: "prodia",
4660
- description: "Prodia background removal; takes one input image and returns a PNG cut-out of the subject plus an optional black-and-white mask."
4661
+ description: "Background removal; takes one input image and returns a PNG cut-out of the subject plus an optional black-and-white mask."
4661
4662
  }
4662
4663
  }
4663
4664
  ];
@@ -5235,6 +5236,7 @@ function klingMotionControl(tier) {
5235
5236
  videos: 1,
5236
5237
  audios: 0,
5237
5238
  videoSeconds: { min: 3, max: 30.05 },
5239
+ videoPixels: { minWidth: 340, minHeight: 340 },
5238
5240
  min: { images: 1, videos: 1 }
5239
5241
  },
5240
5242
  requires: ["references"],
@@ -5301,6 +5303,7 @@ var VIDEO_FAMILY_MODELS = [
5301
5303
  references: { ...NO_REFERENCES, images: 4 },
5302
5304
  requires: ["sourceVideo"],
5303
5305
  sourceVideoSeconds: { min: 3, max: 15.05 },
5306
+ sourceVideoPixels: { minWidth: 720, minHeight: 720 },
5304
5307
  // generateAudio keeps (true) or drops (false) the source soundtrack.
5305
5308
  supports: ["generateAudio"],
5306
5309
  prompt: KLING_PROMPT,
@@ -5341,7 +5344,8 @@ var VIDEO_FAMILY_MODELS = [
5341
5344
  ...NO_REFERENCES,
5342
5345
  images: 10,
5343
5346
  videos: 5,
5344
- videoSeconds: { min: 3, max: 30.05, total: 30 }
5347
+ videoSeconds: { min: 3, max: 30.05, total: 30 },
5348
+ videoPixels: { minWidth: 700, minHeight: 700 }
5345
5349
  },
5346
5350
  supports: ["lastFrame"],
5347
5351
  prompt: KLING_V4_PROMPT,
@@ -5353,7 +5357,7 @@ var VIDEO_FAMILY_MODELS = [
5353
5357
  display: {
5354
5358
  provider: "kuaishou",
5355
5359
  logo: KLING_LOGO,
5356
- description: "Kuaishou Kling 4.0: text-to-video, start/end frames, or reference-to-video from up to 10 images and 5 videos (30 seconds combined), 3-30 seconds at 720p or 1080p. Prompts name references @Image1, @Video1."
5360
+ description: "Kuaishou Kling 4.0: text-to-video, start/end frames, or reference-to-video from up to 10 images and 5 videos (30 seconds combined), up to 30 seconds at 720p or 1080p. Prompts name references @Image1, @Video1."
5357
5361
  },
5358
5362
  capabilities: { lastFrameRequiresFirstFrame: true }
5359
5363
  },
@@ -5375,6 +5379,7 @@ var VIDEO_FAMILY_MODELS = [
5375
5379
  references: { ...NO_REFERENCES, images: 10 },
5376
5380
  requires: ["sourceVideo"],
5377
5381
  sourceVideoSeconds: { min: 3, max: 30.05 },
5382
+ sourceVideoPixels: { minWidth: 700, minHeight: 700 },
5378
5383
  supports: [],
5379
5384
  prompt: KLING_V4_PROMPT,
5380
5385
  audio: KLING_V4_AUDIO
@@ -5697,7 +5702,7 @@ var VIDEO_FAMILY_MODELS = [
5697
5702
  display: {
5698
5703
  provider: "xai",
5699
5704
  logo: XAI_LOGO,
5700
- 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, 1-15 seconds."
5705
+ 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."
5701
5706
  },
5702
5707
  capabilities: {}
5703
5708
  }
@@ -6054,7 +6059,7 @@ var VIDEO_MODELS = [
6054
6059
  pricingKind: "video_per_second",
6055
6060
  display: {
6056
6061
  provider: "bytedance",
6057
- description: "High-quality AI video generation with reference image conditioning. Supports 4-15 second clips with human preprocessing.",
6062
+ description: "High-quality ByteDance video generation guided by reference images, for clips up to 15 seconds.",
6058
6063
  logo: BYTEDANCE_LOGO2
6059
6064
  },
6060
6065
  capabilities: { acceptsSourceVideo: true, videoEdit: false, ...FRAMES_EXCLUDE_REFERENCES }
@@ -6178,7 +6183,7 @@ var VIDEO_MODELS = [
6178
6183
  pricingKind: "video_per_second",
6179
6184
  display: {
6180
6185
  provider: "xai",
6181
- description: "xAI's reference-to-video model. Generates short clips conditioned on up to 5 reference images with flexible aspect ratios.",
6186
+ description: "xAI's reference-to-video model. Generates short clips conditioned on up to 7 reference images with flexible aspect ratios.",
6182
6187
  logo: "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/858b7fcc-9bd5-411d-aea1-a7b35ecfffab_compressed.png"
6183
6188
  },
6184
6189
  capabilities: { ...FRAMES_EXCLUDE_REFERENCES }
@@ -6262,7 +6267,7 @@ var VIDEO_MODELS = [
6262
6267
  exposure: ["cowork", "space_builder"],
6263
6268
  constraints: {
6264
6269
  aspectRatios: [...KLING_OMNI_RATIOS],
6265
- resolutions: ["720p", "1080p", "4k"],
6270
+ resolutions: ["720p", "1080p"],
6266
6271
  durations: { min: 3, max: 15 },
6267
6272
  references: { images: 7, videos: 0, audios: 0 },
6268
6273
  supports: ["generateAudio", "lastFrame"],
@@ -6275,7 +6280,7 @@ var VIDEO_MODELS = [
6275
6280
  display: {
6276
6281
  provider: "kuaishou",
6277
6282
  logo: "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/kling-color.png",
6278
- description: "Kuaishou Kling Video 3.0 Omni generation from text, start/end images and up to 7 reference images, with optional native audio; up to 15 seconds at up to 4K."
6283
+ description: "Kuaishou Kling Video 3.0 Omni generation from text, start/end images and up to 7 reference images, with optional native audio; up to 15 seconds at up to 1080p."
6279
6284
  }
6280
6285
  // No lastFrameRequiresFirstFrame: fal image-to-video needs a start frame, so the adapter
6281
6286
  // sends a lone end frame as the start frame, as the Replicate model took it.
@@ -6310,7 +6315,7 @@ var VIDEO_MODELS = [
6310
6315
  display: {
6311
6316
  provider: "minimax",
6312
6317
  logo: "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png",
6313
- description: "MiniMax H3 multimodal video model for text-to-video, image-to-video (first/last frame), and reference-to-video with native audio, up to 2K."
6318
+ description: "MiniMax H3 multimodal video model for text-to-video, image-to-video (first/last frame), and reference-to-video with native audio, up to 4K."
6314
6319
  },
6315
6320
  capabilities: { ...FRAMES_EXCLUDE_REFERENCES }
6316
6321
  },
@@ -6430,7 +6435,7 @@ var VIDEO_MODELS = [
6430
6435
  display: {
6431
6436
  provider: "minimax",
6432
6437
  logo: "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png",
6433
- description: "MiniMax H3 Max reference-to-video on fal; conditions on reference images, videos, and audio. MiniMax's own docs do not list a reference mode for H3 Max."
6438
+ description: "MiniMax H3 Max reference-to-video; conditions on reference images, videos, and audio."
6434
6439
  },
6435
6440
  // fal's reference-to-video endpoint never reads a frame; the resolver must drop the
6436
6441
  // references instead of the adapter silently dropping the frame.
@@ -6474,7 +6479,7 @@ var VIDEO_MODELS = [
6474
6479
  pricingKind: "video_per_second",
6475
6480
  display: {
6476
6481
  provider: "alibaba",
6477
- description: "Alibaba Wan 3 video model for text-to-video, image-to-video (start/end frame), and reference-to-video from up to 10 images, 5 videos and 5 audio clips, with native audio; 2-30 seconds at up to 1080p."
6482
+ description: "Alibaba Wan 3 video model for text-to-video, image-to-video (start/end frame), and reference-to-video from up to 10 images, 5 videos and 5 audio clips, with native audio; up to 30 seconds at up to 1080p."
6478
6483
  },
6479
6484
  capabilities: { ...FRAMES_EXCLUDE_REFERENCES, lastFrameRequiresFirstFrame: true }
6480
6485
  },
@@ -6516,7 +6521,7 @@ var VIDEO_MODELS = [
6516
6521
  pricingKind: "video_per_second",
6517
6522
  display: {
6518
6523
  provider: "alibaba",
6519
- description: "Alibaba Wan 3 Prime, the faster-generating tier of Wan 3, for text-to-video, image-to-video (start/end frame), and reference-to-video from up to 10 images, 5 videos and 5 audio clips, with native audio; 2-30 seconds at up to 1080p."
6524
+ description: "Alibaba Wan 3 Prime, the faster-generating tier of Wan 3, for text-to-video, image-to-video (start/end frame), and reference-to-video from up to 10 images, 5 videos and 5 audio clips, with native audio; up to 30 seconds at up to 1080p."
6520
6525
  },
6521
6526
  capabilities: { ...FRAMES_EXCLUDE_REFERENCES, lastFrameRequiresFirstFrame: true }
6522
6527
  },
@@ -7919,6 +7924,10 @@ var VideoSecondsLimitsSchema = import_zod3.z.looseObject({
7919
7924
  total: import_zod3.z.number().optional(),
7920
7925
  editMin: import_zod3.z.number().optional()
7921
7926
  });
7927
+ var VideoPixelLimitsSchema = import_zod3.z.looseObject({
7928
+ minWidth: import_zod3.z.number().int().positive().optional(),
7929
+ minHeight: import_zod3.z.number().int().positive().optional()
7930
+ });
7922
7931
  var ReferenceLimitsSchema = import_zod3.z.looseObject({
7923
7932
  images: import_zod3.z.number().optional(),
7924
7933
  imagesWithVideo: import_zod3.z.number().optional(),
@@ -7927,6 +7936,7 @@ var ReferenceLimitsSchema = import_zod3.z.looseObject({
7927
7936
  total: import_zod3.z.number().optional(),
7928
7937
  audioOnly: import_zod3.z.boolean().optional(),
7929
7938
  videoSeconds: VideoSecondsLimitsSchema.optional(),
7939
+ videoPixels: VideoPixelLimitsSchema.optional(),
7930
7940
  audioSeconds: import_zod3.z.looseObject({
7931
7941
  min: import_zod3.z.number().optional(),
7932
7942
  max: import_zod3.z.number().optional(),
@@ -8016,6 +8026,7 @@ var ModelConstraintsSchema = import_zod3.z.looseObject({
8016
8026
  }).optional(),
8017
8027
  languages: import_zod3.z.array(LanguageOptionSchema).optional(),
8018
8028
  outputFormats: import_zod3.z.array(import_zod3.z.string().min(1)).min(1).optional(),
8029
+ sourceVideoPixels: VideoPixelLimitsSchema.optional(),
8019
8030
  sourceVideoSeconds: VideoSecondsLimitsSchema.omit({ total: true }).extend({ inReferenceTotal: import_zod3.z.boolean().optional() }).optional(),
8020
8031
  // segmentSeconds/maxTotalSeconds stay required: a kit before 0.3.0 drops a row whose
8021
8032
  // extension lacks them, so every extension block keeps them.
@@ -17756,6 +17767,28 @@ function videoLengthViolation(model, input) {
17756
17767
  return `${model.label} takes a source video of at least ${String(sourceMin)} s; this one is ${seconds2(source2, sourceMin)} s.`;
17757
17768
  return void 0;
17758
17769
  }
17770
+ function undersizedSide(frame, limits) {
17771
+ if (!frame || !limits) return void 0;
17772
+ const { width, height } = frame;
17773
+ if (limits.minWidth !== void 0 && width !== void 0 && width > 0 && width < limits.minWidth)
17774
+ return { side: "wide", min: limits.minWidth, actual: width };
17775
+ if (limits.minHeight !== void 0 && height !== void 0 && height > 0 && height < limits.minHeight)
17776
+ return { side: "tall", min: limits.minHeight, actual: height };
17777
+ return void 0;
17778
+ }
17779
+ function videoSizeViolation(model, input) {
17780
+ const refLimits = model.constraints.references?.videoPixels;
17781
+ const refs = input.referenceVideos ?? [];
17782
+ for (let i = 0; i < refs.length; i++) {
17783
+ const under2 = undersizedSide(refs[i], refLimits);
17784
+ if (under2)
17785
+ return `${model.label} takes reference videos at least ${String(under2.min)} px ${under2.side}; video ${i + 1} is ${String(under2.actual)} px.`;
17786
+ }
17787
+ const under = undersizedSide(input.sourceVideo, model.constraints.sourceVideoPixels);
17788
+ if (under)
17789
+ return `${model.label} takes a source video at least ${String(under.min)} px ${under.side}; this one is ${String(under.actual)} px.`;
17790
+ return void 0;
17791
+ }
17759
17792
  function resolveImageOptions(model, request, onUnsupported = "error") {
17760
17793
  const warnings = [];
17761
17794
  const c = model.constraints;
@@ -19869,6 +19902,7 @@ var describe = (modelId) => createDefaultModelKit().describe(modelId);
19869
19902
  toGeneratedImage,
19870
19903
  validateInputSpec,
19871
19904
  videoLengthViolation,
19905
+ videoSizeViolation,
19872
19906
  videoToolConstraints,
19873
19907
  withRetry,
19874
19908
  xaiVideoAdapter,