SAM 3sam3
Segmentation from text, exemplar boxes and points.
0.5 per image encoding + 0.05 per text prompt + 0.02 per point prompt + 0.02 per refinement
BiRefNet separates the foreground from the background with hair-level alpha and returns a cutout PNG or the alpha mask.
| Billed item | Unit | Credits |
|---|---|---|
| Background removal One image per request. | per image | 1 ≈ US$0.001 top-up |
Available to accounts with a balance (paid pool). Prices are in credits. Failed calls cost nothing.
Recorded responses of the API on sample images.



POST https://api.stack.foldbun.com/v1/remove-background with a Bearer API key.
# macOS: replace "base64 -w0 sneaker.webp" with "base64 -i sneaker.webp" curl https://api.stack.foldbun.com/v1/remove-background \ -H "Authorization: Bearer $FOLDBUN_API_KEY" \ -H "Content-Type: application/json" \ -d @- <<EOF {"model": "birefnet", "image": {"base64": "$(base64 -w0 sneaker.webp)"}, "options": {"output": "cutout"}} EOF
import base64, os, requests with open("sneaker.webp", "rb") as f: image = base64.b64encode(f.read()).decode() r = requests.post( "https://api.stack.foldbun.com/v1/remove-background", headers={"Authorization": f"Bearer {os.environ['FOLDBUN_API_KEY']}"}, json={"model": "birefnet", "image": {"base64": image}, "options": {"output": "cutout"}}, timeout=60, ) r.raise_for_status() print(r.json()) open("sneaker-cutout.png", "wb").write(base64.b64decode(r.json()["data"]))
{
"id": "call_01a1913f-131f-7b89-9f1e-7423a3895c99",
"model": "birefnet",
"image": {"height": 1008, "id": "img_d239eb4c…6504", "width": 1791},
"data": {"$file": "sneaker-cutout.webp"},
"format": "png",
"height": 1008,
"width": 1791,
"cost": 1,
"balance": 1233.56
}| Field | Description |
|---|---|
| image | {"base64": "…"} or {"id": "img_…"} from an earlier response. |
| options.output | cutout (default): RGBA image of the subject. matte: 8-bit grayscale alpha matte. |
| options.format | png (default) or webp. |
| Call | Credits |
|---|---|
| 1 image 1 | 1 ≈ US$0.001 top-up |
| 1,000 images 1,000 × 1 | 1000 ≈ US$1.00 top-up |
data with width and heightGET /v1/modelsEach image costs 1.0 credits. The model is in the paid pool, available to accounts with a balance. Failed calls cost nothing.
cutout returns an RGBA image of the subject. matte returns an 8-bit grayscale alpha matte that can be applied to the original image.
png (default) and webp. The image is returned base64-encoded in data, together with its width and height.
Call BiRefNet through the REST API; the docs list request and response formats.