{"uid":"cap_jz4Ibwh2sptJmOfeyiJBt","slug":"stability-ai-replace-background-and-relight-f7c6bdbd","name":"Stability AI Replace Background and Relight","description":"Generative AI platform for images, 3D models, and audio — text-to-image, editing, upscaling, and more.","url":"https://stability-ai.x402.paywithlocus.com/stability-ai/replace-background-and-relight?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"seed":{"type":"number"},"output_format":{"type":"string"},"subject_image":{"type":"string"},"background_prompt":{"type":"string"},"foreground_prompt":{"type":"string"},"background_reference":{"type":"string"},"light_source_strength":{"type":"number"},"light_source_direction":{"type":"string"}}},"responseSchema":{"type":"json","example":{"data":{},"payment":{"scheme":"exact","settledUsdc":"0.001000","authorizedMaxUsdc":"0.001000"},"request":{"id":"00000000-0000-4000-8000-000000000000","statusUrl":"/requests/00000000-0000-4000-8000-000000000000"},"success":true}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.092","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.092/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.092","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.092","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_Yh1xWzBPwC0JBaL-iATr1","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.092","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Replaces the background of a subject image with a new scene described by text or reference image, and applies directional relighting to the foreground subject.","exampleAgentPrompt":"Take this product photo of a sneaker and replace the background with a sunny beach scene, light coming from the left at about 0.8 intensity, and give me a PNG back.","exampleUseCases":[{"title":"E-commerce product background swap","prompt":"I have a product photo of a white coffee mug and I want the background replaced with a cozy rustic kitchen scene. Apply lighting from above at strength 0.7 and export as a JPEG."},{"title":"Professional headshot background replacement","prompt":"Can you take this headshot photo and swap the background with a blurred modern office interior? Light should come from the right at 0.6 intensity, and save it as a PNG."},{"title":"Automotive marketing composite","prompt":"I need this car photo placed in front of a dramatic mountain sunset — describe the foreground as a red sports car, background as golden-hour mountains, lighting from the left at full strength, and return a webp."}],"resultDescription":"Returns a JSON object with a `data` field containing the composited and relighted image (typically as base64 or a reference), along with payment settlement details showing the USDC amount charged, and a request ID with a status URL for async polling if needed.","failureModes":["Missing subject_image results in a 400 validation error","Invalid output_format value (not jpeg/png/webp) returns a schema validation error","Light source direction outside allowed enum (left/right/above/below) causes rejection","Malformed or inaccessible image URL for subject_image or background_reference causes processing failure","Payment failure or insufficient USDC balance causes a 402 Payment Required response","Seed value out of acceptable range may be ignored or cause an error","Network timeout if image processing takes longer than expected"],"whenToPreferThis":"Choose this endpoint when you need to both replace a background and apply directional relighting to the subject in a single API call. It is ideal for product photography automation, e-commerce image pipelines, and portrait editing where consistent lighting across composited scenes is critical. Prefer this over a plain background-removal endpoint when lighting coherence between foreground and background matters.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-13T06:23:28.838Z","isFirstParty":false,"canonicalSlug":"stability-ai-replace-background-and-relight-f7c6bdbd"}