Skip to content

Releases: useknockout/api

v0.11.0 — /video/remove: video background removal with real alpha

Choose a tag to compare

@TroyJLorents-GH TroyJLorents-GH released this 10 Jul 08:21

Added

  • POST /video/remove — video background removal, frame by frame, using the same BiRefNet engine as images, plus temporal alpha smoothing so the matte doesn't flicker between frames. Async: submit a clip, get a job_id, poll for the result.

    • ProRes 4444 (default) — MOV with a real 10-bit alpha channel. Drops straight into DaVinci Resolve, Premiere Pro, After Effects, and Final Cut. No green chroma key.
    • WebM (VP9 alpha) — transparent video for the web.
    • MP4 + bg_color — composite every frame onto a solid color (linear-light blending, no edge halos).
    • Accepts mp4, mov, avi, webm, mkv. Audio is preserved. smoothing 0–100 tunes the temporal filter.
  • GET /jobs/{job_id} — job status, progress %, and a signed result URL (valid 1 hour). Jobs are visible only to the key that created them.

Billing & limits

Paid tiers only. $0.05 per output second (10s clip = $0.50), billed only when the job succeeds. v1 caps: 30 seconds per clip, 30fps processing, 200MB upload, 1080p frame processing.

Demo

# submit
curl -X POST "https://useknockout--api.modal.run/video/remove" \
  -H "Authorization: Bearer kno_YOUR_KEY" \
  -F "file=@product-clip.mp4" \
  -F "format=prores4444"

# poll
curl "https://useknockout--api.modal.run/jobs/JOB_ID" \
  -H "Authorization: Bearer kno_YOUR_KEY"

Verified end to end on release: 96-frame clip → prores / 4444 / yuva444p12le with a clean alpha matte.

v0.10.0 — /collage: N-photo product collage

Choose a tag to compare

@TroyJLorents-GH TroyJLorents-GH released this 03 Jul 14:59

Added

  • POST /collage — send 2–9 photos, get back an e-commerce hero collage: every photo background-removed and tight-cropped, the main image dominant (~65% of canvas) at a chosen anchor, the rest laid out around it in clean equal cells.

    • main_index — which photo is the hero (default: first).
    • main_positionTL, T, TR, L, C, R, BL, B, BR (default BR).
    • bg_color, aspect (1:1 default, 1600px long side), padding, format/quality/max_dim.
    • Knockout Plus knobs work per-cutout: despill, watermark, preset.

    Layout uses fixed deterministic templates — an L-shape of satellite cells for corner anchors, a single strip for edge anchors, top+bottom rows for center. Predictable output, no bin-packing surprises.

Billing

Paid tiers only (not on free tier or the demo key). Billed at N base-image units — each photo is a full model pass, so a 9-photo collage costs 9× your per-image price. No new meters, no new prices.

Demo

curl -X POST "https://useknockout--api.modal.run/collage" \
  -H "Authorization: Bearer kno_YOUR_KEY" \
  -F "files=@main-product.jpg" \
  -F "files=@accessory-1.jpg" \
  -F "files=@accessory-2.jpg" \
  -F "files=@accessory-3.jpg" \
  -F "main_position=BR" \
  -o collage.jpg

v0.9.0 — Real-ESRGAN default upscale + edge quality overhaul

Choose a tag to compare

@TroyJLorents-GH TroyJLorents-GH released this 02 Jul 23:23

Changed

  • POST /upscale default backend is now realesrgan (was swin2sr). Real-ESRGAN restores plausible detail on low-res and degraded photos — the main thing people upscale — and runs in a single pass (~6s vs minutes of tiled inference). Swin2SR remains available via model=swin2sr for accuracy-sensitive work (product shots, archival): faithful sharpening, no invented detail.
  • /remove output params are now multipart form fields (format, quality, max_dim, width, height, despill, watermark, watermark_opacity, preset) — matching every other endpoint. They were previously query-only, so SDK-style form fields were silently ignored. If you passed these as a query string on /remove, switch to form fields.

