@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/index.js CHANGED
@@ -5426,10 +5426,119 @@ var TEXT_MODELS = [
5426
5426
  })
5427
5427
  ];
5428
5428
 
5429
- // src/catalog/video-families.ts
5430
- var VIDEO_USAGE = { unit: "seconds" };
5429
+ // src/catalog/video-avatars.ts
5431
5430
  var MB = 1024 * 1024;
5432
5431
  var KLING_LOGO = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/kling-color.png";
5432
+ var VEED_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/d540d2bb-0022-4371-8889-48aefaf46bbe.png";
5433
+ var SYNC_LOGO2 = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/sync.png";
5434
+ var KIT_AUDIO_CAP_SECONDS = 300;
5435
+ function avatar(row2) {
5436
+ const { min, max, formats, maxBytes } = row2.audio;
5437
+ return {
5438
+ id: row2.id,
5439
+ aliases: row2.aliases,
5440
+ label: row2.label,
5441
+ type: "video",
5442
+ adapter: "fal",
5443
+ providerModelId: row2.providerModelId,
5444
+ lifecycle: "active",
5445
+ exposure: ["cowork", "space_builder"],
5446
+ constraints: {
5447
+ ...row2.resolutions !== void 0 && { resolutions: [...row2.resolutions] },
5448
+ references: {
5449
+ images: 1,
5450
+ videos: 0,
5451
+ audios: 1,
5452
+ audioOnly: false,
5453
+ audioSeconds: { ...min !== void 0 && { min }, max },
5454
+ audioFormats: formats,
5455
+ ...maxBytes !== void 0 && { audioMaxBytes: maxBytes },
5456
+ min: { images: 1, audios: 1 }
5457
+ },
5458
+ requires: ["references"],
5459
+ supports: [],
5460
+ ...row2.promptMaxChars === void 0 ? { noPrompt: true } : { prompt: { referenceSyntax: "descriptive", maxChars: row2.promptMaxChars } },
5461
+ audio: "always"
5462
+ },
5463
+ defaults: row2.resolutions === void 0 ? {} : { resolution: row2.resolutions[0] },
5464
+ usage: { unit: "seconds" },
5465
+ pricingKind: "video_per_second",
5466
+ display: {
5467
+ provider: row2.provider,
5468
+ ...row2.logo !== void 0 && { logo: row2.logo },
5469
+ description: row2.description
5470
+ },
5471
+ capabilities: {}
5472
+ };
5473
+ }
5474
+ function heygenAvatar6(tier) {
5475
+ const turbo2 = tier === "turbo";
5476
+ return avatar({
5477
+ id: turbo2 ? "heygen-avatar-6-turbo" : "heygen-avatar-6",
5478
+ aliases: [],
5479
+ label: turbo2 ? "HeyGen Avatar 6 Turbo" : "HeyGen Avatar 6",
5480
+ providerModelId: turbo2 ? "heygen/avatar-6/turbo/image-to-video" : "heygen/avatar-6/image-to-video",
5481
+ provider: "heygen",
5482
+ description: turbo2 ? "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.",
5483
+ audio: { max: KIT_AUDIO_CAP_SECONDS, formats: ["wav", "mp3"], maxBytes: 50 * MB },
5484
+ resolutions: ["1080p", "2k"],
5485
+ promptMaxChars: 1200
5486
+ });
5487
+ }
5488
+ function klingAvatar(tier) {
5489
+ const label = tier === "pro" ? "Pro" : "Standard";
5490
+ return avatar({
5491
+ id: `kling-ai-avatar-v2-${tier}`,
5492
+ aliases: [],
5493
+ label: `Kling AI Avatar 2.0 ${label}`,
5494
+ providerModelId: `fal-ai/kling-video/ai-avatar/v2/${tier}`,
5495
+ provider: "kuaishou",
5496
+ logo: KLING_LOGO,
5497
+ 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.`,
5498
+ audio: { min: 2, max: 300, formats: ["mp3", "wav", "m4a", "aac"], maxBytes: 5 * MB },
5499
+ promptMaxChars: 2500
5500
+ });
5501
+ }
5502
+ function veedFabric(tier) {
5503
+ const fast = tier === "fast";
5504
+ return avatar({
5505
+ id: fast ? "veed-fabric-1.0-fast" : "veed-fabric-1.0",
5506
+ aliases: [fast ? "veed/fabric-1.0/fast" : "veed/fabric-1.0"],
5507
+ label: fast ? "VEED Fabric 1.0 Fast" : "VEED Fabric 1.0",
5508
+ providerModelId: fast ? "veed/fabric-1.0/fast" : "veed/fabric-1.0",
5509
+ provider: "veed",
5510
+ logo: VEED_LOGO,
5511
+ 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.",
5512
+ audio: { max: KIT_AUDIO_CAP_SECONDS, formats: ["mp3", "ogg", "wav", "m4a", "aac"] },
5513
+ resolutions: ["720p", "480p"]
5514
+ });
5515
+ }
5516
+ var VIDEO_AVATAR_MODELS = [
5517
+ heygenAvatar6("regular"),
5518
+ heygenAvatar6("turbo"),
5519
+ klingAvatar("standard"),
5520
+ klingAvatar("pro"),
5521
+ veedFabric("regular"),
5522
+ veedFabric("fast"),
5523
+ // https://fal.ai/models/fal-ai/sync-lipsync/v3/image-to-video/api: image_url and audio_url
5524
+ // only; the video matches the audio's length. sync takes WAV or MP3
5525
+ // (https://sync.so/docs/quickstart); the length is the kit cap.
5526
+ avatar({
5527
+ id: "sync-3-image-to-video",
5528
+ aliases: ["fal-ai/sync-lipsync/v3/image-to-video"],
5529
+ label: "Sync 3 Avatar",
5530
+ providerModelId: "fal-ai/sync-lipsync/v3/image-to-video",
5531
+ provider: "sync",
5532
+ logo: SYNC_LOGO2,
5533
+ 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.",
5534
+ audio: { max: KIT_AUDIO_CAP_SECONDS, formats: ["wav", "mp3"] }
5535
+ })
5536
+ ];
5537
+
5538
+ // src/catalog/video-families.ts
5539
+ var VIDEO_USAGE = { unit: "seconds" };
5540
+ var MB2 = 1024 * 1024;
5541
+ var KLING_LOGO2 = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/kling-color.png";
5433
5542
  var MINIMAX_LOGO4 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
5434
5543
  var BYTEDANCE_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/3bba5d81-4e57-4e71-911b-cdfa05acca2c_compressed.png";
5435
5544
  var XAI_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/858b7fcc-9bd5-411d-aea1-a7b35ecfffab_compressed.png";
@@ -5487,7 +5596,7 @@ function klingMotionControl(tier) {
5487
5596
  pricingKind: "video_per_second",
5488
5597
  display: {
5489
5598
  provider: "kuaishou",
5490
- logo: KLING_LOGO,
5599
+ logo: KLING_LOGO2,
5491
5600
  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.`
5492
5601
  },
5493
5602
  capabilities: {}
@@ -5520,7 +5629,7 @@ var VIDEO_FAMILY_MODELS = [
5520
5629
  pricingKind: "video_per_second",
5521
5630
  display: {
5522
5631
  provider: "kuaishou",
5523
- logo: KLING_LOGO,
5632
+ logo: KLING_LOGO2,
5524
5633
  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."
5525
5634
  },
5526
5635
  capabilities: { lastFrameRequiresFirstFrame: true }
@@ -5551,7 +5660,7 @@ var VIDEO_FAMILY_MODELS = [
5551
5660
  pricingKind: "video_per_second",
5552
5661
  display: {
5553
5662
  provider: "kuaishou",
5554
- logo: KLING_LOGO,
5663
+ logo: KLING_LOGO2,
5555
5664
  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."
5556
5665
  },
5557
5666
  capabilities: { acceptsSourceVideo: true, videoEdit: true }
@@ -5595,7 +5704,7 @@ var VIDEO_FAMILY_MODELS = [
5595
5704
  pricingKind: "video_per_second",
5596
5705
  display: {
5597
5706
  provider: "kuaishou",
5598
- logo: KLING_LOGO,
5707
+ logo: KLING_LOGO2,
5599
5708
  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."
5600
5709
  },
5601
5710
  capabilities: { lastFrameRequiresFirstFrame: true }
@@ -5629,7 +5738,7 @@ var VIDEO_FAMILY_MODELS = [
5629
5738
  pricingKind: "video_per_second",
5630
5739
  display: {
5631
5740
  provider: "kuaishou",
5632
- logo: KLING_LOGO,
5741
+ logo: KLING_LOGO2,
5633
5742
  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."
5634
5743
  },
5635
5744
  capabilities: { acceptsSourceVideo: true, videoEdit: true }
@@ -5670,7 +5779,7 @@ var VIDEO_FAMILY_MODELS = [
5670
5779
  pricingKind: "video_per_second",
5671
5780
  display: {
5672
5781
  provider: "kuaishou",
5673
- logo: KLING_LOGO,
5782
+ logo: KLING_LOGO2,
5674
5783
  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."
5675
5784
  }
5676
5785
  },
@@ -5710,7 +5819,7 @@ var VIDEO_FAMILY_MODELS = [
5710
5819
  pricingKind: "video_per_second",
5711
5820
  display: {
5712
5821
  provider: "kuaishou",
5713
- logo: KLING_LOGO,
5822
+ logo: KLING_LOGO2,
5714
5823
  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."
5715
5824
  },
5716
5825
  capabilities: { acceptsSourceVideo: true, videoEdit: true }
@@ -5737,7 +5846,7 @@ var VIDEO_FAMILY_MODELS = [
5737
5846
  ...NO_REFERENCES,
5738
5847
  audios: 1,
5739
5848
  audioSeconds: { min: 2 },
5740
- audioMaxBytes: 15 * MB
5849
+ audioMaxBytes: 15 * MB2
5741
5850
  },
5742
5851
  supports: ["seed", "promptExpansion", "lastFrame", "safetyChecker"],
5743
5852
  prompt: H3_PROMPT,
@@ -5936,7 +6045,7 @@ var VIDEO_FAMILY_MODELS = [
5936
6045
  audioOnly: false,
5937
6046
  audioSeconds: { min: 3, max: 12 },
5938
6047
  audioFormats: ["mp3"],
5939
- audioMaxBytes: 50 * MB
6048
+ audioMaxBytes: 50 * MB2
5940
6049
  },
5941
6050
  // Sound (dialogue and effects) is a reference-to-video option; image-to-video is silent.
5942
6051
  supports: ["seed", "generateAudio", "safetyChecker"],
@@ -5977,7 +6086,7 @@ var VIDEO_FAMILY_MODELS = [
5977
6086
  audioOnly: false,
5978
6087
  audioSeconds: { min: 4, max: 300 },
5979
6088
  audioFormats: ["wav", "mp3"],
5980
- audioMaxBytes: 15 * MB,
6089
+ audioMaxBytes: 15 * MB2,
5981
6090
  min: { images: 1, audios: 1 }
5982
6091
  },
5983
6092
  requires: ["references"],
@@ -7080,6 +7189,7 @@ var VIDEO_MODELS = [
7080
7189
  capabilities: {}
7081
7190
  },
7082
7191
  ...VIDEO_FAMILY_MODELS,
7192
+ ...VIDEO_AVATAR_MODELS,
7083
7193
  ...LUMA_VIDEO_MODELS
7084
7194
  ];
7085
7195
 
@@ -10094,6 +10204,15 @@ var KLING_O3_IMAGE_CAP = 7;
10094
10204
  var KLING_V4_IMAGE_CAP = 10;
10095
10205
  var TURBO_AUDIO_MIN_SECONDS = 2;
10096
10206
  var OMNIHUMAN_AUDIO_SECONDS = { min: 4, max: 300 };
10207
+ var AVATAR_AUDIO = [
10208
+ ["heygen/avatar-6/image-to-video", { max: 300 }],
10209
+ ["heygen/avatar-6/turbo/image-to-video", { max: 300 }],
10210
+ ["fal-ai/kling-video/ai-avatar/v2/standard", { min: 2, max: 300 }],
10211
+ ["fal-ai/kling-video/ai-avatar/v2/pro", { min: 2, max: 300 }],
10212
+ ["veed/fabric-1.0", { max: 300, urlOnly: true }],
10213
+ ["veed/fabric-1.0/fast", { max: 300, urlOnly: true }],
10214
+ ["fal-ai/sync-lipsync/v3/image-to-video", { max: 300, urlOnly: true }]
10215
+ ];
10097
10216
  function missing(message) {
10098
10217
  return { code: "missing_input", message };
10099
10218
  }
@@ -10227,7 +10346,10 @@ function viduQ4(req) {
10227
10346
  }
10228
10347
  return req.firstFrame === void 0 ? missing("needs a start frame or reference images") : void 0;
10229
10348
  }
10230
- function omnihuman(req) {
10349
+ function isPublicUrl(ref) {
10350
+ return "url" in ref && !ref.url.startsWith("data:");
10351
+ }
10352
+ function imageAndAudio(req, audioSeconds) {
10231
10353
  const frames = noFrames(req);
10232
10354
  if (frames !== void 0) return frames;
10233
10355
  if (count(req.referenceVideos) > 0) return unsupported3("takes no reference videos");
@@ -10239,9 +10361,12 @@ function omnihuman(req) {
10239
10361
  if (extraImages.length > 0 || extraAudios.length > 0) {
10240
10362
  return unsupported3("takes exactly one image and one audio clip");
10241
10363
  }
10242
- return inputSeconds("audio", audio, OMNIHUMAN_AUDIO_SECONDS);
10364
+ if (audioSeconds.urlOnly === true && !(isPublicUrl(image) && isPublicUrl(audio))) {
10365
+ return unsupported3("takes its image and audio as public URLs, not inline bytes");
10366
+ }
10367
+ return inputSeconds("audio", audio, audioSeconds);
10243
10368
  }
10244
- var RULES = /* @__PURE__ */ new Map([
10369
+ var RULES = new Map([
10245
10370
  [MOTION_PRO, motionControl],
10246
10371
  [MOTION_STANDARD, motionControl],
10247
10372
  [O3_REFERENCE, o3Reference],
@@ -10258,7 +10383,10 @@ var RULES = /* @__PURE__ */ new Map([
10258
10383
  [HAPPY_HORSE, happyHorse],
10259
10384
  [HAPPY_HORSE_EDIT, happyHorseEdit],
10260
10385
  [VIDU_Q4, viduQ4],
10261
- [OMNIHUMAN_V2, omnihuman]
10386
+ [OMNIHUMAN_V2, (req) => imageAndAudio(req, OMNIHUMAN_AUDIO_SECONDS)],
10387
+ ...AVATAR_AUDIO.map(
10388
+ ([id, limits]) => [id, (req) => imageAndAudio(req, limits)]
10389
+ )
10262
10390
  ]);
10263
10391
  function falVideoProblem(providerModelId, req) {
10264
10392
  return RULES.get(providerModelId.toLowerCase())?.(req);
@@ -11835,11 +11963,11 @@ function toolInput(ctx, req, output) {
11835
11963
  }
11836
11964
  var EXR_DEFAULT_PROMPT = "The same video in high dynamic range, with unchanged content, motion, framing and timing.";
11837
11965
  async function submitFalVideoTool(req, ctx, opts) {
11838
- const plan4 = planVideoTool(ctx.model, req);
11839
- if (!plan4.ok) {
11966
+ const plan5 = planVideoTool(ctx.model, req);
11967
+ if (!plan5.ok) {
11840
11968
  throw new ModelKitError({
11841
11969
  code: "unsupported_option",
11842
- message: plan4.error,
11970
+ message: plan5.error,
11843
11971
  provider: "fal",
11844
11972
  model: ctx.model.id,
11845
11973
  retryable: false
@@ -11847,7 +11975,7 @@ async function submitFalVideoTool(req, ctx, opts) {
11847
11975
  }
11848
11976
  const target = new URL(`${FAL_QUEUE_ORIGIN}/${ctx.model.providerModelId}`);
11849
11977
  if (opts.webhookUrl !== void 0) target.searchParams.set("fal_webhook", opts.webhookUrl);
11850
- const res = await queueFetch(ctx, target.toString(), "POST", toolInput(ctx, req, plan4.output));
11978
+ const res = await queueFetch(ctx, target.toString(), "POST", toolInput(ctx, req, plan5.output));
11851
11979
  const parsed = submitResponseSchema.safeParse(await readJson(ctx, res));
11852
11980
  if (!parsed.success) {
11853
11981
  throw new ModelKitError({
@@ -11865,7 +11993,7 @@ async function submitFalVideoTool(req, ctx, opts) {
11865
11993
  statusUrl: parsed.data.status_url,
11866
11994
  responseUrl: parsed.data.response_url,
11867
11995
  cancelUrl: parsed.data.cancel_url,
11868
- output: plan4.output
11996
+ output: plan5.output
11869
11997
  };
11870
11998
  }
11871
11999
  async function falVideoToolStatus(sub, ctx) {
@@ -12187,14 +12315,14 @@ function planFalImage(req, providerModelId, model) {
12187
12315
  const exact = falExactSize(spec, req);
12188
12316
  const call = { label: spec.label, req, refs, edit: edit2, ...exact !== void 0 && { exact } };
12189
12317
  const built = family.build(call, model);
12190
- const plan4 = {
12318
+ const plan5 = {
12191
12319
  endpoint: edit2 && family.editEndpoint !== void 0 ? family.editEndpoint : id,
12192
12320
  input: built.input,
12193
12321
  output: family.output ?? "images"
12194
12322
  };
12195
- if (built.imageQuality !== void 0) plan4.imageQuality = built.imageQuality;
12196
- if (built.imageSize !== void 0) plan4.imageSize = built.imageSize;
12197
- return plan4;
12323
+ if (built.imageQuality !== void 0) plan5.imageQuality = built.imageQuality;
12324
+ if (built.imageSize !== void 0) plan5.imageSize = built.imageSize;
12325
+ return plan5;
12198
12326
  }
12199
12327
  var FalFileSchema = z17.object({ url: z17.string(), content_type: z17.string().nullish() });
12200
12328
  var ImagesPayloadSchema = z17.object({ images: z17.array(FalFileSchema) });
@@ -12216,18 +12344,18 @@ async function downloadFalFile(ctx, file) {
12216
12344
  const mime = res.headers.get("content-type") ?? file.content_type ?? "";
12217
12345
  return { bytes: new Uint8Array(await res.arrayBuffer()), mime };
12218
12346
  }
12219
- function filesOf(payload, plan4) {
12220
- if (plan4.output === "image") {
12347
+ function filesOf(payload, plan5) {
12348
+ if (plan5.output === "image") {
12221
12349
  const parsed2 = ImagePayloadSchema.safeParse(payload);
12222
12350
  return parsed2.success ? [parsed2.data.image] : [];
12223
12351
  }
12224
12352
  const parsed = ImagesPayloadSchema.safeParse(payload);
12225
12353
  return parsed.success ? parsed.data.images : [];
12226
12354
  }
12227
- async function collectFalPlanImages(payload, plan4, ctx, req) {
12228
- const files = filesOf(payload, plan4);
12355
+ async function collectFalPlanImages(payload, plan5, ctx, req) {
12356
+ const files = filesOf(payload, plan5);
12229
12357
  if (files.length === 0) {
12230
- throw fail2(ctx.model.id, `fal ${plan4.endpoint} returned no image`, "provider_rejected");
12358
+ throw fail2(ctx.model.id, `fal ${plan5.endpoint} returned no image`, "provider_rejected");
12231
12359
  }
12232
12360
  const images = await Promise.all(
12233
12361
  files.map(async (file) => {
@@ -12242,18 +12370,18 @@ async function collectFalPlanImages(payload, plan4, ctx, req) {
12242
12370
  unit: "images",
12243
12371
  quantity: images.length
12244
12372
  };
12245
- const billedSize = plan4.imageSize ?? req.size;
12373
+ const billedSize = plan5.imageSize ?? req.size;
12246
12374
  if (billedSize !== void 0 && ctx.model.type === "image") usage6.imageSize = billedSize;
12247
- if (plan4.imageQuality !== void 0) usage6.imageQuality = plan4.imageQuality;
12375
+ if (plan5.imageQuality !== void 0) usage6.imageQuality = plan5.imageQuality;
12248
12376
  const result = { images, usage: usage6, raw: payload };
12249
12377
  const remote = files.find((f) => !f.url.startsWith("data:"));
12250
12378
  if (remote !== void 0) result.outputUrl = remote.url;
12251
12379
  return result;
12252
12380
  }
12253
12381
  async function generateFalFamilyImage(req, ctx, run) {
12254
- const plan4 = planFalImage(req, ctx.model.providerModelId, ctx.model.id);
12255
- const payload = await run(plan4.endpoint, plan4.input);
12256
- return collectFalPlanImages(payload, plan4, ctx, req);
12382
+ const plan5 = planFalImage(req, ctx.model.providerModelId, ctx.model.id);
12383
+ const payload = await run(plan5.endpoint, plan5.input);
12384
+ return collectFalPlanImages(payload, plan5, ctx, req);
12257
12385
  }
12258
12386
 
12259
12387
  // src/adapters/fal-mask.ts
@@ -13213,6 +13341,39 @@ function inputLengthSeconds(req, input) {
13213
13341
  return (payload) => reportedSeconds2(payload) ?? input?.durationSeconds ?? req.durationSeconds ?? 5;
13214
13342
  }
13215
13343
 
13344
+ // src/adapters/fal-avatar.ts
13345
+ var ENDPOINTS = /* @__PURE__ */ new Map([
13346
+ ["heygen/avatar-6/image-to-video", { promptField: "motion_prompt", resolution: true }],
13347
+ ["heygen/avatar-6/turbo/image-to-video", { promptField: "motion_prompt", resolution: true }],
13348
+ ["fal-ai/kling-video/ai-avatar/v2/standard", { promptField: "prompt", resolution: false }],
13349
+ ["fal-ai/kling-video/ai-avatar/v2/pro", { promptField: "prompt", resolution: false }],
13350
+ ["veed/fabric-1.0", { resolution: true }],
13351
+ ["veed/fabric-1.0/fast", { resolution: true }],
13352
+ ["fal-ai/sync-lipsync/v3/image-to-video", { resolution: false }]
13353
+ ]);
13354
+ function plan(req, ctx) {
13355
+ const id = ctx.model.providerModelId.toLowerCase();
13356
+ const endpoint = ENDPOINTS.get(id);
13357
+ const [image] = req.referenceImages ?? [];
13358
+ const [audio] = req.referenceAudios ?? [];
13359
+ if (endpoint === void 0 || image === void 0 || audio === void 0) {
13360
+ throw refusal2(ctx, "needs one image and one audio clip", "missing_input");
13361
+ }
13362
+ const input = { image_url: refToUrl(image), audio_url: refToUrl(audio) };
13363
+ const prompt = req.prompt.trim();
13364
+ if (endpoint.promptField !== void 0 && prompt.length > 0) {
13365
+ input[endpoint.promptField] = prompt;
13366
+ }
13367
+ const cap = ctx.model.constraints.references?.audioSeconds?.max;
13368
+ const measured2 = audio.durationSeconds;
13369
+ const seconds3 = (payload) => reportedSeconds2(payload) ?? measured2 ?? cap ?? req.durationSeconds ?? 5;
13370
+ if (!endpoint.resolution) return { endpoint: id, input, seconds: seconds3 };
13371
+ const resolution = resolutionOf2(req, ctx);
13372
+ input["resolution"] = resolution;
13373
+ return { endpoint: id, input, resolution, seconds: seconds3 };
13374
+ }
13375
+ var avatarFamily = { ids: new Set(ENDPOINTS.keys()), plan };
13376
+
13216
13377
  // src/adapters/fal-happy-horse.ts
13217
13378
  var VIDEO_EDIT = "alibaba/happy-horse/video-edit";
13218
13379
  function edit(req, ctx) {
@@ -13377,7 +13538,7 @@ var klingV4Family = {
13377
13538
  };
13378
13539
 
13379
13540
  // src/adapters/fal-kling-omni.ts
13380
- function plan(req, ctx) {
13541
+ function plan2(req, ctx) {
13381
13542
  const tier = klingTier(req);
13382
13543
  const duration = wholeSeconds(req, ctx);
13383
13544
  const input = {
@@ -13412,7 +13573,7 @@ function plan(req, ctx) {
13412
13573
  }
13413
13574
  var klingOmniFamily = {
13414
13575
  ids: /* @__PURE__ */ new Set([KLING_O3_OMNI]),
13415
- plan
13576
+ plan: plan2
13416
13577
  };
13417
13578
 
13418
13579
  // src/adapters/fal-minimax-h3.ts
@@ -13531,7 +13692,7 @@ var minimaxH3MaxFamily = {
13531
13692
 
13532
13693
  // src/adapters/fal-omnihuman.ts
13533
13694
  var OMNIHUMAN_V22 = "bytedance/omnihuman/v2";
13534
- function plan2(req, ctx) {
13695
+ function plan3(req, ctx) {
13535
13696
  const [image] = req.referenceImages ?? [];
13536
13697
  const [audio] = req.referenceAudios ?? [];
13537
13698
  if (image === void 0 || audio === void 0) {
@@ -13542,14 +13703,14 @@ function plan2(req, ctx) {
13542
13703
  return { endpoint: OMNIHUMAN_V22, input, seconds: inputLengthSeconds(req, audio) };
13543
13704
  }
13544
13705
  var OMNIHUMAN_MODEL_IDS = /* @__PURE__ */ new Set([OMNIHUMAN_V22]);
13545
- var omnihumanFamily = { ids: OMNIHUMAN_MODEL_IDS, plan: plan2 };
13706
+ var omnihumanFamily = { ids: OMNIHUMAN_MODEL_IDS, plan: plan3 };
13546
13707
 
13547
13708
  // src/adapters/fal-vidu.ts
13548
13709
  var FAMILY = "fal-ai/vidu/q4";
13549
13710
  function viduTier(resolution) {
13550
13711
  return resolution === "2k" || resolution === "4k" ? upperTier(resolution) : resolution;
13551
13712
  }
13552
- function plan3(req, ctx) {
13713
+ function plan4(req, ctx) {
13553
13714
  const images = urls(req.referenceImages);
13554
13715
  const audios = urls(req.referenceAudios);
13555
13716
  const duration = wholeSeconds(req, ctx);
@@ -13576,7 +13737,7 @@ function plan3(req, ctx) {
13576
13737
  return { endpoint, input, resolution, seconds: requestedSeconds(duration) };
13577
13738
  }
13578
13739
  var VIDU_MODEL_IDS = /* @__PURE__ */ new Set([FAMILY]);
13579
- var viduFamily = { ids: VIDU_MODEL_IDS, plan: plan3 };
13740
+ var viduFamily = { ids: VIDU_MODEL_IDS, plan: plan4 };
13580
13741
 
13581
13742
  // src/adapters/fal-video-families.ts
13582
13743
  var FAMILIES2 = [
@@ -13586,7 +13747,8 @@ var FAMILIES2 = [
13586
13747
  minimaxH3MaxFamily,
13587
13748
  happyHorseFamily,
13588
13749
  viduFamily,
13589
- omnihumanFamily
13750
+ omnihumanFamily,
13751
+ avatarFamily
13590
13752
  ];
13591
13753
  function isFalFamilyVideo(providerModelId) {
13592
13754
  const id = providerModelId.toLowerCase();
@@ -14017,7 +14179,7 @@ function extractVideoUrl(result, endpoint, model) {
14017
14179
  }
14018
14180
  async function generateFalVideo(req, ctx, deps) {
14019
14181
  const providerModelId = ctx.model.providerModelId;
14020
- const plan4 = planFalFamilyVideo(req, ctx);
14182
+ const plan5 = planFalFamilyVideo(req, ctx);
14021
14183
  const start = (endpoint2, input, usageOf2) => startFalVideoJob(
14022
14184
  ctx,
14023
14185
  () => falClientOf(ctx, deps),
@@ -14025,7 +14187,7 @@ async function generateFalVideo(req, ctx, deps) {
14025
14187
  input,
14026
14188
  videoFileDecoder(ctx, req, endpoint2, usageOf2)
14027
14189
  );
14028
- if (plan4 !== void 0) return start(plan4.endpoint, plan4.input, planUsage(ctx, plan4));
14190
+ if (plan5 !== void 0) return start(plan5.endpoint, plan5.input, planUsage(ctx, plan5));
14029
14191
  if (isKling(providerModelId)) return start(KLING_O1_ENDPOINT, klingO1Input(req));
14030
14192
  if (!isMinimax(providerModelId)) {
14031
14193
  throw new ModelKitError({
@@ -14071,9 +14233,9 @@ function videoFileDecoder(ctx, req, endpoint, usageOf2) {
14071
14233
  raw: payload
14072
14234
  });
14073
14235
  }
14074
- function planUsage(ctx, plan4) {
14236
+ function planUsage(ctx, plan5) {
14075
14237
  return (payload) => {
14076
- const seconds3 = plan4.seconds(payload);
14238
+ const seconds3 = plan5.seconds(payload);
14077
14239
  return {
14078
14240
  model: ctx.model.id,
14079
14241
  provider: "fal",
@@ -14081,7 +14243,7 @@ function planUsage(ctx, plan4) {
14081
14243
  unit: "seconds",
14082
14244
  quantity: seconds3,
14083
14245
  durationSeconds: seconds3,
14084
- ...plan4.resolution !== void 0 && { resolution: plan4.resolution }
14246
+ ...plan5.resolution !== void 0 && { resolution: plan5.resolution }
14085
14247
  };
14086
14248
  };
14087
14249
  }
@@ -20240,14 +20402,14 @@ function referenceVideoConformPlan(model, probe) {
20240
20402
  const reasons = [...size?.reasons ?? []];
20241
20403
  if (rate) reasons.push(rate.reason);
20242
20404
  if (overBytes) reasons.push("bytes_over");
20243
- const plan4 = {
20405
+ const plan5 = {
20244
20406
  width: round(width * scale),
20245
20407
  height: round(height * scale),
20246
20408
  reasons
20247
20409
  };
20248
- if (rate) plan4.fps = rate.fps;
20249
- if (maxBytes !== void 0) plan4.maxBytes = maxBytes;
20250
- return plan4;
20410
+ if (rate) plan5.fps = rate.fps;
20411
+ if (maxBytes !== void 0) plan5.maxBytes = maxBytes;
20412
+ return plan5;
20251
20413
  }
20252
20414
  function referenceImageConformPlan(model, probe) {
20253
20415
  const { width: probedWidth, height: probedHeight } = probe;