@shop-os/modelkit 0.26.0 → 0.27.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/catalog.js CHANGED
@@ -367,7 +367,8 @@ var FAL_IMAGE_MODELS = [
367
367
  constraints: {
368
368
  aspectRatios: [...KLING_RATIOS, "adaptive"],
369
369
  sizes: ["2K", "4K", "8K"],
370
- references: { images: 10 },
370
+ // fal refuses a reference under 300x300 (422 image_too_small, prod COWORK-5S).
371
+ references: { images: 10, imagePixels: { minWidth: 300, minHeight: 300 } },
371
372
  supports: ["count"],
372
373
  prompt: { referenceSyntax: "numbered", maxChars: 21e3 }
373
374
  },
@@ -5414,10 +5415,119 @@ var TEXT_MODELS = [
5414
5415
  })
5415
5416
  ];
5416
5417
 
5417
- // src/catalog/video-families.ts
5418
- var VIDEO_USAGE = { unit: "seconds" };
5418
+ // src/catalog/video-avatars.ts
5419
5419
  var MB = 1024 * 1024;
5420
5420
  var KLING_LOGO = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/kling-color.png";
5421
+ var VEED_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/d540d2bb-0022-4371-8889-48aefaf46bbe.png";
5422
+ var SYNC_LOGO2 = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/sync.png";
5423
+ var KIT_AUDIO_CAP_SECONDS = 300;
5424
+ function avatar(row2) {
5425
+ const { min, max, formats, maxBytes } = row2.audio;
5426
+ return {
5427
+ id: row2.id,
5428
+ aliases: row2.aliases,
5429
+ label: row2.label,
5430
+ type: "video",
5431
+ adapter: "fal",
5432
+ providerModelId: row2.providerModelId,
5433
+ lifecycle: "active",
5434
+ exposure: ["cowork", "space_builder"],
5435
+ constraints: {
5436
+ ...row2.resolutions !== void 0 && { resolutions: [...row2.resolutions] },
5437
+ references: {
5438
+ images: 1,
5439
+ videos: 0,
5440
+ audios: 1,
5441
+ audioOnly: false,
5442
+ audioSeconds: { ...min !== void 0 && { min }, max },
5443
+ audioFormats: formats,
5444
+ ...maxBytes !== void 0 && { audioMaxBytes: maxBytes },
5445
+ min: { images: 1, audios: 1 }
5446
+ },
5447
+ requires: ["references"],
5448
+ supports: [],
5449
+ ...row2.promptMaxChars === void 0 ? { noPrompt: true } : { prompt: { referenceSyntax: "descriptive", maxChars: row2.promptMaxChars } },
5450
+ audio: "always"
5451
+ },
5452
+ defaults: row2.resolutions === void 0 ? {} : { resolution: row2.resolutions[0] },
5453
+ usage: { unit: "seconds" },
5454
+ pricingKind: "video_per_second",
5455
+ display: {
5456
+ provider: row2.provider,
5457
+ ...row2.logo !== void 0 && { logo: row2.logo },
5458
+ description: row2.description
5459
+ },
5460
+ capabilities: {}
5461
+ };
5462
+ }
5463
+ function heygenAvatar6(tier) {
5464
+ const turbo = tier === "turbo";
5465
+ return avatar({
5466
+ id: turbo ? "heygen-avatar-6-turbo" : "heygen-avatar-6",
5467
+ aliases: [],
5468
+ label: turbo ? "HeyGen Avatar 6 Turbo" : "HeyGen Avatar 6",
5469
+ providerModelId: turbo ? "heygen/avatar-6/turbo/image-to-video" : "heygen/avatar-6/image-to-video",
5470
+ provider: "heygen",
5471
+ description: turbo ? "HeyGen Avatar 6 Turbo: the lower-cost tier; turns one photo of a person and a speech clip of up to 5 minutes into a talking video as long as the speech, at 1080p or 2K, with an optional motion prompt." : "HeyGen Avatar 6: turns one photo of a person and a speech clip of up to 5 minutes into a talking video as long as the speech, at 1080p or 2K, with an optional motion prompt.",
5472
+ audio: { max: KIT_AUDIO_CAP_SECONDS, formats: ["wav", "mp3"], maxBytes: 50 * MB },
5473
+ resolutions: ["1080p", "2k"],
5474
+ promptMaxChars: 1200
5475
+ });
5476
+ }
5477
+ function klingAvatar(tier) {
5478
+ const label = tier === "pro" ? "Pro" : "Standard";
5479
+ return avatar({
5480
+ id: `kling-ai-avatar-v2-${tier}`,
5481
+ aliases: [],
5482
+ label: `Kling AI Avatar 2.0 ${label}`,
5483
+ providerModelId: `fal-ai/kling-video/ai-avatar/v2/${tier}`,
5484
+ provider: "kuaishou",
5485
+ logo: KLING_LOGO,
5486
+ description: `Kuaishou Kling AI Avatar 2.0 (${label}): turns one image of a person, animal or character and a 2-300 second audio clip into a talking video as long as the audio.`,
5487
+ audio: { min: 2, max: 300, formats: ["mp3", "wav", "m4a", "aac"], maxBytes: 5 * MB },
5488
+ promptMaxChars: 2500
5489
+ });
5490
+ }
5491
+ function veedFabric(tier) {
5492
+ const fast = tier === "fast";
5493
+ return avatar({
5494
+ id: fast ? "veed-fabric-1.0-fast" : "veed-fabric-1.0",
5495
+ aliases: [fast ? "veed/fabric-1.0/fast" : "veed/fabric-1.0"],
5496
+ label: fast ? "VEED Fabric 1.0 Fast" : "VEED Fabric 1.0",
5497
+ providerModelId: fast ? "veed/fabric-1.0/fast" : "veed/fabric-1.0",
5498
+ provider: "veed",
5499
+ logo: VEED_LOGO,
5500
+ description: fast ? "VEED Fabric 1.0 Fast: the quicker tier; turns one image and a speech clip into a lip-synced talking video as long as the speech, at 480p or 720p." : "VEED Fabric 1.0: turns one image and a speech clip into a lip-synced talking video as long as the speech, at 480p or 720p.",
5501
+ audio: { max: KIT_AUDIO_CAP_SECONDS, formats: ["mp3", "ogg", "wav", "m4a", "aac"] },
5502
+ resolutions: ["720p", "480p"]
5503
+ });
5504
+ }
5505
+ var VIDEO_AVATAR_MODELS = [
5506
+ heygenAvatar6("regular"),
5507
+ heygenAvatar6("turbo"),
5508
+ klingAvatar("standard"),
5509
+ klingAvatar("pro"),
5510
+ veedFabric("regular"),
5511
+ veedFabric("fast"),
5512
+ // https://fal.ai/models/fal-ai/sync-lipsync/v3/image-to-video/api: image_url and audio_url
5513
+ // only; the video matches the audio's length. sync takes WAV or MP3
5514
+ // (https://sync.so/docs/quickstart); the length is the kit cap.
5515
+ avatar({
5516
+ id: "sync-3-image-to-video",
5517
+ aliases: ["fal-ai/sync-lipsync/v3/image-to-video"],
5518
+ label: "Sync 3 Avatar",
5519
+ providerModelId: "fal-ai/sync-lipsync/v3/image-to-video",
5520
+ provider: "sync",
5521
+ logo: SYNC_LOGO2,
5522
+ description: "Sync 3 (sync-3) image-to-video: animates the face in one image so it lip-syncs to a speech clip, as long as the speech.",
5523
+ audio: { max: KIT_AUDIO_CAP_SECONDS, formats: ["wav", "mp3"] }
5524
+ })
5525
+ ];
5526
+
5527
+ // src/catalog/video-families.ts
5528
+ var VIDEO_USAGE = { unit: "seconds" };
5529
+ var MB2 = 1024 * 1024;
5530
+ var KLING_LOGO2 = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/kling-color.png";
5421
5531
  var MINIMAX_LOGO4 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
