Felo API PlatformFelo API Platform
Back to models

Ideogram 4.5 Replace Background API

Ideogram 4.5 Replace Background swaps or removes image backgrounds while keeping foreground subjects and untouched pixels exactly intact, with native 2K output.

Ideogram 4.5 Replace Background is a precise editing tool in the Ideogram 4.5 family, built to remove and swap image backgrounds while preserving key foreground subjects. It delivers production-ready outputs with clean structure and sharp detail, and it preserves untouched pixels exactly during edits without pixel shifts or color changes. Untouched pixels are copied from the source image, and the original size is kept. Generation is native 2K resolution. A single request accepts up to five source images for editing, and an optional mask can limit edits to specific regions, where black pixels are edited and white pixels are preserved.

The tool suits work where the subject must stay exact while the setting changes. That includes clean product cutouts for online store listings, background changes for marketing campaigns, swapped room settings for interior design, and photo restoration workflows with sequential edits. Editing stays artifact-free across multiple rounds, and the model carries strong text rendering inherited from the Ideogram family, fitting into a comprehensive editing workflow.

It is available through the Ideogram platform and API, and through launch partners Picsart, Runway, Pika, and Leonardo AI. An open-weight release has been announced as coming soon.

Updated:

MODEL ID

ideogram-4-5/replace-background
Context
2.048K
Input
text / image
Output
image

Highlights

  • Removes and swaps backgrounds
  • Preserves foreground subjects
  • Native 2K resolution
  • Exact untouched pixels
  • Optional region mask
  • Up to five source images

Providers

1 providers

Compare API prices across providers. Select a provider to view all charges and conditions.

Provider · Pricing details
Uptime
$0.176

Quick Start

Submit an image task, poll its status, then save the images. These examples use curl and Python 3 (standard library only).

POST https://openapi.felo.ai/api/v1/images/generations

1Get your API key

Create a key from your Felo API Platform account and set it as an environment variable.

export FELO_API_KEY="YOUR_API_KEY"

2Make your first request

Optional values vary by model. This example leaves them unset; confirm supported values in Playground before adding them. Request fields sit alongside model and prompt, without an input wrapper.

curl --fail-with-body --max-time 60 "https://openapi.felo.ai/api/v1/images/generations" \
  -H "Authorization: Bearer $FELO_API_KEY" \
  -H "Content-Type: application/json" \
  -o created.json \
  -d '{
  "prompt": "A studio product photo of a ceramic coffee cup on warm linen, soft morning light",
  "model": "ideogram-4-5/replace-background"
}'

3Poll the task

Submission returns task_id. Poll every 3 seconds while queued or running; stop on succeeded, failed or interrupted. This example stops waiting after 30 minutes. Keep created.json to resume querying the same task instead of submitting again.

python3 - <<'PY'
import json, os, time
from pathlib import Path
from urllib.parse import quote
from urllib.request import Request, urlopen

task = json.loads(Path("created.json").read_text())
task_id = task["task_id"]
url = "https://openapi.felo.ai/api/v1/images/generations/" + quote(task_id, safe="")
headers = {"Authorization": "Bearer " + os.environ["FELO_API_KEY"]}
deadline = time.monotonic() + 1800

while task["status"] in ("queued", "running"):
    if time.monotonic() >= deadline:
        raise TimeoutError(f"Keep task_id={task_id} to resume polling")
    time.sleep(3)
    with urlopen(Request(url, headers=headers), timeout=60) as response:
        task = json.load(response)
    if task.get("task_id") != task_id or task.get("kind") != "image":
        raise ValueError("Unexpected task response")
    print(task["status"])

if task["status"] != "succeeded":
    raise RuntimeError(task.get("error") or task["status"])
if not task.get("outputs"):
    raise ValueError("Task succeeded without image outputs")
Path("task.json").write_text(json.dumps(task))
print("Saved task.json")
PY

4Download the output

After success, save outputs from task.json. Results may be HTTPS URLs, URL objects or b64_json. Download signed URLs promptly; media downloads do not use your API key.

python3 - <<'PY'
import base64, json
from pathlib import Path
from urllib.request import urlopen

task = json.loads(Path("task.json").read_text())
if task.get("status") != "succeeded" or not task.get("outputs"):
    raise ValueError("No completed image outputs")
extensions = {"image/png": ".png", "image/jpeg": ".jpg", "image/webp": ".webp", "image/gif": ".gif", "image/avif": ".avif"}

for index, output in enumerate(task["outputs"], 1):
    item = output if isinstance(output, dict) else {}
    url = output if isinstance(output, str) else item.get("url") or item.get("unsigned_url")
    mime = item.get("media_type") or "image/png"
    if url and url.startswith("https://"):
        with urlopen(url, timeout=60) as response:
            data = response.read()
            mime = response.headers.get_content_type()
    elif url and url.startswith("data:image/") and ";base64," in url:
        header, encoded = url.split(",", 1)
        mime = header[5:].split(";", 1)[0]
        data = base64.b64decode(encoded, validate=True)
    elif item.get("b64_json"):
        data = base64.b64decode(item["b64_json"], validate=True)
    else:
        raise ValueError("Unrecognized image output")
    path = Path(f"image-{index}" + extensions.get(mime, ".bin"))
    path.write_bytes(data)
    print(path)
PY

Prefer the full reference?

API reference →

Frequently asked questions

What is Ideogram 4.5 Replace Background?

Ideogram 4.5 Replace Background is a precise editing tool in the Ideogram 4.5 family, built to remove and swap image backgrounds while preserving key foreground subjects. It delivers production-ready outputs with clean structure and sharp detail, and it preserves untouched pixels exactly during edits without pixel shifts or color changes. Untouched pixels are copied from the source image, and the original size is kept. Generation is native 2K resolution. A single request accepts up to five source images for editing, and an optional mask can limit edits to specific regions, where black pixels are edited and white pixels are preserved. The tool suits work where the subject must stay exact while the setting changes. That includes clean product cutouts for online store listings, background changes for marketing campaigns, swapped room settings for interior design, and photo restoration workflows with sequential edits. Editing stays artifact-free across multiple rounds, and the model carries strong text rendering inherited from the Ideogram family, fitting into a comprehensive editing workflow. It is available through the Ideogram platform and API, and through launch partners Picsart, Runway, Pika, and Leonardo AI. An open-weight release has been announced as coming soon.

How is usage billed?

Your bill depends on the provider you use, its prices and your usage. Longer inputs or other conditions may have different prices.

What input and output does it support?

It accepts image input and produces image output. A request can include up to five source images for editing.

How does it keep the subject intact?

It removes and swaps backgrounds while preserving key foreground subjects, and it preserves untouched pixels exactly without pixel shifts or color changes.

Can I limit edits to a specific area?

Yes. An optional mask limits edits to specific regions: black pixels are edited and white pixels are preserved.

What resolution does it support?

It supports native 2K resolution generation and keeps the original image size.

What tasks is it suited for?

It is suited for product cutouts, marketing background changes, interior design room swaps, and photo restoration with sequential edits.

How does it relate to the Ideogram 4.5 family?

It is part of the Ideogram 4.5 family focused on precise editing capabilities. It is available through the Ideogram platform and API and through launch partners Picsart, Runway, Pika, and Leonardo AI.

Related models