Skip to main content
onAiRemoveBackground takes the background off the photo. With it, the AI offers Remove Background on its selector, with no brush and one button, Remove, a tip on the photo saying it removes the background and keeps the main subject: one tap, and the photo’s subject stands on a transparent background, shown as a checkerboard; saved as a PNG or a WebP, it stays transparent, and as a JPEG, it comes out white. After it, with onAiEditImage, the mode’s row is the new background’s field, Describe the new background, and its Generate has the fill paint it in, your function told it is the new background by its operation, 'GENERATE_BACKGROUND', which the recommended server sends, in words, to Bria FIBO 2.0 Edit, the model that followed the words in our measurements; without onAiEditImage, the cut photo leaves Remove alone, off, until an Undo brings the uncut photo back. With it, the AI’s conversation gets the retouch_remove_background tool too, and retouch.removeBackground() runs it from code. Without it, the button doesn’t show.
Remove, and the woman with her maple leaf stands on the checkerboard, the autumn street behind her gone, her loose hair cut strand by strand; then a new background in words, a golden larch forest by an alpine lake in soft light, painted behind her, her outline as the cut left it. Bria RMBG 2.0’s, Claude Sonnet 5.5’s and Bria FIBO 2.0 Edit’s real answers, played four times as fast as they came.
A woman in a cream knit sweater holding an orange maple leaf over her face, in three steps: on a street of blurred autumn trees, labeled Original; on the checkerboard with the street taken off, labeled Background removed; and before a golden larch forest by an alpine lake in soft light, labeled with the words that asked for it, A golden larch forest by an alpine lake, autumn, soft light
The photo, its street removed, then a new background asked in words, the woman as the cut left her. Bria RMBG 2.0’s, Claude Sonnet 5.5’s and Bria FIBO 2.0 Edit’s real answers. For a business, a product photo made where the product sells: a car dealer’s SUV on a coastal road at sunset, its features then called out in Annotate; a cosmetics brand’s serum on water and petals, then Expand to a 16:9 banner; a race car in a pit lane at night, expanded to 16:9. The same real models, with Bria FIBO Edit 1.5 Expand for the borders; their commands in Use Cases.
A matte black SUV parked against a gray concrete wall, labeled Original; the SUV alone on the checkerboard, labeled Background removed; and under them the SUV on a coastal road at sunset, the sea and the cliffs behind it, and black labels with orange dots and lines: Slim headlights, Tinted windows, Slim tail lights and Aero wheels, labeled with the two requests
An amber dropper bottle with a blank label on a concrete block against a beige wall, labeled Original; the bottle and its block on the checkerboard, labeled Background removed; and under them a 16:9 banner, the bottle on its block over still water rippling round it, white petals floating on it, labeled with the request and the ratio
A yellow and blue stock car seen from behind on a banked track, labeled Original; the car alone on the checkerboard, labeled Background removed; and under them a 16:9 banner, the car on a wet pit lane at night between lit garages and stacks of tires under floodlights, labeled with the request and the ratio
A whole job, the online store’s banner (Use Cases): the sneaker cut from its orange backdrop, a wet street at night with neon reflections painted behind it, Expand to 16:9, and its three selling points called out. The models’ real answers, played four times as fast as they came.
Full and Trial only. The Free and the Lite accept onAiRemoveBackground and ignore it. It works alone: a site that gives only this function gets the AI’s ✦ and Remove Background’s Remove, with no selector, and nothing more.

Wire It

In the page, onAiRemoveBackground posts the photo to your server and reads the cut back:
page.ts
On your server, a route takes the background off through one of the servers below, here as a Next.js route handler:
route.ts
Pass the function to EmbedEditor, or as the same option of mountEditor and openEditor.

What the Editor Sends

Blob
A JPEG of the photo as it is at that moment, at most 2048 px on its longer side: the photo with the AI’s own edits, such as an earlier fill, and none of the rest: no crop, rotation, adjustments, filter, frame, annotations or Obfuscate areas, and no mark of any kind, the badge included. So the cut fits the whole photo, even when the person crops it afterward.
string
What to keep, in words, as the person typed them in Remove Background’s own field, Describe what to keep, before tapping its Remove ('the woman and her dog'), for a model that cuts by words. Only with enableAiRemoveBackgroundPrompt, with which the tip on the photo says Leave it blank to keep the main subject; '' with no words and without it. The words leave the field as the call goes, and come back to it when your function rejects or its cut separates nothing, for another try with other words. Once the photo is cut, without onAiEditImage, the field gives way to Remove, off, until an Undo brings the uncut photo back. retouch.removeBackground({ prompt }) sends them too, and rejects with NOT_AVAILABLE for words without the prop. Of the servers below, only Bria RMBG 2.0’s reads them: turn the prop on with it.
AbortSignal
Aborts when the request stops: the Stop on the AI’s card, Escape, ask.stop() or ask.end(), the editor closing or leaving the page, or another image opening. Pass it on to your fetch and to your model’s call.