5422
5532
  var BYTEDANCE_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/3bba5d81-4e57-4e71-911b-cdfa05acca2c_compressed.png";
5423
5533
  var XAI_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/858b7fcc-9bd5-411d-aea1-a7b35ecfffab_compressed.png";
@@ -5475,7 +5585,7 @@ function klingMotionControl(tier) {
5475
5585
  pricingKind: "video_per_second",
5476
5586
  display: {
5477
5587
  provider: "kuaishou",
5478
- logo: KLING_LOGO,
5588
+ logo: KLING_LOGO2,
5479
5589
  description: `Kuaishou Kling 3.0 Motion Control (${label}): a character image performs the motion of a 3-30 second reference video, keeping its timing and sound.`
5480
5590
  },
5481
5591
  capabilities: {}
@@ -5508,7 +5618,7 @@ var VIDEO_FAMILY_MODELS = [
5508
5618
  pricingKind: "video_per_second",
5509
5619
  display: {
5510
5620
  provider: "kuaishou",
5511
- logo: KLING_LOGO,
5621
+ logo: KLING_LOGO2,
5512
5622
  description: "Kuaishou Kling O3 Pro: text, start/end frames and up to 7 reference images in one 3-15 second clip with consistent characters and optional native audio."
5513
5623
  },
5514
5624
  capabilities: { lastFrameRequiresFirstFrame: true }
@@ -5539,7 +5649,7 @@ var VIDEO_FAMILY_MODELS = [
5539
5649
  pricingKind: "video_per_second",
5540
5650
  display: {
5541
5651
  provider: "kuaishou",
5542
- logo: KLING_LOGO,
5652
+ logo: KLING_LOGO2,
5543
5653
  description: "Kuaishou Kling O3 Pro video edit: change a 3-15 second clip with a prompt and up to 4 reference images while keeping its motion and timing."
5544
5654
  },
5545
5655
  capabilities: { acceptsSourceVideo: true, videoEdit: true }
@@ -5583,7 +5693,7 @@ var VIDEO_FAMILY_MODELS = [
5583
5693
  pricingKind: "video_per_second",
5584
5694
  display: {
5585
5695
  provider: "kuaishou",
5586
- logo: KLING_LOGO,
5696
+ logo: KLING_LOGO2,
5587
5697
  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."
5588
5698
  },
5589
5699
  capabilities: { lastFrameRequiresFirstFrame: true }
@@ -5617,7 +5727,7 @@ var VIDEO_FAMILY_MODELS = [
5617
5727
  pricingKind: "video_per_second",
5618
5728
  display: {
5619
5729
  provider: "kuaishou",
5620
- logo: KLING_LOGO,
5730
+ logo: KLING_LOGO2,
5621
5731
  description: "Kuaishou Kling 4.0 video edit: change a 3-30 second clip with a prompt and up to 10 reference images, at 720p or 1080p, as long as the source or a set 3-30 seconds. Prompts name the source @Video1 and images @Image1."
5622
5732
  },
5623
5733
  capabilities: { acceptsSourceVideo: true, videoEdit: true }
@@ -5658,7 +5768,7 @@ var VIDEO_FAMILY_MODELS = [
5658
5768
  pricingKind: "video_per_second",
5659
5769
  display: {
5660
5770
  provider: "kuaishou",
5661
- logo: KLING_LOGO,
5771
+ logo: KLING_LOGO2,
5662
5772
  description: "Kuaishou Kling 4.0 Flash: fast text-to-video, a start frame, or reference-to-video from up to 10 images and 5 videos (20 seconds combined), 3 to 20 seconds at 720p. Prompts name references @Image1, @Video1."
5663
5773
  }
5664
5774
  },
@@ -5698,7 +5808,7 @@ var VIDEO_FAMILY_MODELS = [
5698
5808
  pricingKind: "video_per_second",
5699
5809
  display: {
5700
5810
  provider: "kuaishou",
5701
- logo: KLING_LOGO,
5811
+ logo: KLING_LOGO2,
5702
5812
  description: "Kuaishou Kling 4.0 Flash video edit: change a 3-20 second clip with a prompt, up to 10 reference images and 4 reference videos (20 seconds in all with the source), at 720p, as long as the source or a set 3-20 seconds. Prompts name the source @Video1."
5703
5813
  },
5704
5814
  capabilities: { acceptsSourceVideo: true, videoEdit: true }
@@ -5725,7 +5835,7 @@ var VIDEO_FAMILY_MODELS = [
5725
5835
  ...NO_REFERENCES,
5726
5836
  audios: 1,
5727
5837
  audioSeconds: { min: 2 },
5728
- audioMaxBytes: 15 * MB
5838
+ audioMaxBytes: 15 * MB2
5729
5839
  },
5730
5840
  supports: ["seed", "promptExpansion", "lastFrame", "safetyChecker"],
5731
5841
  prompt: H3_PROMPT,
@@ -5924,7 +6034,7 @@ var VIDEO_FAMILY_MODELS = [
5924
6034
  audioOnly: false,
5925
6035
  audioSeconds: { min: 3, max: 12 },
5926
6036
  audioFormats: ["mp3"],
5927
- audioMaxBytes: 50 * MB
6037
+ audioMaxBytes: 50 * MB2
5928
6038
  },
5929
6039
  // Sound (dialogue and effects) is a reference-to-video option; image-to-video is silent.
5930
6040
  supports: ["seed", "generateAudio", "safetyChecker"],
@@ -5965,7 +6075,7 @@ var VIDEO_FAMILY_MODELS = [
5965
6075
  audioOnly: false,
5966
6076
  audioSeconds: { min: 4, max: 300 },
5967
6077
  audioFormats: ["wav", "mp3"],
5968
- audioMaxBytes: 15 * MB,
6078
+ audioMaxBytes: 15 * MB2,
5969
6079
  min: { images: 1, audios: 1 }
5970
6080
  },
5971
6081
  requires: ["references"],
@@ -7068,6 +7178,7 @@ var VIDEO_MODELS = [
7068
7178
  capabilities: {}
7069
7179
  },
7070
7180
  ...VIDEO_FAMILY_MODELS,
7181
+ ...VIDEO_AVATAR_MODELS,
7071
7182
  ...LUMA_VIDEO_MODELS
7072
7183
  ];
7073
7184
 
@@ -9884,6 +9995,15 @@ var KLING_O3_IMAGE_CAP = 7;
9884
9995
  var KLING_V4_IMAGE_CAP = 10;
9885
9996
  var TURBO_AUDIO_MIN_SECONDS = 2;
9886
9997
  var OMNIHUMAN_AUDIO_SECONDS = { min: 4, max: 300 };
9998
+ var AVATAR_AUDIO = [
9999
+ ["heygen/avatar-6/image-to-video", { max: 300 }],
10000
+ ["heygen/avatar-6/turbo/image-to-video", { max: 300 }],
10001
+ ["fal-ai/kling-video/ai-avatar/v2/standard", { min: 2, max: 300 }],
10002
+ ["fal-ai/kling-video/ai-avatar/v2/pro", { min: 2, max: 300 }],
10003
+ ["veed/fabric-1.0", { max: 300, urlOnly: true }],
10004
+ ["veed/fabric-1.0/fast", { max: 300, urlOnly: true }],
10005
+ ["fal-ai/sync-lipsync/v3/image-to-video", { max: 300, urlOnly: true }]
10006
+ ];
9887
10007
  function missing(message) {
9888
10008
  return { code: "missing_input", message };
9889
10009
  }
@@ -10017,7 +10137,10 @@ function viduQ4(req) {
10017
10137
  }
10018
10138
  return req.firstFrame === void 0 ? missing("needs a start frame or reference images") : void 0;
10019
10139
  }
10020
- function omnihuman(req) {
10140
+ function isPublicUrl(ref) {
10141
+ return "url" in ref && !ref.url.startsWith("data:");
10142
+ }
10143
+ function imageAndAudio(req, audioSeconds) {
10021
10144
  const frames = noFrames(req);
10022
10145
  if (frames !== void 0) return frames;
10023
10146
  if (count(req.referenceVideos) > 0) return unsupported2("takes no reference videos");
@@ -10029,9 +10152,12 @@ function omnihuman(req) {
10029
10152
  if (extraImages.length > 0 || extraAudios.length > 0) {
10030
10153
  return unsupported2("takes exactly one image and one audio clip");
10031
10154
  }
10032
- return inputSeconds("audio", audio, OMNIHUMAN_AUDIO_SECONDS);
10155
+ if (audioSeconds.urlOnly === true && !(isPublicUrl(image) && isPublicUrl(audio))) {
10156
+ return unsupported2("takes its image and audio as public URLs, not inline bytes");
10157
+ }
10158
+ return inputSeconds("audio", audio, audioSeconds);
10033
10159
  }
10034
- var RULES = /* @__PURE__ */ new Map([
10160
+ var RULES = new Map([
10035
10161
  [MOTION_PRO, motionControl],
10036
10162
  [MOTION_STANDARD, motionControl],
10037
10163
  [O3_REFERENCE, o3Reference],
@@ -10048,7 +10174,10 @@ var RULES = /* @__PURE__ */ new Map([
10048
10174
  [HAPPY_HORSE, happyHorse],
10049
10175
  [HAPPY_HORSE_EDIT, happyHorseEdit],
10050
10176
  [VIDU_Q4, viduQ4],
10051
- [OMNIHUMAN_V2, omnihuman]
10177
+ [OMNIHUMAN_V2, (req) => imageAndAudio(req, OMNIHUMAN_AUDIO_SECONDS)],
10178
+ ...AVATAR_AUDIO.map(
10179
+ ([id, limits]) => [id, (req) => imageAndAudio(req, limits)]
10180
+ )
10052
10181
  ]);
10053
10182
  function falVideoProblem(providerModelId, req) {
10054
10183
  return RULES.get(providerModelId.toLowerCase())?.(req);