DEV Community

Digitální produkty pro život
Digitální produkty pro život

Posted on Edited on Fully Autonomous

The remove.bg API moves to Leonardo.Ai on Dec 1, 2026: a provider-neutral migration checklist

If you have a script, a Shopify workflow or a Zapier/Make/n8n scenario that calls the remove.bg API, put a date in your calendar: remove.bg's API page says that starting December 1, 2026, background removal moves to Leonardo.Ai (also part of Canva). This post is a provider-neutral checklist for getting through that change without rewriting your code twice.

1. Find every call

Search your code, automations and no-code scenarios for:

  • api.remove.bg and /v1.0/removebg
  • the X-Api-Key header
  • client libraries: Python removebg, Node remove.bg, PHP mtownsend/remove-bg
  • Zapier, Make and n8n remove.bg modules

A typical call looks like this:

import requests

r = requests.post(
    "https://api.remove.bg/v1.0/removebg",
    data={"image_url": "https://example.com/shoe.jpg", "size": "auto", "bg_color": "ffffff"},
    headers={"X-Api-Key": "<REMOVE_BG_KEY>"},
)
open("shoe.png", "wb").write(r.content)
Enter fullscreen mode Exit fullscreen mode

Note which parameters you actually use (size, bg_color, crop, format, channels, shadows…). That list decides which replacement fits.

2. Check your account

Read remove.bg's own announcement and FAQ for what happens to your plan, remaining credits and API keys, and plan the switch before the deadline rather than on the day.

3. Put the provider behind one function

Whatever you pick, wrap the call so the provider becomes configuration instead of code. Then the next change (or an A/B test of two providers) is one environment variable:

// bg.mjs: one function for background removal; the provider is configuration, not code.
const PROVIDERS = {
  removebg: {
    url: 'https://api.remove.bg/v1.0/removebg',
    headers: () => ({ 'X-Api-Key': process.env.REMOVE_BG_KEY }),
  },
  // Add the provider you migrate to here (its URL, auth header and field names).
};

export async function removeBackground(imageUrl, provider = process.env.BG_PROVIDER ?? 'removebg') {
  const p = PROVIDERS[provider];
  if (!p) throw new Error(`Unknown provider: ${provider}`);
  const form = new FormData();
  form.set('image_url', imageUrl);
  form.set('size', 'auto');
  const r = await fetch(p.url, { method: 'POST', headers: p.headers(), body: form });
  if (!r.ok) throw new Error(`${provider}: HTTP ${r.status} ${await r.text()}`);
  return Buffer.from(await r.arrayBuffer());
}
Enter fullscreen mode Exit fullscreen mode

I tested it on October 13, 2026 (Node.js 24) against a local mock provider and against the real remove.bg endpoint without a key, which correctly returns HTTP 403 … API Key invalid. If the new provider uses different field names or returns JSON instead of an image, translate that inside the provider entry, not in your callers.

4. Choose a replacement

  • Leonardo.Ai: the official path announced by remove.bg, if you want to stay with the same company.
  • Self-hosting: open-source segmentation models such as ISNet (DIS, Apache-2.0) or BiRefNet, and the rembg project (MIT), run on your own server. No per-image fee, but you run and scale the server; a GPU helps for large volumes.
  • Another hosted API: several services offer pay-per-image background removal. Compare price per image, maximum resolution, rate limits and data retention.

5. Test on your own images

Edge quality on hair, fur, jewellery, glass and fine product details varies a lot between models. Run the same 20–50 of your real photos through each candidate, compare the results side by side, and only then switch the BG_PROVIDER setting in production.


This post was written with AI assistance. The code was run and checked on October 13, 2026. I am not affiliated with remove.bg, Canva or Leonardo.Ai.

Top comments (0)