GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com โ€” GitHub - useknockout/api: State-of-the-art background removal API for images and video. BiRefNet on Modal GPUs, ~200ms per image. 26 endpoints: cutouts, masks, PSD export, upscale, face restore, inpaint, collage, studio shots, video with ProRes 4444 alpha. MIT, self-hostable, 10x cheaper than remove.bg.

BranchesTags
Open more actions menu

Latest commit

 

History

69 Commits
69 Commits

Folders and files

NameName
Last commit message
Last commit date
.claude/skills/release
.claude/skills/release
 
 
.github
.github
 
 
docs
docs
 
 
eval
eval
 
 
examples
examples
 
 
scripts
scripts
 
 
v0.5-test-outputs
v0.5-test-outputs
 
 
.env.example
.env.example
 
 
.gitignore
.gitignore
 
 
APIREFERENCE.md
APIREFERENCE.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
SELFHOSTING.md
SELFHOSTING.md
 
 
SERVICES.md
SERVICES.md
 
 
TECHSTACK.md
TECHSTACK.md
 
 
deploy.sh
deploy.sh
 
 
despill-pro-test.png
despill-pro-test.png
 
 
main.py
main.py
 
 
requirements.txt
requirements.txt
 
 

Repository files navigation

๐ŸฅŠ useknockout

Open in Spaces

State-of-the-art background removal API for images and video โ€” open source, self-hostable, 10ร— cheaper than remove.bg.

MIT License npm version npm downloads GitHub stars Powered by Modal Model: BiRefNet Python TypeScript

Playground ยท Docs ยท Quick Start ยท API Reference ยท Self-hosting


useknockout before/after โ€” background removal demo

Drop an image in. Get a transparent PNG out. ~200ms per call.

A production-grade background removal API powered by BiRefNet โ€” the current SOTA on DIS5K, HRSOD, and COD benchmarks. Served on Modal's GPU infrastructure with scale-to-zero economics.

  • SOTA quality โ€” matches or beats remove.bg, Photoroom, and Pixelcut on hair, fur, fine detail
  • Fast โ€” ~200ms per image on a warm L4 GPU
  • Cheap โ€” $0.02 per image pay-as-you-go (10x cheaper than remove.bg PAYG)
  • Video too โ€” async video background removal with ProRes 4444 alpha output ($0.10/output-second)
  • 28 documented endpoints โ€” cutouts, masks, PSD export, upscale, face restore, inpaint, collage, studio shots, video, and more
  • MIT licensed โ€” model weights and code, commercial use OK

Works alpha-preserving (PNG with transparent bg) OR opaque (solid color / remote image as new bg).


Table of contents

  • Demo
  • Quick start
  • API reference
  • Benchmarks
  • Architecture
  • Pricing
  • License

Demo

Try it in your browser, no signup: useknockout.com/playground

Drag an image in, pick an operation, get the result back. It runs the live API. Also available as a Hugging Face Space.

Full docs (endpoints, SDKs): useknockout.com/docs

Base URL (for code): https://useknockout--api.modal.run

Input โ†’ Output:

Original After
Complex hair Clean wisps, no halo
Fur / pet photos Soft edges preserved
Product shots Sharp, clean cutout
Low-contrast subjects Accurate separation

Quick start

Get your key โ€” 30 images/month free, no card

โ†’ useknockout.com/signin

Sign in, click to reveal your key on the dashboard, and paste it below. No credit card, ready in seconds.

  • 10 full-resolution images/month free, forever โ€” no card needed
  • Pay-as-you-go at $0.02/image unlocks all endpoints โ€” AI upscale, face restore, colorize, e-commerce presets, batch, video, and more (10ร— cheaper than remove.bg's $0.20)
  • $0.003/image at 100k+/month for volume
export KNOCKOUT_TOKEN=kno_live_your_key_here

The examples below assume $KNOCKOUT_TOKEN is set.

Hit the API in 3 seconds

curl -X POST "https://useknockout--api.modal.run/remove" \
  -H "Authorization: Bearer $KNOCKOUT_TOKEN" \
  -F "[email protected]" \
  -o out.png

You get a PNG with a transparent alpha channel. Done.

With a URL instead of a file

curl -X POST "https://useknockout--api.modal.run/remove-url" \
  -H "Authorization: Bearer $KNOCKOUT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/cat.jpg"}' \
  -o out.png

Replace the background with a color or remote image

# solid color background
curl -X POST "https://useknockout--api.modal.run/replace-bg" \
  -H "Authorization: Bearer $KNOCKOUT_TOKEN" \
  -F "[email protected]" \
  -F "bg_color=#FF5733" \
  -F "format=jpg" \
  -o out.jpg

