@shop-os/modelkit 0.26.1 → 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
@@ -5415,10 +5415,119 @@ var TEXT_MODELS = [
5415
5415
  })
5416
5416
  ];
5417
5417
 
5418
- // src/catalog/video-families.ts
5419
- var VIDEO_USAGE = { unit: "seconds" };
5418
+ // src/catalog/video-avatars.ts
5420
5419
  var MB = 1024 * 1024;
5421
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";
5422
5531
  var MINIMAX_LOGO4 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
5423
5532
  var BYTEDANCE_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/3bba5d81-4e57-4e71-911b-cdfa05acca2c_compressed.png";
5424
5533
  var XAI_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/858b7fcc-9bd5-411d-aea1-a7b35ecfffab_compressed.png";
@@ -5476,7 +5585,7 @@ function klingMotionControl(tier) {
5476
5585
  pricingKind: "video_per_second",
5477
5586
  display: {
5478
5587
  provider: "kuaishou",
5479
- logo: KLING_LOGO,
5588
+ logo: KLING_LOGO2,
5480
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.`
5481
5590
  },
5482
5591
  capabilities: {}
@@ -5509,7 +5618,7 @@ var VIDEO_FAMILY_MODELS = [
5509
5618
  pricingKind: "video_per_second",
5510
5619
  display: {
5511
5620
  provider: "kuaishou",
5512
- logo: KLING_LOGO,
5621
+ logo: KLING_LOGO2,
5513
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."
5514
5623
  },
5515
5624
  capabilities: { lastFrameRequiresFirstFrame: true }
@@ -5540,7 +5649,7 @@ var VIDEO_FAMILY_MODELS = [
5540
5649
  pricingKind: "video_per_second",
5541
5650
  display: {
5542
5651
  provider: "kuaishou",
5543
- logo: KLING_LOGO,
5652
+ logo: KLING_LOGO2,
5544
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."
5545
5654
  },
5546
5655
  capabilities: { acceptsSourceVideo: true, videoEdit: true }
@@ -5584,7 +5693,7 @@ var VIDEO_FAMILY_MODELS = [
5584
5693
  pricingKind: "video_per_second",
5585
5694
  display: {
5586
5695
  provider: "kuaishou",
5587
- logo: KLING_LOGO,
5696
+ logo: KLING_LOGO2,
5588
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."
5589
5698
  },
5590
5699
  capabilities: { lastFrameRequiresFirstFrame: true }
@@ -5618,7 +5727,7 @@ var VIDEO_FAMILY_MODELS = [
5618
5727
  pricingKind: "video_per_second",
5619
5728
  display: {
5620
5729
  provider: "kuaishou",
5621
- logo: KLING_LOGO,
5730
+ logo: KLING_LOGO2,
5622
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."
5623
5732
  },
5624
5733
  capabilities: { acceptsSourceVideo: true, videoEdit: true }
@@ -5659,7 +5768,7 @@ var VIDEO_FAMILY_MODELS = [
5659
5768
  pricingKind: "video_per_second",
5660
5769
  display: {
5661
5770
  provider: "kuaishou",
5662
- logo: KLING_LOGO,
5771
+ logo: KLING_LOGO2,
5663
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."
5664
5773
  }
5665
5774
  },
@@ -5699,7 +5808,7 @@ var VIDEO_FAMILY_MODELS = [
5699
5808
  pricingKind: "video_per_second",
5700
5809
  display: {
5701
5810
  provider: "kuaishou",
5702
- logo: KLING_LOGO,
5811
+ logo: KLING_LOGO2,
5703
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."
5704
5813
  },
5705
5814
  capabilities: { acceptsSourceVideo: true, videoEdit: true }
@@ -5726,7 +5835,7 @@ var VIDEO_FAMILY_MODELS = [
5726
5835
  ...NO_REFERENCES,
5727
5836
  audios: 1,
5728
5837
  audioSeconds: { min: 2 },
5729
- audioMaxBytes: 15 * MB
5838
+ audioMaxBytes: 15 * MB2
5730
5839
  },
5731
5840
  supports: ["seed", "promptExpansion", "lastFrame", "safetyChecker"],
5732
5841
  prompt: H3_PROMPT,
@@ -5925,7 +6034,7 @@ var VIDEO_FAMILY_MODELS = [
5925
6034
  audioOnly: false,
5926
6035
  audioSeconds: { min: 3, max: 12 },
5927
6036
  audioFormats: ["mp3"],
5928
- audioMaxBytes: 50 * MB
6037
+ audioMaxBytes: 50 * MB2
5929
6038
  },
5930
6039
  // Sound (dialogue and effects) is a reference-to-video option; image-to-video is silent.
5931
6040
  supports: ["seed", "generateAudio", "safetyChecker"],
@@ -5966,7 +6075,7 @@ var VIDEO_FAMILY_MODELS = [
5966
6075
  audioOnly: false,
5967
6076
  audioSeconds: { min: 4, max: 300 },
5968
6077
  audioFormats: ["wav", "mp3"],
5969
- audioMaxBytes: 15 * MB,
6078
+ audioMaxBytes: 15 * MB2,
5970
6079
  min: { images: 1, audios: 1 }
5971
6080
  },
5972
6081
  requires: ["references"],
@@ -7069,6 +7178,7 @@ var VIDEO_MODELS = [
7069
7178
  capabilities: {}
7070
7179
  },
7071
7180
  ...VIDEO_FAMILY_MODELS,
7181
+ ...VIDEO_AVATAR_MODELS,
7072
7182
  ...LUMA_VIDEO_MODELS
7073
7183
  ];
7074
7184
 
@@ -9885,6 +9995,15 @@ var KLING_O3_IMAGE_CAP = 7;
9885
9995
  var KLING_V4_IMAGE_CAP = 10;
9886
9996
  var TURBO_AUDIO_MIN_SECONDS = 2;
9887
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
+ ];
9888
10007
  function missing(message) {
9889
10008
  return { code: "missing_input", message };
9890
10009
  }
@@ -10018,7 +10137,10 @@ function viduQ4(req) {
10018
10137
  }
10019
10138
  return req.firstFrame === void 0 ? missing("needs a start frame or reference images") : void 0;
10020
10139
  }
10021
- function omnihuman(req) {
10140
+ function isPublicUrl(ref) {
10141
+ return "url" in ref && !ref.url.startsWith("data:");
10142
+ }
10143
+ function imageAndAudio(req, audioSeconds) {
10022
10144
  const frames = noFrames(req);
10023
10145
  if (frames !== void 0) return frames;
10024
10146
  if (count(req.referenceVideos) > 0) return unsupported2("takes no reference videos");
@@ -10030,9 +10152,12 @@ function omnihuman(req) {
10030
10152
  if (extraImages.length > 0 || extraAudios.length > 0) {
10031
10153
  return unsupported2("takes exactly one image and one audio clip");
10032
10154
  }
10033
- 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);
10034
10159
  }
10035
- var RULES = /* @__PURE__ */ new Map([
10160
+ var RULES = new Map([
10036
10161
  [MOTION_PRO, motionControl],
10037
10162
  [MOTION_STANDARD, motionControl],
10038
10163
  [O3_REFERENCE, o3Reference],
@@ -10049,7 +10174,10 @@ var RULES = /* @__PURE__ */ new Map([
10049
10174
  [HAPPY_HORSE, happyHorse],
10050
10175
  [HAPPY_HORSE_EDIT, happyHorseEdit],
10051
10176
  [VIDU_Q4, viduQ4],
10052
- [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
+ )
10053
10181
  ]);
10054
10182
  function falVideoProblem(providerModelId, req) {
10055
10183
  return RULES.get(providerModelId.toLowerCase())?.(req);