Remove.bg API → Leonardo.Ai · verified September 27, 2026

Migrating from the remove.bg API to Leonardo.Ai

remove.bg plans to move its background removal API to Leonardo.Ai starting December 1, 2026. If your app currently uses the remove.bg API, you will need a Leonardo API key and changes to the endpoint, authentication, request body, and response handling.

This guide shows what to update and highlights the differences that can affect storage, output formats, pricing, and rate limits.

Planned move
December 1, 2026
Current listed price
$0.1047 per image
Standard Leonardo limit
100 images/minute

Last checked against the official remove.bg notice, Leonardo overview, and Leonardo migration documentation: .

Migration map

What changes at a glance

What changesremove.bgLeonardo SyncWhat to update
EndpointPOST https://api.remove.bg/v1.0/removebgPOST https://cloud.leonardo.ai/api/rest/v2/generationssyncChange the URL; use Async instead when a synchronous connection is unsuitable.
AuthenticationX-Api-Key: <key>Authorization: Bearer <key>Create a Leonardo key. Existing credentials do not carry over.
Requestmultipart/form-data or JSONapplication/jsonMove source and options into JSON; base64-encode direct files or upload/reference them.
Model / optionsImplicit; options top-levelmodel: "remove-bg"; options under parametersAdd the explicit model and nest supported options.
ResponseRaw bytes by defaultAlways JSON: results[0].url or dataB64Parse JSON, then download the URL or decode base64.
StorageNothing keptPersisted by defaultSet ephemeral: true when you need remove.bg-style no-library storage.
Formatspng, jpg, webp, zip, autopng, jpg, webpChoose explicitly; redesign ZIP handling.
Standard rateUp to 500 images/min100 images/min standardRetune concurrency and backoff; confirm enterprise limits separately.

Minimal URL-input migration

Before and after

This example uses an HTTPS source URL and an ephemeral result. The response is JSON; your client must then download results[0].url.

Before · remove.bg

curl -H 'X-Api-Key: YOUR_KEY' \
+  -F 'image_url=https://example.com/photo.jpg' \
+  -F 'size=auto' \
+  -f https://api.remove.bg/v1.0/removebg \
+  -o no-bg.png

After · Leonardo Sync

curl --request POST \
+  --url https://cloud.leonardo.ai/api/rest/v2/generationssync \
+  --header 'authorization: Bearer YOUR_LEONARDO_API_KEY' \
+  --header 'content-type: application/json' \
+  --data '{
    "model": "remove-bg",
    "ephemeral": true,
    "parameters": {
      "size": "full",
      "format": "png",
      "guidances": {
        "image_reference": [{
          "image": { "type": "URL", "url": "https://example.com/photo.jpg" }
        }]
      }
    }
  }'

Leonardo currently lists background removal at $0.1047 per image. Pricing can change, so confirm the current rate and size limits before switching production traffic. Verified September 27, 2026.

Choose by current input/output

Your migration path depends on how bytes move

URL in → file out

Move the HTTPS URL into parameters.guidances.image_reference. Parse the JSON response and download results[0].url.

Watch for

Short-lived URLs with ephemeral mode; explicit format instead of auto.

File upload → file out

Sync is JSON-only. Base64-encode smaller files, or upload larger/reused inputs and reference their ID.

Watch for

BASE64 input and output limits differ; avoid data: prefixes.

Batch / pipeline

Consider Leonardo Async: submit, receive a generation ID, then poll or use a webhook.

Watch for

Async results are persisted. Decide how long to keep them and how your app will retry failed files.

Privacy / storage

Choose whether Leonardo keeps the result

Leonardo's detailed migration documentation says inputs and outputs are saved to your Leonardo library and CDN by default. Set ephemeral: true on Sync requests when you need remove.bg-style no-library storage; the returned URL then lasts about 30 minutes.

This setting only controls Leonardo storage. Your own logs, caches, downloads, and later processing may still retain the image, so review the complete path used by your app.

Storage choice

ephemeral: true
Nothing kept in the Leonardo library; the result URL is short-lived.
ephemeral: false
Default. Inputs and outputs are saved to the Leonardo library/CDN.

No direct mapping

Features you must redesign or remove

format=zip

Not supported. Request PNG or WebP, then create an archive after the files are downloaded if your users still need one.

format=auto

Not supported. Choose PNG/WebP for transparency or JPG where transparency is not required.

multipart/form-data

Not supported by Sync. Use URL, BASE64, or an uploaded image reference in JSON.

raw response bytes

Not supported. Read a URL from JSON, or request base64 and decode dataB64.

bg_image_file

No direct equivalent. Host or upload the background and use background_image_reference.

X-Type / foreground metadata

No equivalent. If your app uses these fields, remove that behavior or replace it with another user-visible rule.

POST /improve

Not supported. Remove contribution flows that depend on it.

OAuth end-user login

Not supported for this migration path. Authenticate with the account API key.

Rate limits / errors

Plan for a lower standard rate limit

Leonardo's official overview lists a standard limit of 100 images per minute, versus up to 500 for remove.bg. Higher limits may be available by arrangement. Keep retry handling for 429 and 5xx responses, and update your client to read Leonardo's JSON error fields rather than relying only on the HTTP status.

Check before you switch

  • Try the person, product, animal, graphic, and difficult-edge images your app actually processes.
  • Test each input path you use: URL, base64, or an uploaded image ID.
  • Confirm transparency, dimensions, content type, cost, and short-lived URL downloads.
  • Confirm authentication errors, rate-limit responses, server errors, timeouts, and empty results are shown or retried safely.

Migration checklist

Update your integration in this order

  1. 01Create a Leonardo account and API key; remove the old key from the new request path.
  2. 02Switch the endpoint and replace X-Api-Key with Bearer authentication.
  3. 03Send JSON with model: "remove-bg" and one source image.
  4. 04Move supported options under parameters and choose PNG, JPG, or WebP explicitly.
  5. 05Replace raw-byte handling with results[0].url or base64/dataB64 handling.
  6. 06Set ephemeral: true when you do not want images kept in the Leonardo library.
  7. 07Read the USD cost from the response body and check current pricing.
  8. 08Review unsupported fields, error handling, and the lower standard rate limit before switching traffic.

Choose your next step

API migration or browser removal?

Leonardo.Ai is the official remove.bg API migration destination. Stable Diffusion AI provides a browser-based background remover for people who need to remove a background without integrating an API. We do not currently offer a remove.bg-compatible public API.