Improved

  • Alpha edge quality across all cutout endpoints:
    • Non-square images are padded to a square before the model's fixed 1024px resize — aspect ratio preserved, no more squished thin edges (hair, water reflections).
    • Guided-filter alpha refinement snaps the mask to true image edges.
    • Compositing (/replace-bg, /studio-shot) now blends in linear light — kills the faint dark halo on semi-transparent edges. Implemented with a 256-entry LUT: bit-identical output, 2x faster.
  • Swin2SR tiling rewritten to core-crop with halo context — no seam smear on small images.
  • EXIF orientation is baked in on decode — sideways phone photos are history, on every endpoint.

Added

  • POST /studio-shot: optional width / height output resize, plus enhance + enhance_strength (subtle brightness/saturation lift for ecommerce). Saved presets now honor width/height here too.
  • Shared preset application across /remove, /psd, /replace-bg, /studio-shot — endpoints can no longer drift on which preset keys they honor.
  • eval/ — reproducible quality-eval harness (test cases + runners) used to validate all of the above.

Fixed

  • Demo keys can no longer upscale output past the 512px demo cap via resize params.
  • /psd transparency, Stripe meter dedup, and assorted hardening from this cycle's code review (five verified findings, all fixed and live).

Demo

# Restore a low-res photo (new default backend)
curl -X POST "https://useknockout--api.modal.run/upscale" \
  -H "Authorization: Bearer kno_public_beta_4d7e9f1a3c5b2e8d6a9f7c1b3e5d8a2f" \
  -F "file=@small.jpg" -F "scale=4" \
  -o restored.png

# Faithful mode (previous default)
curl ... -F "model=swin2sr"

v0.8.0 — /inpaint via LaMa

Choose a tag to compare

@TroyJLorents-GH TroyJLorents-GH released this 12 May 21:42

Added

  • POST /inpaint — large-mask inpainting via LaMa (Apache-2.0) through the simple-lama-inpainting wrapper. Resolution-robust, deterministic, no prompts. Three auto-detected input modes:

    1. auto-subject (no mask, no bbox) — BiRefNet derives the subject mask, inverts it. Drop in a photo, get the subject erased.
    2. mask — user-supplied PNG mask (white = inpaint, black = keep).
    3. bbox — send x, y, w, h form fields, server synthesizes a rectangular mask.
  • Optional dilation param (default 8, range 0..32) expands the mask before inpainting to eliminate ghost outlines from tight masks.

How it works

Pipeline preserves full input resolution: dilate mask → downscale to 1024 max-edge → run LaMa → upscale result → composite over the original so unmasked pixels stay byte-identical to input. Same trick used by lama-cleaner.

Demo

curl -X POST "https://useknockout--api.modal.run/inpaint" \
  -H "Authorization: Bearer kno_public_beta_4d7e9f1a3c5b2e8d6a9f7c1b3e5d8a2f" \
  -F "file=@photo.jpg" \
  -o erased.png

That's auto-subject mode — drop in any photo, get the subject removed. To target a specific region:

# bbox
curl ... -F "x=100" -F "y=100" -F "w=300" -F "h=400"

# user-supplied mask
curl ... -F "mask=@my-mask.png"

Response headers

  • x-knockout-model: big-lama
  • x-knockout-mode: auto-subject | mask | bbox
  • x-knockout-warning: <text> when mask covers >50% of the image (LaMa quality degrades on huge masks)

Endpoint count

23 endpoints in one image API (was 22).

Full changelog: v0.7.1...v0.8.0

v0.7.1 — /silhouette

Choose a tag to compare

@TroyJLorents-GH TroyJLorents-GH released this 10 May 17:53

Added

  • POST /silhouette — two-tone silhouette portrait. Subject filled with one solid color, background filled with another. Apple Music / Spotify avatar style. Use for stylized profile pictures, podcast cover art, anonymized portraits, branding placeholders.

Why a patch bump

No new model, no new dependency. Reuses the existing BiRefNet mask path then composites two flat colors. ~30 lines of glue around what was already loaded.

Endpoint count

22 endpoints in one image API (was 21).

Demo

curl -X POST "https://useknockout--api.modal.run/silhouette" \
  -H "Authorization: Bearer kno_public_beta_4d7e9f1a3c5b2e8d6a9f7c1b3e5d8a2f" \
  -F "file=@portrait.jpg" \
  -F "subject_color=#7C3AED" \
  -F "bg_color=#FFFFFF" \
  -F "format=png" \
  -o silhouette.png

Full changelog: v0.7.0...v0.7.1