# use a remote image as the new background
curl -X POST "https://useknockout--api.modal.run/replace-bg" \
  -H "Authorization: Bearer $KNOCKOUT_TOKEN" \
  -F "[email protected]" \
  -F "bg_url=https://example.com/mountains.jpg" \
  -o out.png

Batch โ€” process up to 10 images in one call

# multipart batch
curl -X POST "https://useknockout--api.modal.run/remove-batch?format=png" \
  -H "Authorization: Bearer $KNOCKOUT_TOKEN" \
  -F "[email protected]" -F "[email protected]" -F "[email protected]"

# URL batch โ€” JSON body
curl -X POST "https://useknockout--api.modal.run/remove-batch-url" \
  -H "Authorization: Bearer $KNOCKOUT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"urls":["https://a.jpg","https://b.jpg"], "format":"png"}'

Both return JSON: { "count": N, "format": "png", "results": [{ "success": true, "data_base64": "..." }, ...] }.

More presets (v0.3.0)

# Sticker โ€” cutout + thick white outline (WhatsApp / iMessage sticker style)
curl -X POST "https://useknockout--api.modal.run/sticker" \
  -H "Authorization: Bearer $KNOCKOUT_TOKEN" \
  -F "[email protected]" -F "stroke_width=24" -o sticker.png

# Smart crop โ€” tight bounding box around subject
curl -X POST "https://useknockout--api.modal.run/smart-crop" \
  -H "Authorization: Bearer $KNOCKOUT_TOKEN" \
  -F "[email protected]" -F "padding=32" -o cropped.png

# Studio shot โ€” e-commerce preset (white bg + shadow + centered, 1:1 aspect)
curl -X POST "https://useknockout--api.modal.run/studio-shot" \
  -H "Authorization: Bearer $KNOCKOUT_TOKEN" \
  -F "[email protected]" -F "aspect=1:1" -F "format=jpg" -o studio.jpg

# Shadow โ€” subject composited onto new bg with a drop shadow
curl -X POST "https://useknockout--api.modal.run/shadow" \
  -H "Authorization: Bearer $KNOCKOUT_TOKEN" \
  -F "[email protected]" -F "bg_color=#F3F4F6" -o shadow.png

# Compare โ€” before/after side-by-side for marketing/social
curl -X POST "https://useknockout--api.modal.run/compare" \
  -H "Authorization: Bearer $KNOCKOUT_TOKEN" \
  -F "[email protected]" -o compare.png

# Mask โ€” just the black/white mask, for your own pipeline
curl -X POST "https://useknockout--api.modal.run/mask" \
  -H "Authorization: Bearer $KNOCKOUT_TOKEN" \
  -F "[email protected]" -o mask.png

# Outline โ€” subject on transparent bg with a thin outline
curl -X POST "https://useknockout--api.modal.run/outline" \
  -H "Authorization: Bearer $KNOCKOUT_TOKEN" \
  -F "[email protected]" -F "outline_color=#000000" -F "outline_width=4" -o outline.png

New in v0.9โ€“v0.11 โ€” upscale, PSD, collage, video

# AI upscale โ€” Real-ESRGAN super-resolution (2x/4x)
curl -X POST "https://useknockout--api.modal.run/upscale" \
  -H "Authorization: Bearer $KNOCKOUT_TOKEN" \
  -F "[email protected]" -F "scale=4" -o upscaled.png

# PSD export โ€” layered Photoshop file (subject + background layers)
curl -X POST "https://useknockout--api.modal.run/psd" \
  -H "Authorization: Bearer $KNOCKOUT_TOKEN" \
  -F "[email protected]" -o out.psd

# Collage โ€” 2-9 photos, each cut out and laid out around a hero image
curl -X POST "https://useknockout--api.modal.run/collage" \
  -H "Authorization: Bearer $KNOCKOUT_TOKEN" \
  -F "[email protected]" -F "[email protected]" -F "[email protected]" \
  -F "main_position=BR" -F "aspect=1:1" -o collage.jpg

Video background removal (async)

Removes the background from a clip (up to 15s) and returns ProRes 4444 with a real alpha channel โ€” or WebM/MP4 composited onto a color, image, or blur.

# submit the job
curl -X POST "https://useknockout--api.modal.run/video/remove" \
  -H "Authorization: Bearer $KNOCKOUT_TOKEN" \
  -F "[email protected]" -F "format=prores4444"
# -> {"job_id": "..."}

# poll until done, then download
curl "https://useknockout--api.modal.run/jobs/JOB_ID" \
  -H "Authorization: Bearer $KNOCKOUT_TOKEN"

Billed at $0.10 per output second ($0.08 on Knockout Plus). Paid tiers only.

Health check

curl https://useknockout--api.modal.run/health
# {"status":"ok","model":"ZhengPeng7/BiRefNet"}

API reference

