Replace image backgrounds and relight subjects with AI via pay-per-call MPP endpoint.
What it does
This endpoint provides Stability AI's Replace Background & Relight capability through the Locus MPP (Micropayment Protocol) gateway. It accepts a foreground subject image and generates a new background based on a text prompt or reference image, while adjusting lighting on the subject to match the new scene. Parameters include light source direction (left/right/above/below), light intensity, foreground and background prompts, and output format selection.
The endpoint is part of a broader Stability AI service suite available through Locus MPP that includes image generation (Ultra, Core, SD3), editing (erase, inpaint, outpaint, search-and-replace, search-and-recolor), upscaling, style transfer, 3D model generation, and audio generation. This specific endpoint costs $0.092 per call (92,000 base units of pathUSD with 6 decimals), settled via the Tempo method on-chain.
The endpoint accepts POST requests with a JSON body. Only `subject_image` is required; all other parameters (background_prompt, background_reference, foreground_prompt, light_source_direction, light_source_strength, output_format, seed) are optional. The OpenAPI spec is well-documented. Note that the probe returned 404 on HEAD/GET methods, which is expected since this is a POST-only endpoint.
Capabilities
Use cases
- —Product photography: replace studio backgrounds with lifestyle scenes and match lighting automatically
- —E-commerce: generate multiple background variants for the same product image
- —Creative compositing: place subjects in new environments with physically plausible lighting
- —Marketing asset generation: quickly produce scene variations without reshooting
Fit
Best for
- —Agents needing automated product photo background replacement at scale
- —Workflows requiring consistent relighting when compositing subjects into new scenes
- —Pay-per-use image editing without API key management (MPP handles payment)
- —Programmatic generation of marketing visuals with varied backgrounds
Not for
- —Video background replacement or real-time processing
- —Tasks requiring free/no-cost image editing
- —Use cases needing fine-grained manual lighting control beyond directional presets
Quick start
curl -X POST https://stability-ai.mpp.paywithlocus.com/stability-ai/replace-background-and-relight \
-H "Content-Type: application/json" \
-d '{
"subject_image": "<base64-encoded-image>",
"background_prompt": "tropical beach at sunset",
"light_source_direction": "left",
"light_source_strength": 0.7,
"output_format": "png"
}'Example
Request
{
"seed": 42,
"output_format": "jpeg",
"subject_image": "<base64-encoded-image>",
"background_prompt": "modern office with large windows and natural light",
"foreground_prompt": "person in business attire",
"light_source_strength": 0.6,
"light_source_direction": "above"
}Endpoint
Quality
Full OpenAPI schema with clear parameter documentation and pricing is available. However, the endpoint probe returned 404 on HEAD/GET (expected for POST-only), no actual 402 challenge was captured for this specific path, no response schema or example response is documented, and crawled pages returned no useful content beyond error messages.
Warnings
- —Probe did not capture a 402 challenge on this endpoint (HEAD/GET returned 404); endpoint is POST-only so liveness could not be confirmed via the probe methods used
- —No response schema documented — output format/structure is unknown
- —Currency address 0x20c000000000000000000000b9537d11c60e8b50 assumed to be pathUSD (6 decimals) based on context but not independently verified
Citations
- —Endpoint costs 92,000 base units via Tempo methodhttps://stability-ai.mpp.paywithlocus.com
- —Required parameter is subject_image; optional parameters include background_prompt, background_reference, foreground_prompt, light_source_direction, light_source_strength, output_format, seedhttps://stability-ai.mpp.paywithlocus.com
- —API reference available at platform.stability.aihttps://platform.stability.ai/docs/api-reference
- —LLM-readable docs at beta.paywithlocus.com/mpp/stability-ai.mdhttps://beta.paywithlocus.com/mpp/stability-ai.md