v0.7.0 — /colorize via DDColor

Choose a tag to compare

@TroyJLorents-GH TroyJLorents-GH released this 08 May 19:55

Added

  • POST /colorize — diffusion-free image colorization via DDColor (Apache-2.0). ConvNeXt-Large backbone predicts ab channels in LAB color space.
  • Single feed-forward inference, ~500 ms warm on L4 once the container is hot. Works on grayscale or color input (color images are converted to grayscale internally).
  • 21 endpoints total in one image API.

Updated

  • API version bumped 0.6.0 → 0.7.0.
  • Root response (GET /) endpoint listing now includes POST /colorize.

Internal

ModelScope's pipeline base imports a dependency chain that requires datasets, oss2, addict, simplejson, and sortedcontainers — all are hard deps but none are in modelscope's install_requires. Pinned explicitly in the image build to prevent container crash-loops at module import.

DDColor weights (~870 MB) are baked into the Modal image via snapshot_download at build time so cold starts skip the network hop.

Demo

Photo in. Get color out. The model has no ground truth — it predicts plausible color from luminance and spatial context. Skin tones, blue eyes, navy ties, brown hair, blue skies, green foliage all come back believably even on photos the model has never seen.

curl -X POST "https://useknockout--api.modal.run/colorize" \
  -H "Authorization: Bearer kno_public_beta_4d7e9f1a3c5b2e8d6a9f7c1b3e5d8a2f" \
  -F "file=@your-bw-photo.jpg" \
  -F "format=png" \
  -o colorized.png

Notes

  • Triggered by #1 (DiffDIS suggestion from @4external). DiffDIS opt-in is on the v0.8 list — likely as model=diffdis on /remove since the diffusion latency profile doesn't fit the warm-200ms default.
  • License chain: useknockout (MIT), DDColor (Apache-2.0), ModelScope (Apache-2.0). All commercial-friendly.

Full changelog: v0.6.0...v0.7.0

v0.6.0 — Swin2SR default upscale

Choose a tag to compare

@TroyJLorents-GH TroyJLorents-GH released this 30 Apr 09:40

What's new

/upscale now defaults to Swin2SR — cleaner skin texture and natural detail vs the previous Real-ESRGAN default, which produced a plastic look on photographic content.

Models

  • Swin2SR x4: caidas/swin2SR-realworld-sr-x4-64-bsrgan-psnr
  • Swin2SR x2: caidas/swin2SR-classical-sr-x2-64
  • Real-ESRGAN kept as opt-in (model=realesrgan) for graphics/illustration

Inference

  • Tiled inference (256px tile, 32px overlap) with triangular blend window — no seams
  • fp16 GPU on L4
  • Latency: 13–17s warm at x4

API change

POST /upscale
  image: file
  scale: 2 | 4
  model: swin2sr (default) | realesrgan
  face_enhance: bool

SDKs (all updated)

  • @useknockout/node@0.0.9
  • @useknockout/react@0.0.5
  • @useknockout/cli@0.0.7
  • useknockout==0.0.4 (PyPI)

All four expose the new model param on upscale().

Live

https://useknockout--api.modal.run

v0.5.1 — quality polish

Choose a tag to compare

@TroyJLorents-GH TroyJLorents-GH released this 29 Apr 01:23

Fixes

  • Hair spill in /remove — switched to closed-form matting (estimate_foreground_cf), raised matting
    downscale cap from 1024→2048. Eliminates background color bleed in semi-transparent hair regions.
  • Face-restore bg bleed/face-restore now preserves original background by default (no skin-tone
    smear into bg around face edges). Opt back into Real-ESRGAN bg upscaling with bg_enhance=true.

Known limits

  • Real-ESRGAN /upscale is decent on products + scenery, painterly on faces. Use /face-restore for portraits,
    or chain /upscale/face-restore.
  • v0.6.0 will swap upscaler to SwinIR/HAT for SOTA photo quality.

Bumped

  • API: 0.5.0 → 0.5.1

SDKs (all v0.5.0+ parity)

SDK Install Latest
Node / TypeScript npm install @useknockout/node npm
React hooks npm install @useknockout/react npm
CLI (zero-install) npx @useknockout/cli remove photo.jpg npm
Python (sync + async) pip install useknockout PyPI

Source repos: node · react · cli · python