# Stability AI Replace Background and Relight

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

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.

## Facts

- Endpoint: POST https://stability-ai.x402.paywithlocus.com/stability-ai/replace-background-and-relight?utm_source=zero.xyz
- Price: $0.092/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/stability-ai-replace-background-and-relight-f7c6bdbd
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_jz4Ibwh2sptJmOfeyiJBt

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-f7c6bdbd -d '<json body>'
```

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

## When to prefer this

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.

## Known failure modes

- 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

## How this service works

Generative AI platform for images, 3D models, and audio — text-to-image, editing, upscaling, and more.

## Output

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.

## Request schema (JSON Schema)

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

## Response schema (JSON Schema)

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

## More

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