Room AI

Remove Background AI

1 tokenTools

Remove image background

Overview

Remove Background AI cleanly removes the background from any image, leaving the subject isolated on a transparent background. Works with furniture, people, objects, and architectural elements. The output is a PNG with alpha transparency.

Image input

Endpoint

POST /api/v1/generate
bash
curl -X POST https://roomai.com/api/v1/generate \
  -H "Authorization: Bearer rai_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"model": "removebg", ...}'

Parameters

ParameterTypeDescription
modelstring

Must be "removebg".

removebg
imagestring

URL of the image.

formatstring

Output format.

Default: "png"

png

Request Example

json
{
  "model": "removebg",
  "image": "https://example.com/chair-photo.jpg"
}

Response

Success (200)

json
{
  "status": "success",
  "result": {
    "image_url": "https://storage.googleapis.com/...",
    "model": "removebg",
    "tokens_used": 1,
    "processing_time_ms": 4500
  }
}

Error

json
{
  "status": "error",
  "error": {
    "code": "INSUFFICIENT_TOKENS",
    "message": "Not enough tokens",
    "required": 1,
    "balance": 0
  }
}

Code Examples

cURL

bash
curl -X POST https://roomai.com/api/v1/generate \
  -H "Authorization: Bearer rai_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "removebg",
  "image": "https://example.com/chair-photo.jpg"
}'

JavaScript / Node.js

javascript
const response = await fetch("https://roomai.com/api/v1/generate", {
  method: "POST",
  headers: {
    "Authorization": "Bearer rai_live_your_api_key",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
  "model": "removebg",
  "image": "https://example.com/chair-photo.jpg"
}),
});

const data = await response.json();

if (data.status === "success") {
  console.log("Image URL:", data.result.image_url);
  console.log("Tokens used:", data.result.tokens_used);
} else {
  console.error("Error:", data.error.message);
}

Python

python
import requests

response = requests.post(
    "https://roomai.com/api/v1/generate",
    headers={
        "Authorization": "Bearer rai_live_your_api_key",
        "Content-Type": "application/json",
    },
    json={
  "model": "removebg",
  "image": "https://example.com/chair-photo.jpg"
},
)

data = response.json()

if data["status"] == "success":
    print("Image URL:", data["result"]["image_url"])
    print("Tokens used:", data["result"]["tokens_used"])
else:
    print("Error:", data["error"]["message"])

Tips

  • 1Output is always PNG with transparent background.
  • 2Works best when the subject has clear edges against the background.
  • 3Use before Change Background AI to swap backgrounds cleanly.