Skip to content

Python SDK

Terminal window
pip install remodeled-ai

Python 3.9 or newer. Built on httpx, with a sync and an async client. Answers are plain dicts, typed with TypedDicts made from the OpenAPI document, so editors and type checkers know every field.

from remodeled import Remodeled
client = Remodeled() # reads REMODELED_API_KEY
photo = client.uploads.create("living-room.jpg")
design = client.designs.create_and_wait(
mode="remodel",
input_asset_id=photo["id"],
room="Living room",
style="Japandi",
)
print(design["images"][0]["asset"]["url"])

Fields take Python’s snake_case (input_asset_id, mask_asset_id) and are sent as the API’s camelCase. Answers keep the API’s names (design["creditsCharged"]).

client = Remodeled(
api_key="rmk_...", # default: REMODELED_API_KEY
base_url="https://api.remodeled.ai", # default: REMODELED_BASE_URL, then this
timeout=60.0, # seconds per request (a held wait adds its own time)
max_retries=2, # for 429, 5xx and network errors
default_headers={},
http_client=None, # your own httpx.Client
)

Use it as a context manager (with Remodeled() as client:) or call client.close() when you’re done.

import asyncio
from remodeled import AsyncRemodeled
async def main() -> None:
async with AsyncRemodeled() as client:
photo = await client.uploads.from_url("https://example.com/living-room.jpg")
design = await client.designs.create_and_wait(mode="staging", input_asset_id=photo["id"], style="Modern")
print(design["images"][0]["asset"]["url"])
asyncio.run(main())

AsyncRemodeled has the same methods, awaited. designs.list_all() is an async iterator.

client.uploads.create("photo.jpg") # a path
client.uploads.create(open("photo.jpg", "rb")) # an open binary file
client.uploads.create(data, content_type="image/heic") # bytes
client.uploads.from_url("https://example.com/photo.jpg") # the API fetches it
Method What it does
designs.create(**params, idempotency_key=None, wait=None) Starts a design. wait in seconds (or True for 60).
designs.create_and_wait(**params) Starts one and waits until it is final. Raises DesignFailedError if it failed.
designs.get(id, wait=None) One design, optionally held until it finishes.
designs.wait(id, wait_timeout=300, throw_on_failure=True) Waits for a design you started earlier.
designs.list(limit=None, cursor=None) One page, newest first.
designs.list_all(limit=100) Every design, across all pages.
designs.delete(id) Deletes a design.
catalog = client.catalog.get() # rooms, styles, models, prices
account = client.account.get() # credits, this key's limit and use
from remodeled import APIError, DesignFailedError, InsufficientCreditsError
try:
client.designs.create_and_wait(mode="remodel", input_asset_id=photo["id"])
except InsufficientCreditsError as e:
notify_billing(e.details)
except DesignFailedError as e:
print(e.design["error"]["code"])
except APIError as e:
print(e.status, e.code, e.request_id)

Every API error is an APIError with status, code, message, details, request_id and headers. Subclasses: InvalidRequestError, AuthenticationError, InsufficientCreditsError, PermissionDeniedError, NotFoundError, ConflictError, RateLimitError, InternalServerError. Without an answer: APIConnectionError or APITimeoutError. See all error codes.

from remodeled import webhooks, WebhookVerificationError
event = webhooks.verify(raw_body, headers.get("Remodeled-Signature"), secret)

Pass the raw body as received (bytes or str). webhooks.sign(payload, secret) makes a valid header for your own tests. See Webhooks.