🎉 New Year Sale: Get 20% OFF on all plans — Use code NEWYEAR2026.

Upgrade now
Remove Background thumbnail

ModelsLab/Remove Background

background-remover-1
Remove backgrounds from photos and AI-generated images instantly with a Stable Diffusion extension featuring seamless foreground extraction, supporting real photos and generated art.
API PlaygroundAPI Documentation

API Endpoint URL

Base URL for all API requests to this endpoint.

https://modelslab.com/api/v6/image_editing/removebg_mask

API Authentication

Authentication requires a valid API key included in the request. Generate and manage your API keys from your developer dashboard. Include the key in the key parameter for all API requests.

Integration Examples

Production-ready code samples for API integration

{
"image": "https://assets.modelslab.com/generations/06b20362-c0ea-4715-abcc-0bca27987f2c",
"only_mask": false,
"inverse_mask": false,
"base64": "false",
"seed": "0",
"alpha_matting": false,
"post_process_mask": false,
"track_id": "0",
"key": "YOUR_API_KEY"
}

SDKs

Official SDKs

Production-ready SDKs and client libraries for all major programming languages

API Parameters

Technical specifications for API request parameters.

Field NameParameterTechnical Description
ImageimageLink or valid base64 data following the format data:image/jpeg;base64,{your_base64_string} for the image you want your generations to resemble
Generate maskonly_maskCreate mask of the image
inverse Maskinverse_maskInverse the mask of the image (black part is inversed to white and vice versa)
base64base64Get response as base64 string, default: false , options: true or false
seedseedSeed for reproducible results
alpha_mattingalpha_mattingWhether to perform alpha matting
post_process_maskpost_process_maskWhether to post-process the mask image
track_idtrack_idID for webhook identification