Skip to content

fix(remove-bg): switch to Leonardo.Ai before the remove.bg API shuts down - #62

Closed
Anandb71 wants to merge 1 commit into
silships:mainfrom
Anandb71:arbor/removebg-leonardo-migration
Closed

Anandb71 wants to merge 1 commit into
silships:mainfrom
Anandb71:arbor/removebg-leonardo-migration

Conversation

@Anandb71

Copy link
Copy Markdown
Contributor

Hey! remove.bg is shutting down its self service API on December 1, 2026. The banner on https://www.remove.bg/api says "Starting December 1, 2026, background removal moves to Leonardo.Ai", so figma-cli remove-bg will start failing after that date.

This moves the command over to Leonardo's sync API, following their official migration guide: https://docs.leonardo.ai/docs/migrate-from-the-removebg-api-to-leonardoai

What changed

  • The request now lives in a small src/lib/remove-bg.js so it can be tested on its own. It sends JSON to https://cloud.leonardo.ai/api/rest/v2/generationssync with "model": "remove-bg", the exported PNG as BASE64 under parameters.guidances.image_reference, size: auto, format: png and ephemeral: true (so nothing is kept in the Leonardo library, same as remove.bg). It downloads results[0].url and returns the PNG bytes, so the Figma side of the command is untouched.
  • remove.bg keys don't carry over, so users need a new Leonardo API key. The key now comes from --api-key, LEONARDO_API_KEY or config set leonardoApiKey, and the "key required" help points to the Leonardo API Access page and explains why an old key stops working.
  • Leonardo often reports errors as HTTP 200 with errors[], so those messages get surfaced, and a 401/403 says to use a Leonardo key.
  • REFERENCE.md, SECURITY.md (outbound requests) and the config set example mention Leonardo now. I didn't touch CHANGELOG.md since you write it per release.

Testing

  • Added tests/remove-bg.test.js with a mocked fetch: it checks the request shape and the downloaded bytes, the errors[] case, a 401 and an empty results. It fails on the current code and passes with this change.
  • npm test on Node 22: 553 tests, 552 pass, 0 fail, 1 skipped. The skip is the existing roundtrip test that needs a connected Figma (main gives 549 / 548 / 1 skipped).
  • The node --check loop from the CI workflow passes.
  • I couldn't run it against real Figma or the real Leonardo API (no key on my side), so a quick remove-bg on a selected image would be great before merging.

Thanks for the tool!

…down

remove.bg's self-service API stops on December 1, 2026 and background
removal moves to Leonardo.Ai. Move the request into src/lib/remove-bg.js
and point it at Leonardo's sync remove-bg endpoint, following the
official migration guide:
https://docs.leonardo.ai/docs/migrate-from-the-removebg-api-to-leonardoai

remove.bg keys don't carry over, so the key now comes from --api-key,
LEONARDO_API_KEY or the leonardoApiKey config value. The command still
gets PNG bytes back (the result URL is downloaded), so the Figma side is
unchanged. Adds tests with a mocked fetch.

Signed-off-by: Anand Biju <169837340+Anandb71@users.noreply.github.com>
silships pushed a commit that referenced this pull request Nov 19, 2026
…down (#62)

remove.bg moves background removal to Leonardo.Ai on December 1 2026.
Old remove.bg keys found in REMOVEBG_API_KEY or config are reported as
unused instead of silently ignored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@silships

Copy link
Copy Markdown
Owner

Thank you! This is in figma-cli 2.4.0 on npm: the Leonardo.Ai switch. An old remove.bg key now gets a clear message instead of being ignored. Commit 7ae7e65 keeps you as the author

@silships silships closed this Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants