@shop-os/modelkit 0.12.0 → 0.14.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
@@ -6711,6 +6711,33 @@ var VIDEO_TOOL_MODELS = [
6711
6711
  description: "Topaz Hyperion 2.5 SDR to HDR: a 10-bit HDR master in H.265 (HDR10) or ProRes 422 HQ, at the source's size and frame rate."
6712
6712
  }
6713
6713
  },
6714
+ {
6715
+ // https://fal.ai/models/fal-ai/depth-anything-video/api: greyscale depth (white = near)
6716
+ // at the source's frame rate, short edge capped at 1080 px (a 2160x3840 source came
6717
+ // back 1080x1920), at most 2400 frames; one fal price of $0.04 per second for every
6718
+ // model size. The adapter always sends VDA-Small, the only Apache-2.0 size. 100 s is
6719
+ // 2400 frames at 24 fps; the frame check refuses faster clips sooner.
6720
+ id: "depth-anything-video",
6721
+ aliases: [],
6722
+ label: "Video Depth Anything",
6723
+ type: "video-tool",
6724
+ adapter: "fal",
6725
+ providerModelId: "fal-ai/depth-anything-video",
6726
+ lifecycle: "active",
6727
+ exposure: ["cowork"],
6728
+ constraints: {
6729
+ supports: [],
6730
+ sourceVideoSeconds: { max: 100 },
6731
+ tool: { kind: "depth", maxOutputShortEdge: 1080, maxOutputFrames: 2400 }
6732
+ },
6733
+ defaults: {},
6734
+ usage: SECONDS_USAGE,
6735
+ pricingKind: "video_per_second",
6736
+ display: {
6737
+ provider: "depth-anything",
6738
+ description: "Video Depth Anything: a greyscale depth map of the clip (near is white), frame for frame, for motion and camera control."
6739
+ }
6740
+ },
6714
6741
  {
6715
6742
  id: "flux-video-upscale-precise",
6716
6743
  aliases: [],
@@ -7928,7 +7955,7 @@ var LanguageOptionSchema = import_zod3.z.looseObject({
7928
7955
  name: import_zod3.z.string().min(1)
7929
7956
  });
7930
7957
  var VideoToolConstraintsSchema = import_zod3.z.looseObject({
7931
- kind: import_zod3.z.enum(["upscale", "interpolate", "hdr", "bg-remove", "subtitles"]),
7958
+ kind: import_zod3.z.enum(["upscale", "interpolate", "hdr", "bg-remove", "subtitles", "depth"]),
7932
7959
  upscaleFactor: RangeSchema.optional(),
7933
7960
  maxOutputLongEdge: import_zod3.z.number().positive().optional(),
7934
7961
  prompt: import_zod3.z.boolean().optional(),
@@ -9698,7 +9725,7 @@ function checkedQueueUrl(ctx, url, what) {
9698
9725
  var import_zod12 = require("zod");
9699
9726
  var RangeSchema2 = import_zod12.z.object({ min: import_zod12.z.number(), max: import_zod12.z.number() });
9700
9727
  var ToolSchema = import_zod12.z.object({
9701
- kind: import_zod12.z.enum(["upscale", "interpolate", "hdr", "bg-remove", "subtitles"]),
9728
+ kind: import_zod12.z.enum(["upscale", "interpolate", "hdr", "bg-remove", "subtitles", "depth"]),
9702
9729
  upscaleFactor: RangeSchema2.optional(),
9703
9730
  maxOutputLongEdge: import_zod12.z.number().positive().optional(),
9704
9731
  prompt: import_zod12.z.boolean().optional(),
@@ -9836,6 +9863,25 @@ function planVideoTool(row2, req) {
9836
9863
  }
9837
9864
  };
9838
9865
  }
9866
+ if (tool.kind === "depth") {
9867
+ const limit = tool.maxOutputFrames;
9868
+ if (limit !== void 0) {
9869
+ if (fps === void 0) return fail("The source video's frame rate is required");
9870
+ if (durationSeconds * fps > limit) {
9871
+ return fail(`${row2.label} renders up to ${limit} frames (${seconds(limit, fps)}).`);
9872
+ }
9873
+ }
9874
+ const out2 = shrinkToShortEdge(width, height, tool.maxOutputShortEdge);
9875
+ return {
9876
+ ok: true,
9877
+ output: {
9878
+ ...base,
9879
+ ...out2,
9880
+ resolution: resolutionTier(out2.width, out2.height),
9881
+ format: "h264"
9882
+ }
9883
+ };
9884
+ }
9839
9885
  if (tool.kind === "subtitles") {
9840
9886
  const resolution = resolutionTier(width, height);
9841
9887
  const problem = subtitleProblem(
@@ -9932,12 +9978,15 @@ function toolInput(ctx, req, output) {
9932
9978
  input["output_codec"] = "vp9";
9933
9979
  } else if (tool?.kind === "subtitles") {
9934
9980
  Object.assign(input, subtitleFields(tool, req.subtitles));
9981
+ } else if (tool?.kind === "depth") {
9982
+ input["model"] = "VDA-Small";
9983
+ input["colormap"] = "grayscale";
9935
9984
  } else if (output.format === "exr") {
9936
9985
  const prompt = tool?.prompt === true ? req.prompt?.trim() : void 0;
9937
9986
  input["prompt"] = prompt || EXR_DEFAULT_PROMPT;
9938
9987
  if (output.fps !== void 0) input["frames_per_second"] = output.fps;
9939
9988
  if (output.frames !== void 0) input["num_frames"] = output.frames;
9940
- } else {
9989
+ } else if (tool?.kind === "hdr") {
9941
9990
  input["output_format"] = output.format === "prores" ? "prores" : "mp4";
9942
9991
  }
9943
9992
  return input;
@@ -18476,12 +18525,12 @@ function keysFromEnv(env, prefix = "") {
18476
18525
  set("moonshot", pick2("MOONSHOT_API_KEY"));
18477
18526
  set("minimax", pick2("MINIMAX_API_KEY"));
18478
18527
  set("ark", pick2("BYTEDANCE_API_KEY"));
18479
- set("fal", pick2("FAL_KEY", "FAL_API_KEY"));
18528
+ set("fal", pick2("FAL_KEY"));
18480
18529
  set("replicate", pick2("REPLICATE_API_TOKEN"));
18481
18530
  set("prodia", pick2("PRODIA_TOKEN"));
18482
18531
  set("higgsfield", pick2("HIGGSFIELD_API_KEY"));
18483
18532
  set("higgsfieldSecret", pick2("HIGGSFIELD_API_SECRET"));
18484
- set("luma", pick2("LUMA_API_KEY", "LUMA_AGENTS_API_KEY"));
18533
+ set("luma", pick2("LUMA_API_KEY"));
18485
18534
  set("fish", pick2("FISH_AUDIO_API_KEY"));
18486
18535
  set("elevenlabs", pick2("ELEVENLABS_API_KEY"));
18487
18536
  set("cloudflare", pick2("CF_AIG_TOKEN"));