Room AI

Expand AI

1 tokenTools

Extend cropped photos with AI outpainting

Overview

Expand AI extends the boundaries of a cropped photo using AI outpainting. The AI seamlessly continues the scene beyond the original frame — generating floors, walls, ceilings, and furnishings that match the existing content. Perfect for making narrow room shots wider or extending compositions for marketing materials.

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": "expand", ...}'

Parameters

ParameterTypeDescription
modelstring

Must be "expand".

expand
imagestring

URL of the image to expand.

promptstring

Optional guidance for the expanded area (e.g. "continue the living room with a dining area").

formatstring

Output format.

Default: "png"

png

Request Example

json
{
  "model": "expand",
  "image": "https://example.com/cropped-room.jpg",
  "prompt": "continue the room with large windows overlooking a garden"
}

Response

Success (200)

json
{
  "status": "success",
  "result": {
    "image_url": "https://storage.googleapis.com/...",
    "model": "expand",
    "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": "expand",
  "image": "https://example.com/cropped-room.jpg",
  "prompt": "continue the room with large windows overlooking a garden"
}'

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": "expand",
  "image": "https://example.com/cropped-room.jpg",
  "prompt": "continue the room with large windows overlooking a garden"
}),
});

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": "expand",
  "image": "https://example.com/cropped-room.jpg",
  "prompt": "continue the room with large windows overlooking a garden"
},
)

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

  • 1The AI expands in all directions — provide a prompt to guide what appears in the expanded area.
  • 2Works best when there are visual cues at the edges (partial furniture, wall lines) for the AI to continue.
  • 3Great for turning portrait-orientation photos into landscape format for marketing materials.