@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.d.cts CHANGED
@@ -132,7 +132,7 @@ interface Model3dConstraints {
132
132
  };
133
133
  }
134
134
  /** What a `video-tool` row does to its source clip. */
135
- type VideoToolKind = "upscale" | "interpolate" | "hdr" | "bg-remove" | "subtitles";
135
+ type VideoToolKind = "upscale" | "interpolate" | "hdr" | "bg-remove" | "subtitles" | "depth";
136
136
  /** Container/codec a video-tool row can write. */
137
137
  /** `exr`: a ZIP of 16-bit EXR frames in `VideoToolResult.frames`, with an MP4 preview as `video`. */
138
138
  type VideoToolOutputFormat = "h265" | "prores" | "exr";
@@ -1351,6 +1351,7 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
1351
1351
  interpolate: "interpolate";
1352
1352
  hdr: "hdr";
1353
1353
  subtitles: "subtitles";
1354
+ depth: "depth";
1354
1355
  }>;
1355
1356
  upscaleFactor: z.ZodOptional<z.ZodObject<{
1356
1357
  min: z.ZodNumber;
package/dist/index.d.ts CHANGED
@@ -132,7 +132,7 @@ interface Model3dConstraints {
132
132
  };
133
133
  }
134
134
  /** What a `video-tool` row does to its source clip. */
135
- type VideoToolKind = "upscale" | "interpolate" | "hdr" | "bg-remove" | "subtitles";
135
+ type VideoToolKind = "upscale" | "interpolate" | "hdr" | "bg-remove" | "subtitles" | "depth";
136
136
  /** Container/codec a video-tool row can write. */
137
137
  /** `exr`: a ZIP of 16-bit EXR frames in `VideoToolResult.frames`, with an MP4 preview as `video`. */
138
138
  type VideoToolOutputFormat = "h265" | "prores" | "exr";
@@ -1351,6 +1351,7 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
1351
1351
  interpolate: "interpolate";
1352
1352
  hdr: "hdr";
1353
1353
  subtitles: "subtitles";
1354
+ depth: "depth";
1354
1355
  }>;
1355
1356
  upscaleFactor: z.ZodOptional<z.ZodObject<{
1356
1357
  min: z.ZodNumber;
package/dist/index.js CHANGED
@@ -6569,6 +6569,33 @@ var VIDEO_TOOL_MODELS = [
6569
6569
  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."
6570
6570
  }
6571
6571
  },