What It Gives Back

The photo with its background transparent: a PNG, or any image with alpha the browser reads, such as a WebP, at any size. The editor uses its alpha alone, stretched to the photo, and keeps the photo’s own pixels, so the subject’s edge is the one your model drew, hair and fur included. Where your model separates almost nothing (less than 0.5 % of the pixels below half alpha, or less than 0.5 % at half or above), the editor says Nothing Found and keeps the photo as it was; where the brush shows, it points the person to marking it by hand. The cut is one undo step. Its pixels are part of the photo, never of the state a host keeps: Save’s src holds them. When your function rejects, the AI’s card says Couldn’t Remove the Background, with your error’s message under it, and the photo stays as it was. A rejection that is no Error, an Error with no message, or one of the editor’s own (EmbedEditorError) shows Try again. under the title, and so does an answer that is no image. retouch.removeBackground() rejects with AI_FAILED in each case, your error as its cause when it rejected. Inside a request, when the model calls its retouch_remove_background tool, the card shows neither: the model gets the failure, or the nothing found, as its tool’s answer.

Which Model

We tested the models on three photos on 2026-11-08, then tested additional models on two editor requests on 2026-11-09. We graded the cuts by eye; the sample is small, so try the models on your own images too. Bria RMBG 2.0 is our recommendation. BiRefNet v2 is the inexpensive alternative; Cloudflare Images is an option when your server runs on Workers. Prices are from November 2026. The time for Bria includes the editor’s uploads; the other times do not measure the same path.

Servers

Each server is one module for your server, with the same removeBackground function: it takes the editor’s image and signal, Bria RMBG 2.0’s its prompt too (Cloudflare Images’ takes the Worker’s env in place of signal), and resolves to { cost, image }, the photo with its background transparent and what the call cost, in US$. The fal servers’ calls have two minutes, past which they reject with “The model took too long.” The person’s Stop ends the wait at once and asks fal to cancel the job, which fal’s own client doesn’t do: fal drops a job it hasn’t started yet but finishes, and bills, one it has (the fal job).

Bria RMBG 2.0

Bria’s RMBG 2.0, through fal. The photo goes up to fal’s storage, then one job, run by fal-job.ts, gives the cut back. The words of what to keep go to the same endpoint, which then cuts by them: on our plate, “the plate with the food and the hand” added the whole hand. They cost US$ 0.03 a call, against 0.018 without. It needs @fal-ai/client and FAL_KEY. The editor’s playground runs this file, word for word.
background.ts

BiRefNet v2

BiRefNet v2, through fal, at 1024 px, its job run by fal-job.ts. fal bills it by the second it runs, US$ 0.000575 a second, so the server asks fal how long the call ran, and gives back the cut with no cost (null) where fal doesn’t say or fails to answer. It needs @fal-ai/client and FAL_KEY.
background-cheap.ts

Cloudflare Images

For a site whose server is a Cloudflare Worker: the Worker’s Images binding cuts the subject out with segment: 'foreground', BiRefNet run on Workers AI. Bind Images in the Worker’s Wrangler file ("images": { "binding": "IMAGES" }), on an Images Paid plan. The binding takes no signal, so the function takes the Worker’s env in its place: call it from the Worker’s fetch with the env it gets. Cloudflare bills each call as a unique transformation, the first 5,000 a month included, then US$ 0.50 for 1,000. Cloudflare says its segment runs BiRefNet. On our plate photo it answered in 1.1 s, run with wrangler dev --remote, and cut the food alone, where Bria RMBG 2.0 cut the plate with it: see Which Model.
background-cloudflare.ts

The fal job

fal’s client, when its signal aborts, stops waiting for the job but doesn’t cancel it. The fal servers run each job through this module: when the person stops or the time limit passes, it stops waiting and asks fal to cancel the job by its id, even where the stop comes before fal gives the id, and it fetches the job’s image within the same limit. A cancel drops a job fal hasn’t started yet. A job fal has already started runs to its end and is billed: fal answers the cancel and finishes the job anyway (on 2026-11-10, a Bria cut canceled 6 seconds in completed at 25.5 seconds). It needs @fal-ai/client and limit.ts beside it.
fal-job.ts

The time limit

Every call to a model gets two minutes, its image’s fetch included: over twice the slowest call we measured of a model our servers run, Object Eraser’s 50 seconds on Runware, which fills a Remove. This module gives the call a signal that aborts when the person stops or the two minutes pass, whichever comes first, and past them rejects with “The model took too long.”, the words the editor shows. The fal job and the Runware server both run their calls through it.
limit.ts