
BiRefNet General
Removes the background from a photo and returns the subject on a transparent background, or as a black-and-white mask.
Fine-tunableINSPYRENETRemoves the background from a photo with fine detail at hair and edges, and returns the subject on a transparent background or as a black-and-white mask.

POST /v1/files/upload/{fileType} (JPEG, PNG or WEBP) and keep the URL each upload returns; (2) write a JSONL file with one {"file": "...", "mask": "..."} line per pair, holding that image URL and mask URL, and upload it with POST /v1/files/upload/JSONL; (3) start the fine-tune with POST /v1/fine-tuning, its dataset set to all the image, mask and manifest URLs.InSPyReNet by Taehun Kim, Kunhee Kim, Joonyeong Lee, Dongmin Cha, Jiho Lee and Daijin Kim, released under the MIT License, Copyright (c) 2021 Taehun Kim. Its Swin Transformer backbone is Copyright (c) 2021 Microsoft, MIT License.
| Name | Type | Required | Default | Details |
|---|---|---|---|---|
image | file | Yes | — | The photo to cut out: PNG, JPEG or WebP, up to 50 MB and 50 megapixels. 1–2048 characters · image/png, jpeg, webp |
output | text | No | cutout | cutout: the photo on a transparent background (RGBA PNG); mask: the subject in white on black (grayscale PNG). Allowed: cutout, mask |
Output. Returns PNG image: PNG at the photo's size: the cutout (RGBA) or the mask (grayscale).
Send your API key in the X-API-Key header. The run is asynchronous: submit it, then poll it until it finishes. Create an API key.
curl -X POST "https://api.kainguru.com/api/v1/executions?mlFlowId=INSPYRENET" \
-H "X-API-Key: kg_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"input": {
"image": "https://example.com/input.png",
"output": "cutout"
},
"outputFormat": "json"
}'
# Poll until the execution reaches a terminal state
curl "https://api.kainguru.com/api/v1/executions/{executionId}" \
-H "X-API-Key: kg_your_api_key"from kainguru import KainguruClient
with KainguruClient(api_key="kg_your_api_key", base_url="https://api.kainguru.com/api") as client:
submitted = client.executions.execute(
"INSPYRENET",
{
"image": "https://example.com/input.png",
"output": "cutout"
},
output_format="json",
)
result = client.executions.await_completion(submitted.id)
print(result.execution.output)You can fine-tune InSPyReNet on your own data and run the tuned model through the same API. Dataset: 4 to 500 images, one mask per image (same size; white = subject, black = background, or a cutout with a transparent background) and a JSONL manifest with one {"file": "...", "mask": "..."} object per line, each value the URL that file's upload returned.
The steps are in the docs.
Price per image: 0.05225 credits ($0.0005225). The price is shown again before every run; all prices are on the pricing page.

Removes the background from a photo and returns the subject on a transparent background, or as a black-and-white mask.
Fine-tunable
Fast background removal that returns the subject of a photo on a transparent background, or as a black-and-white mask.
Fine-tunable
Finds the clothes a person wears in a photo and returns a mask for the upper body, the lower body and full-body…
Fine-tunable
Splits a picture into its objects and regions, such as people, cars, sky and road, with a label and a mask for each one.
Fine-tunable
Click or draw a box on an object and get back a mask outlining it.
Fine-tunable
Outlines the things you name in a picture, such as "red car, person with a helmet", with a mask and a box for each one.
Fine-tunable