6572
+ {
6573
+ // https://fal.ai/models/fal-ai/depth-anything-video/api: greyscale depth (white = near)
6574
+ // at the source's frame rate, short edge capped at 1080 px (a 2160x3840 source came
6575
+ // back 1080x1920), at most 2400 frames; one fal price of $0.04 per second for every
6576
+ // model size. The adapter always sends VDA-Small, the only Apache-2.0 size. 100 s is
6577
+ // 2400 frames at 24 fps; the frame check refuses faster clips sooner.
6578
+ id: "depth-anything-video",
6579
+ aliases: [],
6580
+ label: "Video Depth Anything",
6581
+ type: "video-tool",
6582
+ adapter: "fal",
6583
+ providerModelId: "fal-ai/depth-anything-video",
6584
+ lifecycle: "active",
6585
+ exposure: ["cowork"],
6586
+ constraints: {
6587
+ supports: [],
6588
+ sourceVideoSeconds: { max: 100 },
6589
+ tool: { kind: "depth", maxOutputShortEdge: 1080, maxOutputFrames: 2400 }
6590
+ },
6591
+ defaults: {},
6592
+ usage: SECONDS_USAGE,
6593
+ pricingKind: "video_per_second",
6594
+ display: {
6595
+ provider: "depth-anything",
6596
+ description: "Video Depth Anything: a greyscale depth map of the clip (near is white), frame for frame, for motion and camera control."
6597
+ }
6598
+ },
6572
6599
  {
6573
6600
  id: "flux-video-upscale-precise",
6574
6601
  aliases: [],
@@ -7786,7 +7813,7 @@ var LanguageOptionSchema = z3.looseObject({
7786
7813
  name: z3.string().min(1)
7787
7814
  });
7788
7815
  var VideoToolConstraintsSchema = z3.looseObject({
7789
- kind: z3.enum(["upscale", "interpolate", "hdr", "bg-remove", "subtitles"]),
7816
+ kind: z3.enum(["upscale", "interpolate", "hdr", "bg-remove", "subtitles", "depth"]),
7790
7817
  upscaleFactor: RangeSchema.optional(),
7791
7818
  maxOutputLongEdge: z3.number().positive().optional(),
7792
7819
  prompt: z3.boolean().optional(),
@@ -9556,7 +9583,7 @@ function checkedQueueUrl(ctx, url, what) {
9556
9583
  import { z as z12 } from "zod";
9557
9584
  var RangeSchema2 = z12.object({ min: z12.number(), max: z12.number() });
9558
9585
  var ToolSchema = z12.object({
9559
- kind: z12.enum(["upscale", "interpolate", "hdr", "bg-remove", "subtitles"]),
9586
+ kind: z12.enum(["upscale", "interpolate", "hdr", "bg-remove", "subtitles", "depth"]),
9560
9587
  upscaleFactor: RangeSchema2.optional(),
9561
9588
  maxOutputLongEdge: z12.number().positive().optional(),
9562
9589
  prompt: z12.boolean().optional(),
@@ -9694,6 +9721,25 @@ function planVideoTool(row2, req) {
9694
9721
  }
9695
9722
  };
9696
9723
  }
9724
+ if (tool.kind === "depth") {
9725
+ const limit = tool.maxOutputFrames;
9726
+ if (limit !== void 0) {
9727
+ if (fps === void 0) return fail("The source video's frame rate is required");
9728
+ if (durationSeconds * fps > limit) {
9729
+ return fail(`${row2.label} renders up to ${limit} frames (${seconds(limit, fps)}).`);
9730
+ }
9731
+ }
9732
+ const out2 = shrinkToShortEdge(width, height, tool.maxOutputShortEdge);
9733
+ return {
9734
+ ok: true,
9735
+ output: {
9736
+ ...base,
9737
+ ...out2,
9738
+ resolution: resolutionTier(out2.width, out2.height),
9739
+ format: "h264"
9740
+ }
9741
+ };
9742
+ }
9697
9743
  if (tool.kind === "subtitles") {
9698
9744
  const resolution = resolutionTier(width, height);
9699
9745
  const problem = subtitleProblem(
@@ -9790,12 +9836,15 @@ function toolInput(ctx, req, output) {
9790
9836
  input["output_codec"] = "vp9";
9791
9837
  } else if (tool?.kind === "subtitles") {
9792
9838
  Object.assign(input, subtitleFields(tool, req.subtitles));
9839
+ } else if (tool?.kind === "depth") {
9840
+ input["model"] = "VDA-Small";
9841
+ input["colormap"] = "grayscale";
9793
9842
  } else if (output.format === "exr") {
9794
9843
  const prompt = tool?.prompt === true ? req.prompt?.trim() : void 0;
9795
9844
  input["prompt"] = prompt || EXR_DEFAULT_PROMPT;
9796
9845
  if (output.fps !== void 0) input["frames_per_second"] = output.fps;
9797
9846
  if (output.frames !== void 0) input["num_frames"] = output.frames;
9798
- } else {
9847
+ } else if (tool?.kind === "hdr") {
9799
9848
  input["output_format"] = output.format === "prores" ? "prores" : "mp4";
9800
9849
  }
9801
9850
  return input;
@@ -18336,12 +18385,12 @@ function keysFromEnv(env, prefix = "") {
18336
18385
  set("moonshot", pick2("MOONSHOT_API_KEY"));
18337
18386
  set("minimax", pick2("MINIMAX_API_KEY"));
18338
18387
  set("ark", pick2("BYTEDANCE_API_KEY"));
18339
- set("fal", pick2("FAL_KEY", "FAL_API_KEY"));
18388
+ set("fal", pick2("FAL_KEY"));
18340
18389
  set("replicate", pick2("REPLICATE_API_TOKEN"));
18341
18390
  set("prodia", pick2("PRODIA_TOKEN"));
18342
18391
  set("higgsfield", pick2("HIGGSFIELD_API_KEY"));
18343
18392
  set("higgsfieldSecret", pick2("HIGGSFIELD_API_SECRET"));
18344
- set("luma", pick2("LUMA_API_KEY", "LUMA_AGENTS_API_KEY"));
18393
+ set("luma", pick2("LUMA_API_KEY"));
18345
18394
  set("fish", pick2("FISH_AUDIO_API_KEY"));
18346
18395
  set("elevenlabs", pick2("ELEVENLABS_API_KEY"));
18347
18396
  set("cloudflare", pick2("CF_AIG_TOKEN"));