# Stability AI Replace Background and Relight

> Stability AI Replace Background and Relight is a paid API for AI agents from Stability AI at stability-ai.mpp.paywithlocus.com, paid per call via MPP, $0.092/call, status unknown (last checked 2026-10-12).

Replaces the background of a subject image and applies directional relighting using a text prompt or reference image

## Facts

- Endpoint: POST https://stability-ai.mpp.paywithlocus.com/stability-ai/replace-background-and-relight?utm_source=zero.xyz
- Price: $0.092/call
- Payment: MPP
- Status: unknown
- Last checked: 2026-10-12
- Success rate: 0% of calls made through Zero
- Activations on Zero: 1
- Provider: Stability AI
- Docs: https://platform.stability.ai/docs/api-reference
- Website: https://stability.ai
- Tags: image-generation, stable-diffusion, upscaling, 3d, ai, media
- Canonical page: https://www.zero.xyz/c/stability-ai-replace-background-and-relight-9c7448b7
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_2x674gGODY-CRaRavsdc3

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability stability-ai-replace-background-and-relight-9c7448b7 -d '<json body>'
```

Example prompt: 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.

## When to prefer this

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.

## Known failure modes

- 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

## How this service works

Replace the background of a subject image and adjust lighting. Returns async ID — poll /results/{id}.

## Output

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.

## Request schema (JSON Schema)

```json
{
 "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
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/stability-ai-replace-background-and-relight-9c7448b7/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from stability-ai.mpp.paywithlocus.com](https://www.zero.xyz/host/stability-ai.mpp.paywithlocus.com/llms.txt)
