API

rembg vs a Background Removal API: Cost, Quality and Ops — and When to Use Each

September 6, 20267 min readBy BG Clear Editorial

rembg is the answer to "free background removal in Python" on every forum, and it deserves it: one pip install, one function, decent results. It is also the reason a lot of teams end up with a GPU box nobody wants to maintain. This post is the comparison we wish existed before choosing: what rembg is, what it costs to run properly, where its output differs from a hosted API, and a decision rule that does not pretend one option is always right. Disclosure: bgclear sells the API side of this comparison.

In this guide

What rembg is

rembg is an open-source Python library (MIT licence, by Daniel Gatis) that wraps image-segmentation models behind a single call. It ships as a CLI and a library, runs the models through ONNX Runtime, and downloads model weights on first use. The default model has long been U²-Net, with variants for people, anime and a lighter "p" build; recent releases add newer general-purpose models such as ISNet and BiRefNet variants — check the current model list, it changes.

pip install "rembg[cpu]"        # or rembg[gpu] with a CUDA-capable onnxruntime
rembg i photo.jpg photo-no-bg.png
rembg p in-folder/ out-folder/  # batch a directory
from rembg import remove, new_session

session = new_session("isnet-general-use")   # pick a model; downloads ~100–200 MB once
with open("photo.jpg", "rb") as f:
    cutout = remove(f.read(), session=session)
open("photo-no-bg.png", "wb").write(cutout)

That is genuinely all it takes on a laptop. The rest of this post is about everything that is not on a laptop.

What self-hosting actually costs

Compute: on CPU, a 12-megapixel photo takes several seconds per image with the standard models (longer with the larger ones); a modest GPU brings that under a second but adds a CUDA-capable runtime, driver pinning and a machine that costs money whether it is busy or not. Memory: each loaded model holds hundreds of megabytes; running two models or several workers multiplies it.

Operations: model downloads at deploy time (cache them or your cold start pulls 170 MB), timeouts for oversized images, a queue so a burst does not take the service down, health checks, and upgrades when a new model lands. None of it is hard; all of it is a standing cost in someone's week.

Money, roughly: a small always-on GPU instance runs in the tens of dollars a month before you have processed a single image; a CPU-only box is cheaper but slower. Against that, an API charges per image — bgclear is $9 for 100, $39 for 500, $129 for 2,000 (about $0.065 at the top pack), no subscription, previews free. The crossover depends entirely on utilisation: a box that processes 50,000 images a month is a bargain; the same box for 800 images a month is the most expensive way to get 800 cutouts.

Where quality differs

On clean product shots and portraits against contrasting backgrounds, rembg's general models are good and the difference from commercial APIs is small. The gaps show on hair and fur, semi-transparent edges (glass, veils, smoke), low-contrast subjects (white product on white), and busy backgrounds — the cases where commercial providers keep retraining and open models move more slowly. Model choice matters more than people expect: the human-segmentation model on a person and ISNet or BiRefNet on products give a noticeably different result from the default.

We have not published a head-to-head benchmark, and you should not trust anyone's. Take your 20 hardest images, run them through rembg with two or three models and through an API's free tier (bgclear's size=preview is free and unlimited), and look at the edges at 200%. That is a one-hour test and it settles the argument for your images.

The decision rule

Choose rembg when: images cannot leave your infrastructure (privacy, regulation, air-gapped), you already run GPUs with spare capacity, volume is very high and steady, or it is a hobby project where your time is free. Choose an API when: you have no GPU and no appetite for one, volume is bursty or below a few thousand images a month, the workload runs in serverless, mobile or no-code environments that cannot ship a model, or edge quality on hair and glass is the product.

A common hybrid: rembg on a developer's machine for experiments and test fixtures, an API in production so the service has no model to babysit. The code difference is small enough that a feature flag covers it:

import os, requests
from rembg import remove

def cutout(data: bytes) -> bytes:
    if os.environ.get("CUTOUT_BACKEND", "api") == "rembg":
        return remove(data)                                   # local model
    r = requests.post("https://www.bgclear.ai/api/v1/remove",
                      headers={"Authorization": f"Bearer {os.environ['BGCLEAR_API_KEY']}"},
                      files={"image_file": ("image.png", data)},
                      data={"size": "full", "format": "png"}, timeout=60)
    r.raise_for_status()
    return r.content

The API path also gives you async jobs for images above 4 megapixels, batches of 50 with callbacks, and remove.bg-compatible field names — relevant if you are consolidating before remove.bg's shutdown. The Python tutorial covers the API side in full; pricing is on the pricing page.

Frequently asked questions

What is rembg in Python?

rembg is an open-source Python library and CLI that removes image backgrounds using segmentation models (U²-Net, ISNet, BiRefNet variants) run through ONNX Runtime. Install with pip, call remove(bytes), get a transparent PNG. It runs locally on CPU or GPU and downloads model weights on first use.

Is rembg free?

Yes — it is MIT-licensed and costs nothing to use. What costs money is running it: CPU or GPU time, memory, and the engineering time to operate it as a service.

Is rembg as good as remove.bg or a commercial API?

On easy images the gap is small; on hair, glass and low-contrast subjects commercial models usually lead. Test your own hardest images through both — bgclear previews are free — rather than trusting benchmarks, including ours.

Can I use rembg without a GPU?

Yes, with rembg[cpu]; expect several seconds per large image. For throughput or latency-sensitive use, a GPU or a hosted API is the practical option.

Ship it with the bgclear API

remove.bg-compatible endpoints, credits from $9 for 100 images, no subscription. Pay, get a key, make your first call in under two minutes.

Get API credits →

Tools for this guide

Background Remover Without Losing Quality

free background remover without losing quality

Background Removal API Free

background removal api free

Background Remover Python Library

background remover python library

Keep reading

API

Remove Image Backgrounds in Python with an API (requests, 20 Lines)

A complete Python walkthrough: single image, URL input, JSON responses, a folder script with safe retries, and async jobs for large files — no ML libraries, just requests.

API

7 remove.bg API Alternatives Compared (2026): Price per Image, Free Tier, Drop-in Compatibility

With remove.bg closing on 1 Dec 2026, here is what the alternatives actually charge per image, what you get free, and which ones let you keep your existing request code.

API

A Free Background Removal API for GitHub Projects: What Is Actually Free, Plus a GitHub Action

The honest free tier (unlimited previews, 10 credits, a free RapidAPI plan), how to keep the key out of a public repo, and a GitHub Actions workflow that removes backgrounds from images in CI — free in pull requests, paid only on release.

API

Django and FastAPI: a Background Removal Proxy Endpoint That Keeps Your API Key Safe

A FastAPI endpoint with httpx that streams the cutout back, the Django view equivalent, per-user quotas, and a Celery task for catalogue runs — the pattern behind every web or mobile front end that removes backgrounds.