The full endpoint-by-endpoint reference for all 28 documented endpoints, plus client examples for Python, Node.js, Go, and browser/TypeScript, lives in a dedicated doc:

โ†’ API reference & client examples


Benchmarks

Measured on Modal gpu="L4", Python 3.11, torch 2.4, batch size 1, 1024ร—1024 model input.

Image size Warm latency (p50) Cold start Output format
512ร—512 180 ms ~25 s PNG / WebP
1024ร—1024 220 ms ~25 s PNG / WebP
2048ร—2048 310 ms ~25 s PNG / WebP
4000ร—4000 520 ms ~25 s PNG / WebP

Quality vs. competitors

BiRefNet (the model we serve) consistently ranks first or second on public benchmarks:

  • DIS5K (Dichotomous Image Segmentation): #1 F-measure as of 2024
  • HRSOD (High-Resolution Salient Object Detection): #1 MAE
  • COD10K (Camouflaged Object Detection): #1 or #2 depending on metric

See the BiRefNet paper and leaderboards for details.


Self-hosting

Run your own instance on Modal in one command. Full prerequisites, deploy steps, and tuning guide:

โ†’ Self-hosting guide


Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”      HTTPS       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Client   โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถ โ”‚  Modal ASGI (FastAPI)     โ”‚
โ”‚ (any lang) โ”‚                  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                  โ”‚  โ”‚ Auth (bearer)       โ”‚  โ”‚
                                โ”‚  โ”‚ Validation          โ”‚  โ”‚
                                โ”‚  โ”‚ Image decode (PIL)  โ”‚  โ”‚
                                โ”‚  โ”‚ BiRefNet on L4 GPU  โ”‚  โ”‚
                                โ”‚  โ”‚ Encode (PNG/WebP)   โ”‚  โ”‚
                                โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
                                โ”‚  Scale-to-zero, auto-HTTPS โ”‚
                                โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  • One file (main.py), single Modal class, 28 documented endpoints + auto-generated docs
  • Weights baked into image at build time โ€” cold starts are just image pull + GPU model load (~25 s)
  • FastAPI handles multipart, JSON, CORS, OpenAPI schema generation

Pricing

Sign up at useknockout.com/signin โ€” 30 images/month free, no card.

Tier Price Best for
Free 30 images / month, no card Personal, eval, open source
Pay-as-you-go $0.02 / image Side projects, early startups
Knockout Plus $10 / month, 250 images included, then $0.02 Regular use + premium features
Volume $0.003 / image at 100k+/mo Production workloads
Enterprise Custom, private endpoints Compliance, BYO-cloud

Add-ons: PSD export $0.10/image ยท Video $0.10 per output second ($0.08 on Plus).

For reference โ€” the same image on remove.bg is $0.20 at their PAYG rate.

Free tier includes the core background-removal endpoints:

/remove ยท /remove-url ยท /mask ยท /compare ยท /preview

Paid endpoints (any paid tier) add edits, AI enhancement, e-commerce presets, batch, and video:

/replace-bg ยท /smart-crop ยท /outline ยท /sticker ยท /shadow ยท /silhouette ยท /studio-shot ยท /headshot ยท /collage ยท /upscale ยท /face-restore ยท /colorize ยท /inpaint ยท /psd ยท /remove-batch ยท /remove-batch-url ยท /video/remove

Knockout Plus additionally unlocks layered PSD at a flat rate, edge despill, saved presets (/presets), custom watermarks, resizing, and compression control across all endpoints.

Try the API in your browser with no key at the playground. /estimate (pricing calculator) is free for everyone.


Contact

  • GitHub Issues: https://github.com/useknockout/api/issues
  • Twitter / X: @useknockout

License

MIT License โ€” see LICENSE. Model weights (BiRefNet) are also MIT. Commercial use is allowed for both.


Built in a few hours because someone said it couldn't be done.

About

State-of-the-art background removal API for images and video. BiRefNet on Modal GPUs, ~200ms per image. 26 endpoints: cutouts, masks, PSD export, upscale, face restore, inpaint, collage, studio shots, video with ProRes 4444 alpha. MIT, self-hostable, 10x cheaper than remove.bg.

useknockout.com/

Topics

ai-background-removalalpha-mattingbackground-removalbackground-removal-open-sourcebackground-removal-toolkitbackground-removercomputer-visioncomputer-vision-aicomputer-vision-apicomputer-vision-toolsdeveloper-toolsface-restorationimage-background-removalimage-editingimage-mattingimage-processingopen-source-background-removalpython-background-removalremove-backgroundsdk

Resources

Readme
MIT license

Contributing

Contributing
Activity
Custom properties

Stars

58 stars

Watchers

0 watching

Forks

3 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 โ€” GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800ร—600. No cookies required.