Skip to main content

API & SDK

Free Background Removal API

Two integrations to choose from: a client-side JavaScript SDK (unlimited, free) or a server-side REST API (100 images/day per IP, no key required).

JavaScript SDK

✓ Unlimited · ✓ No key · ✓ Client-side

Drop a single <script> tag in your page. Runs RMBG-1.4 in your user's browser. Free forever — we never process anything on our side.

Read SDK docs

REST API

✓ 100/day free · ✓ No signup · ✓ Server-side

POST an image, get a transparent PNG back. Rate-limited per IP at 100 images/day. No API key required.

Read API docs

JavaScript SDK

The SDK runs background removal in your user's browser — no upload to our servers, no rate limit, no API key. Free forever.

1. Include the script

<script src="https://bgremovers.org/sdk/v1.js"></script>

2. Remove a background

<input type="file" id="file" accept="image/*">
<img id="result">

<script>
  document.getElementById('file').onchange = async (e) => {
    const file = e.target.files[0];
    const transparentPng = await BgRemove.removeBackground(file, {
      maxDimension: 4096,
      onProgress: (p) => console.log(p),
    });
    document.getElementById('result').src = URL.createObjectURL(transparentPng);
  };
</script>

3. Pre-warm for instant first use

// Call once on page load to download the model in the background.
// The first user-triggered removeBackground() will then be near-instant.
BgRemove.preload();

API reference

MethodSignatureReturns
removeBackground(file: File|Blob, opts?: object)Promise<Blob>
preload()Promise<void>
versionstring"1.0.0"

Options

  • maxDimension — Cap longest edge in pixels. Default 4096.
  • onProgress(p) — Callback with {stage, progress?, device?}. Stages: loading-runtime, loading-model, downloading, ready.

REST API

For server-side processing. 100 images per day per IP, no API key required, no signup.

Beta status

The REST API is in beta. Production traffic should prefer the JS SDK or include retry-with-backoff. Upstream model availability may vary.

Endpoint

POST https://bgremovers.org/api/v1/remove-background

Request — multipart form-data

curl -X POST https://bgremovers.org/api/v1/remove-background \
  -F "image=@product.jpg" \
  -o transparent.png

Request — JSON with URL

curl -X POST https://bgremovers.org/api/v1/remove-background \
  -H "Content-Type: application/json" \
  -d '{"image_url":"https://example.com/photo.jpg"}' \
  -o transparent.png

Request — raw bytes

curl -X POST https://bgremovers.org/api/v1/remove-background \
  -H "Content-Type: image/jpeg" \
  --data-binary @product.jpg \
  -o transparent.png

Node.js example

import fs from "node:fs";

const form = new FormData();
form.append("image", new Blob([fs.readFileSync("photo.jpg")], { type: "image/jpeg" }));

const res = await fetch("https://bgremovers.org/api/v1/remove-background", {
  method: "POST",
  body: form,
});

if (!res.ok) {
  const err = await res.json();
  throw new Error(err.error.message);
}

const png = Buffer.from(await res.arrayBuffer());
fs.writeFileSync("transparent.png", png);

console.log("Daily remaining:", res.headers.get("X-RateLimit-Remaining"));

Python example

import requests

with open("photo.jpg", "rb") as f:
    r = requests.post(
        "https://bgremovers.org/api/v1/remove-background",
        files={"image": f},
    )
r.raise_for_status()

with open("transparent.png", "wb") as f:
    f.write(r.content)

print("Remaining today:", r.headers.get("X-RateLimit-Remaining"))

Response

  • Success (200): Binary PNG with alpha channel. Content-Type: image/png.
  • Headers: X-RateLimit-Limit: 100, X-RateLimit-Remaining: N.
  • Rate limit (429): JSON error {"error": {"code": "rate_limit_exceeded", ...}}
  • Too large (413): Max 10 MB per image via REST API. Use SDK for larger.
  • Upstream error (502): Model temporarily unavailable. Retry with backoff.

Health check

GET https://bgremovers.org/api/v1/health

{
  "status": "ok",
  "version": "1.0.0",
  "daily_limit": 100,
  "rest_api_enabled": true
}

Why is this free?

SDK runs on your users' devices

No compute cost for us per image. Free is sustainable.

REST API uses open models

RMBG-1.4 is openly available. We pay only for the Worker compute, which is on Cloudflare's free tier for the 100/day usage.

No image storage

We don't keep your images — no storage cost, no privacy risk.

Open source

SDK and Worker code are public on GitHub. Audit it yourself.

FAQ

Which should I use — the SDK or the REST API?

Use the SDK if you can process in the user's browser (web apps, browser extensions, Electron). It's unlimited, faster (no upload), and more private. Use the REST API for server-side processing (Node.js backends, scheduled jobs, CLI tools).

Is the JavaScript SDK truly unlimited?

Yes. The SDK runs the RMBG-1.4 model entirely in the user's browser using their CPU/GPU. We don't see, count, or rate-limit anything. The only cost is the one-time 44 MB model download.

What are the REST API limits?

100 images per day per IP address. Counter resets at UTC midnight. No API key required — just call the endpoint. Need more? Contact us for self-hosted or higher tiers.

Do you store the images sent to the REST API?

No. Images are streamed through the Worker, sent to the model provider for inference, the result is returned to you, and nothing is persisted. We don't log image bytes.

Can I use this in production?

The SDK is production-ready and used by ecommerce stores, design tools, and content platforms. The REST API is in beta — fine for prototypes and low-volume production. For high-volume use, run the SDK in headless Chrome.

What's the licensing?

MIT-licensed for both SDK and any code we publish. The RMBG-1.4 model itself is licensed for non-commercial use; for commercial use at scale, check briaai's licensing terms.

Start integrating

Pick the SDK for unlimited client-side use, or the REST API for server workflows. Both free.

How we verify privacy