Skip to main content

nukebg

Official Python client for the NukeBG background removal API: transparent cutouts, white and marketplace-ready backgrounds, object removal, upscaling, batches, video jobs and webhooks. Standard library only, Python 3.8+.

Also a drop-in replacement for the removebg package. remove.bg's self-serve API closes on 1 December 2026; change one import and keep your code.

pip install nukebg

Create an API key at nukebg.com/account. New accounts get 50 free credits plus 20 a month, and one standard cutout is one credit.

Remove a background

from nukebg import NukeBG

client = NukeBG(api_key="nbg_live_...")   # or set NUKEBG_API_KEY

# A file path, an https URL, bytes or an open binary file
result = client.remove_background("product.jpg")
result.save("product.png")

print(result.width, result.height, result.credits_remaining)

On white, at Amazon size

listing = client.remove_background(
    "https://example.com/shoe.jpg",
    background="white",   # or "#F4F4F4", "gradient:#fff,#eee", "scene:marble"
    size="amazon",        # original | amazon | shopify | etsy | ebay | instagram | story
    shadow="soft",
    format="jpg",
)
listing.save("shoe-amazon.jpg")

All options: quality (preview | standard | hd | ultra), background, size, width, height, padding, crop, shadow, subject (all | main), despill, format, jpeg_quality, channels (rgba | alpha), idempotency_key.

Switching from remove.bg

- from removebg import RemoveBg
+ from nukebg.removebg import RemoveBg

- rmbg = RemoveBg("REMOVEBG_API_KEY", "error.log")
+ rmbg = RemoveBg("NUKEBG_API_KEY", "error.log")
  rmbg.remove_background_from_img_file("joker.jpg")     # writes joker.jpg_no_bg.png
  rmbg.remove_background_from_img_url("https://example.com/joker.jpg")
  rmbg.remove_background_from_base64_img(b64_string)

The same methods and defaults; errors go to the error log, as before. Any other remove.bg parameter (crop, roi, scale, position, format, bg_image_url…) can be passed as a keyword. See the migration guide.

Other tools

clean = client.erase("desk.jpg", prompt="the cables on the desk")   # or mask="mask.png" (white = remove)
big = client.upscale("small.jpg", scale=4)                         # paid credits
print(client.account()["credits"])

Batches, video and webhooks

batch = client.create_batch("cutout", [{"image_url": u} for u in urls], params={"background": "white", "size": "shopify"})
status = client.get_batch(batch["batch_id"])
open("results.zip", "wb").write(client.batch_zip(batch["batch_id"]))

file_id = client.upload("clip.mp4")
job = client.create_job("video", {"file_id": file_id}, params={"format": "webm"})
done = client.wait_for_job(job["id"])
print(done["result"]["url"])

# In your webhook handler (use the raw body)
ok = NukeBG.verify_webhook(request.body, request.headers.get("X-NukeBG-Signature"), webhook_secret)

Errors and retries

Failed calls raise NukeBGError with status, code (for example insufficient_credits, invalid_api_key, no_subject) and request_id. Rate limits (429) and temporary engine errors (5xx) are retried twice, honouring Retry-After. Every POST sends an idempotency key, so a retry is never charged twice. Failed jobs are never charged.

MIT licensed. NukeBG is a product of VOLODS LTD. Not affiliated with remove.bg.

Metadata

Release files for nukebg 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nukebg 1.0.0
File Size Uploaded Provenance Actions
nukebg-1.0.0.tar.gz 10.4 kB With provenance Details for nukebg-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nukebg 1.0.0
File Interpreter ABI Platform Actions
nukebg-1.0.0-py3-none-any.whl Python 3 none any Details for nukebg-1.0.0-py3-none-any.whl

Total release size: 20.8 kB

Release files / nukebg-1.0.0.tar.gz

Download URL nukebg-1.0.0.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f00743d1d7b63c23d70173b8e5647d3347ccf42e465c7d609adffa9b5278d4c5
BLAKE2b-256 checksum
How to use checksums
eda0631b13b929c7e64936e7b27dfe19fc35bd09ba74da2b3b80eb3293f51bfc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Release files / nukebg-1.0.0-py3-none-any.whl

Download URL nukebg-1.0.0-py3-none-any.whl
Size 10.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
36fbeaf716ffa971c4098c050ed6da998e678ce123f959886c79e3a19b9a846c
BLAKE2b-256 checksum
How to use checksums
f2ac9cb9cb0e98af8c31f55cf3d6a99befd62b3a023e1ea5613ad30abf8dc211
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Security for nukebg 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for nukebg-1.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page