{"uid":"cap_2x674gGODY-CRaRavsdc3","slug":"stability-ai-replace-background-and-relight-9c7448b7","name":"Stability AI Replace Background and Relight","description":"Replace the background of a subject image and adjust lighting. Returns async ID — poll /results/{id}.","url":"https://stability-ai.mpp.paywithlocus.com/stability-ai/replace-background-and-relight?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","required":["subject_image"],"properties":{"seed":{"type":"number","description":"Random seed"},"output_format":{"type":"string","description":"jpeg|png|webp"},"subject_image":{"type":"string","description":"Foreground subject image Send a public HTTPS URL (recommended; files up to 10 MiB) or base64/data URI. Hosted MPP JSON requests must stay below 8 KiB, so use a URL for larger files."},"background_prompt":{"type":"string","description":"Text description of the new background"},"foreground_prompt":{"type":"string","description":"Description of the foreground subject"},"background_reference":{"type":"string","description":"Reference image for the new background Send a public HTTPS URL (recommended; files up to 10 MiB) or base64/data URI. Hosted MPP JSON requests must stay below 8 KiB, so use a URL for larger files."},"light_source_strength":{"type":"number","description":"Light intensity 0–1"},"light_source_direction":{"type":"string","description":"left|right|above|below"}},"additionalProperties":true},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["image-generation","stable-diffusion","upscaling","3d","ai","media"],"displayCostAmount":"0.092","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"settled","requiresHandshake":false,"reviewCount":1,"rating":{"score":"0.00","successRate":"0.00","reviews":1,"stars":null,"state":"rated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.092/call","primary":{"kind":"static","protocol":"mpp","network":"tempo","amountUsd":"0.092","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"mpp","network":"tempo","amountUsd":"0.092","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_eexmGCKvcZlhmuOC-s7ZQ","protocol":"mpp","methodType":"crypto","chain":"tempo","mode":"charge","costAmount":"0.092","costPer":"request","priority":0,"asset":"0x20c000000000000000000000b9537d11c60e8b50","unit":"request","depositMicros":null,"planRef":null}],"brandName":"Stability AI","brandSlug":"stability-ai","brandBaseUrl":"https://stability.ai","brandDocsUrl":"https://platform.stability.ai/docs/api-reference","whatItDoes":"Replaces the background of a subject image and applies directional relighting using a text prompt or reference image","exampleAgentPrompt":"Take this product photo and replace the background with a cozy coffee shop interior — light coming from the left at about 0.8 strength — and return it as a PNG.","exampleUseCases":null,"resultDescription":"Returns a new image file (JPEG, PNG, or WebP) where the subject from the input image has been composited onto a newly generated or referenced background, with lighting adjusted according to the specified direction and strength.","failureModes":["Missing subject_image returns 400 validation error","Invalid output_format value returns 400 error","Background prompt too vague may produce irrelevant background","Light source strength outside 0–1 range returns validation error","Low-quality or ambiguous subject image may produce poor cutout/compositing","Unsupported image format for subject_image returns error","Seed out of valid range returns error"],"whenToPreferThis":"Choose this endpoint when you need to both replace a background AND apply coherent relighting to match the new scene — ideal for product photography, e-commerce, portrait editing, or marketing assets where lighting consistency between subject and background is critical. Prefer over simple background removal tools when the output image needs realistic lighting integration.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":1,"lastUsedAt":"2026-05-22T15:46:03.002Z","lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-12T18:39:04.982Z","isFirstParty":false,"canonicalSlug":"stability-ai-replace-background-and-relight-9c7448b7"}