Model Details
BiRefNet separates the subject of a photo from its background and returns a transparent RGBA image, or the raw alpha matte on its own. Its standout is edge quality: the matte is genuinely soft rather than a hard on/off threshold, so backlit hair, fur and mesh come back as separated strands with background visible between them, not a blobbed silhouette. One endpoint carries eleven purpose-built checkpoints — general, portrait, matting, high-detail and lite tiers plus a community anime fine-tune — so you pick the one that matches your subject. Typical work: e-commerce cutouts, compositing plates, stickers, and mask extraction for downstream editing.
## Best for - Portraits and pet photos where hair or fur must survive the cut — `variant: "portrait"` or `"matting"` - Subjects that blend into their surroundings — the model is trained to find low-contrast foregrounds - Anime and illustrated characters, via the dedicated `toonout` checkpoint - The raw alpha matte for compositing or VFX — `output_format: "mask"`
## Choose another model when - You want a background generated or replaced from a text description — this model has no prompt input; use `bria/background/replace` - You need the subject relit for a new backdrop — use `lllyasviel/iclight/v2` - You are cutting out a video file — this endpoint takes still images and animated GIF/WebP only - You want a bigger image than you put in — the cutout returns at the input's dimensions; upscale separately
## Tips - Leave `variant` at `general` unless your subject fits a specialist: `portrait` for people, `matting` for hair and fur, `toonout` for flat-colour illustration, `lite` for throughput. - `general-hr`, `matting-hr` and `lite-2k` infer at a higher internal resolution for a more accurate matte; the file returned is still the size of your input. - `refine_fg` pulls background colour out of soft edges — use it when compositing onto a light backdrop; ignored for `mask` output. - `mask_offset` grows or shrinks the cut a pixel or two if a fringe survives; `mask_blur` softens the edge. - Billing follows compute time: a default `general` run costs under half a cent; lighter variants or a smaller `resolution` cost less.
## Limitations - Animated GIF/WebP inputs are processed frame by frame, so cost scales with frame count - `toonout` is a community fine-tune layered on BiRefNet, not one of the original checkpoints
To run via the ModelRunner JavaScript client: ```js import { modelrunner } from "@modelrunner/client";
const result = await modelrunner.subscribe("zhengpeng7/birefnet", { input: { image: "https://media.modelrunner.ai/rJ3Rl8kf4LLzo6SBVlH6n.png", variant: "matting", refine_fg: true, }, }); ```




