Idempotency and retries
Networks fail between “the API started the design” and “your code heard about it”. Retrying blindly would start, and pay for, a second design. An Idempotency-Key header prevents that.
curl -X POST https://api.remodeled.ai/public/v1/designs \ -H "Authorization: Bearer $REMODELED_API_KEY" \ -H "Idempotency-Key: listing-4471-photo-3-japandi" \ -H "Content-Type: application/json" \ -d '{"mode": "remodel", "inputAssetId": "01a1ebfd-494e-752c-86b5-d58f61313030", "style": "Japandi"}'- A start with a key that was already used answers the same design as the first time, and charges nothing more.
- Keys are 1 to 100 ASCII characters and belong to the account.
- Make them from your own ids (listing, photo, style), so a whole job can be re-run safely after a crash.
In the SDKs
Section titled “In the SDKs”The SDKs make a random key for every designs.create and reuse it on their own retries, so their automatic retries are always safe. Pass your own to make re-runs of your job safe as well:
await client.designs.create({ mode: 'remodel', inputAssetId, style }, { idempotencyKey: `listing-${id}-photo-${n}` });client.designs.create(mode="remodel", input_asset_id=asset_id, style=style, idempotency_key=f"listing-{id}-photo-{n}")Which requests
Section titled “Which requests”Only POST /public/v1/designs takes the header. Uploads are cheap and free, so a retried upload just makes another photo id. GET and DELETE are safe to repeat as they are.
The OpenAI-compatible endpoint has no header, because the OpenAI SDKs don’t send one. It recognises their retries of the same request instead.