Cutmatte

Moving from remove.bg to Leonardo.Ai's API: what changes

remove.bg points its API users to Leonardo.Ai. Leonardo's background removal is a different API: your requests, responses and error handling change. Below is what changes, from Leonardo's own migration guide, and the alternative of keeping your code.

Updated 1 December 2026.

Keep your code: change one URLAll alternatives compared

remove.bg, Leonardo.Ai and Cutmatte side by side

remove.bg (closed)Leonardo.Ai sync APICutmatte
EndpointPOST /v1.0/removebgPOST /api/rest/v2/generationssync on cloud.leonardo.aiPOST /v1.0/removebg on api.cutmatte.com
KeyX-Api-KeyAuthorization: BearerX-Api-Key (Bearer also works)
Requestmultipart, JSON or formJSON only, with "model": "remove-bg"; options move under parametersmultipart, JSON or form
Image fileimage_file uploadNo uploads in the request: base64 (under about 7.5 MB), a URL, or an image uploaded firstimage_file upload
ResponseThe image itself, or JSONAlways JSON: a link, or base64 if you askThe image itself, or JSON
Formatspng, jpg, webp, zip, autopng, jpg, webp; no zip, no autopng, jpg, webp, zip, auto
bg_image_fileYesNo; host the image and pass it by referenceYes
Result headersX-Credits-Charged, X-Type, X-Foreground-*Cost in the JSON body; no type or foreground boxSame headers as remove.bg
ErrorsHTTP status with a JSON errorOften HTTP 200 with an errors arrayHTTP status with a JSON error, as remove.bg
Results keptNoKept in your Leonardo library unless you send "ephemeral": trueNo
Price per image—$0.1047$0.009 to $0.003

Leonardo.Ai facts from its migration guide, read on 1 December 2026. Cutmatte's own gaps are listed in differences.

What you would change for Leonardo

  1. Create a Leonardo account and API key, and send it as a Bearer token.
  2. Point requests at Leonardo's sync endpoint and send JSON with "model": "remove-bg".
  3. Move the image into parameters.guidances.image_reference: base64 for small files, a URL or an uploaded image for larger ones. Move the other options under parameters; their values stay the same.
  4. Replace format=zip and format=auto with png, jpg or webp.
  5. Read the result from results[0].url, or ask for base64 and decode results[0].dataB64. Read the cost from the body.
  6. Send "ephemeral": true if images must not be kept.
  7. Update error handling: check the errors array, not only the HTTP status.

When Leonardo.Ai is the better choice

When keeping your code is simpler

If your code uploads files, expects the image bytes back, uses ZIP output or bg_image_file, reads X-Credits-Charged or the foreground headers, or relies on HTTP status codes for errors, a compatible API saves the rewrite. With Cutmatte the change is the base URL and the key:

- https://api.remove.bg/v1.0/removebg
+ https://api.cutmatte.com/v1.0/removebg
  X-Api-Key: your Cutmatte key

Examples for cURL, Node.js, Python, PHP, Ruby, C#, Java and the remove.bg wrappers are in the migration guide. A new account gets 50 full-size images free.

Get a free API keyRead the docs

Questions

Is Leonardo.Ai's background removal the same model as remove.bg?

Canva says remove.bg's technology lives on through Canva's Background Remover and the Leonardo.Ai API. We have not compared their outputs.

Can I keep sending multipart uploads to Leonardo.Ai?

No. According to its guide, the sync API takes JSON only; files go in as base64, a URL, or an image uploaded first.

Does Leonardo.Ai keep my images?

By default, results are kept in your Leonardo library. Its guide says to send "ephemeral": true to keep nothing after the call.

Cutmatte is not affiliated with remove.bg, Canva or Leonardo.Ai.