# Stability AI

> **You are on:** `https://beta-api.paywithlocus.com/api` | [llms.txt](https://beta.paywithlocus.com/llms.txt)
>
> Locus runs on multiple environments -- make sure every URL you call matches your expected environment.
> | Environment | Landing | API |
> |---|---|---|
> | Production | paywithlocus.com | api.paywithlocus.com |
> | Beta | beta.paywithlocus.com | beta-api.paywithlocus.com |
> | Stage | stage.paywithlocus.com | stage-api.paywithlocus.com |
>
> If the API URL above doesn't match your expected environment, re-fetch this file from the correct domain.

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

**Category:** AI / Generative | **Website:** [stability.ai](https://stability.ai) | **Docs:** [platform.stability.ai/docs/api-reference](https://platform.stability.ai/docs/api-reference)

## Access Methods

| Method | Base URL | Auth |
|--------|----------|------|
| **MPP (Tempo)** | `https://stability-ai.mpp.paywithlocus.com/stability-ai/` | HTTP 402 auto-payment |
| **Wrapped API** | `https://beta-api.paywithlocus.com/api/wrapped/stability-ai/` | `Authorization: Bearer <LOCUS_API_KEY>` |

**OpenAPI discovery:** `GET https://stability-ai.mpp.paywithlocus.com/openapi.json`

## Endpoints

### Generate Ultra

Stable Image Ultra — highest quality text-to-image generation.

**Estimated cost:** $0.092

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `prompt` | string | Yes | Text prompt |
| `negative_prompt` | string | No | Things to exclude from the image |
| `aspect_ratio` | string | No | Output aspect ratio: 21:9|16:9|3:2|5:4|1:1|4:5|2:3|9:16 (default 1:1) |
| `output_format` | string | No | jpeg|png|webp (default jpeg) |
| `seed` | number | No | Random seed |
| `style_preset` | string | No | Style preset (e.g. photographic, digital-art, cinematic) |
| `image` | string (base64) | No | Input image for img2img (requires strength) |
| `strength` | number | No | img2img influence 0–1 |

```bash
curl -X POST https://stability-ai.mpp.paywithlocus.com/stability-ai/generate-ultra \
  -H "Content-Type: application/json" \
  -d '{"prompt":"<string>","negative_prompt":"<string>","aspect_ratio":"<string>","output_format":"<string>","seed":"<number>","style_preset":"<string>","image":"<string (base64)>","strength":"<number>"}'
```

### Generate Core

Stable Image Core — fast, high-quality text-to-image generation.

**Estimated cost:** $0.035

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `prompt` | string | Yes | Text prompt |
| `negative_prompt` | string | No | Things to exclude from the image |
| `aspect_ratio` | string | No | Output aspect ratio: 21:9|16:9|3:2|5:4|1:1|4:5|2:3|9:16 (default 1:1) |
| `output_format` | string | No | jpeg|png|webp (default jpeg) |
| `seed` | number | No | Random seed |
| `style_preset` | string | No | Style preset (e.g. photographic, digital-art) |

```bash
curl -X POST https://stability-ai.mpp.paywithlocus.com/stability-ai/generate-core \
  -H "Content-Type: application/json" \
  -d '{"prompt":"<string>","negative_prompt":"<string>","aspect_ratio":"<string>","output_format":"<string>","seed":"<number>","style_preset":"<string>"}'
```

### Generate SD3

Stable Diffusion 3.5 family — choose model for quality/speed/cost balance.

**Estimated cost:** $0.029–$0.075 (model-dependent)

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `prompt` | string | Yes | Text prompt |
| `model` | string | No | sd3.5-large ($0.075) | sd3.5-large-turbo ($0.046) | sd3.5-medium ($0.040) | sd3.5-flash ($0.029) — default sd3.5-medium |
| `mode` | string | No | text-to-image (default) | image-to-image |
| `image` | string (base64) | No | Input image for image-to-image mode |
| `strength` | number | No | img2img influence 0–1 |
| `negative_prompt` | string | No | Things to exclude from the image |
| `aspect_ratio` | string | No | Output aspect ratio (default 1:1) |
| `cfg_scale` | number | No | Classifier-free guidance scale |
| `output_format` | string | No | jpeg|png|webp |
| `seed` | number | No | Random seed |

```bash
curl -X POST https://stability-ai.mpp.paywithlocus.com/stability-ai/generate-sd3 \
  -H "Content-Type: application/json" \
  -d '{"prompt":"<string>","model":"<string>","mode":"<string>","image":"<string (base64)>","strength":"<number>","negative_prompt":"<string>","aspect_ratio":"<string>","cfg_scale":"<number>","output_format":"<string>","seed":"<number>"}'
```

### Erase

Remove objects from an image using a mask.

**Estimated cost:** $0.058

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `image` | string (base64) | Yes | Source image |
| `mask` | string (base64) | No | Mask image (white = erase) |
| `grow_mask` | number | No | Expand mask by N pixels |
| `output_format` | string | No | jpeg|png|webp |
| `seed` | number | No | Random seed |

```bash
curl -X POST https://stability-ai.mpp.paywithlocus.com/stability-ai/erase \
  -H "Content-Type: application/json" \
  -d '{"image":"<string (base64)>","mask":"<string (base64)>","grow_mask":"<number>","output_format":"<string>","seed":"<number>"}'
```

### Inpaint

Fill a masked region with AI-generated content guided by a prompt.

**Estimated cost:** $0.058

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `image` | string (base64) | Yes | Source image |
| `prompt` | string | Yes | Fill prompt |
| `mask` | string (base64) | No | Mask image (white = fill) |
| `negative_prompt` | string | No | Things to exclude |
| `grow_mask` | number | No | Expand mask by N pixels |
| `output_format` | string | No | jpeg|png|webp |
| `seed` | number | No | Random seed |

```bash
curl -X POST https://stability-ai.mpp.paywithlocus.com/stability-ai/inpaint \
  -H "Content-Type: application/json" \
  -d '{"image":"<string (base64)>","prompt":"<string>","mask":"<string (base64)>","negative_prompt":"<string>","grow_mask":"<number>","output_format":"<string>","seed":"<number>"}'
```

### Outpaint

Extend image borders by generating new content outside the frame.

**Estimated cost:** $0.046

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `image` | string (base64) | Yes | Source image |
| `left` | number | No | Pixels to add on the left |
| `right` | number | No | Pixels to add on the right |
| `up` | number | No | Pixels to add on top |
| `down` | number | No | Pixels to add on bottom |
| `prompt` | string | No | Guide prompt |
| `creativity` | number | No | Creativity level 0–1 |
| `output_format` | string | No | jpeg|png|webp |
| `seed` | number | No | Random seed |

```bash
curl -X POST https://stability-ai.mpp.paywithlocus.com/stability-ai/outpaint \
  -H "Content-Type: application/json" \
  -d '{"image":"<string (base64)>","left":"<number>","right":"<number>","up":"<number>","down":"<number>","prompt":"<string>","creativity":"<number>","output_format":"<string>","seed":"<number>"}'
```

### Search and Replace

Find an object by description and replace it with something new.

**Estimated cost:** $0.058

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `image` | string (base64) | Yes | Source image |
| `prompt` | string | Yes | What to replace the object with |
| `search_prompt` | string | Yes | Description of the object to find and replace |
| `negative_prompt` | string | No | Things to exclude |
| `grow_mask` | number | No | Expand detection mask by N pixels |
| `output_format` | string | No | jpeg|png|webp |
| `seed` | number | No | Random seed |

```bash
curl -X POST https://stability-ai.mpp.paywithlocus.com/stability-ai/search-and-replace \
  -H "Content-Type: application/json" \
  -d '{"image":"<string (base64)>","prompt":"<string>","search_prompt":"<string>","negative_prompt":"<string>","grow_mask":"<number>","output_format":"<string>","seed":"<number>"}'
```

### Search and Recolor

Find an object by description and recolor it.

**Estimated cost:** $0.058

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `image` | string (base64) | Yes | Source image |
| `prompt` | string | Yes | New color/appearance for the object |
| `select_prompt` | string | Yes | Description of the object to recolor |
| `negative_prompt` | string | No | Things to exclude |
| `output_format` | string | No | jpeg|png|webp |
| `seed` | number | No | Random seed |

```bash
curl -X POST https://stability-ai.mpp.paywithlocus.com/stability-ai/search-and-recolor \
  -H "Content-Type: application/json" \
  -d '{"image":"<string (base64)>","prompt":"<string>","select_prompt":"<string>","negative_prompt":"<string>","output_format":"<string>","seed":"<number>"}'
```

### Remove Background

Automatically remove the background from an image.

**Estimated cost:** $0.058

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `image` | string (base64) | Yes | Source image |
| `output_format` | string | No | png|webp (default png) |

```bash
curl -X POST https://stability-ai.mpp.paywithlocus.com/stability-ai/remove-background \
  -H "Content-Type: application/json" \
  -d '{"image":"<string (base64)>","output_format":"<string>"}'
```

### Replace Background & Relight

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

**Estimated cost:** $0.092

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `subject_image` | string (base64) | Yes | Foreground subject image |
| `background_prompt` | string | No | Text description of the new background |
| `background_reference` | string (base64) | No | Reference image for the new background |
| `foreground_prompt` | string | No | Description of the foreground subject |
| `light_source_direction` | string | No | left|right|above|below |
| `light_source_strength` | number | No | Light intensity 0–1 |
| `output_format` | string | No | jpeg|png|webp |
| `seed` | number | No | Random seed |

```bash
curl -X POST https://stability-ai.mpp.paywithlocus.com/stability-ai/replace-background-and-relight \
  -H "Content-Type: application/json" \
  -d '{"subject_image":"<string (base64)>","background_prompt":"<string>","background_reference":"<string (base64)>","foreground_prompt":"<string>","light_source_direction":"<string>","light_source_strength":"<number>","output_format":"<string>","seed":"<number>"}'
```

### Upscale Fast

4× fast upscaling in ~1 second.

**Estimated cost:** $0.023

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `image` | string (base64) | Yes | Source image |
| `output_format` | string | No | jpeg|png|webp |

```bash
curl -X POST https://stability-ai.mpp.paywithlocus.com/stability-ai/upscale-fast \
  -H "Content-Type: application/json" \
  -d '{"image":"<string (base64)>","output_format":"<string>"}'
```

### Upscale Conservative

Upscale to 4K preserving original detail with minimal AI changes.

**Estimated cost:** $0.46

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `image` | string (base64) | Yes | Source image |
| `prompt` | string | Yes | Description of the image content |
| `negative_prompt` | string | No | Things to exclude |
| `creativity` | number | No | Detail enhancement level 0–1 (default 0.35) |
| `output_format` | string | No | jpeg|png|webp |
| `seed` | number | No | Random seed |

```bash
curl -X POST https://stability-ai.mpp.paywithlocus.com/stability-ai/upscale-conservative \
  -H "Content-Type: application/json" \
  -d '{"image":"<string (base64)>","prompt":"<string>","negative_prompt":"<string>","creativity":"<number>","output_format":"<string>","seed":"<number>"}'
```

### Upscale Creative

Upscale to 4K with AI-enhanced detail generation. Returns async ID — poll /results/{id}.

**Estimated cost:** $0.69

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `image` | string (base64) | Yes | Source image |
| `prompt` | string | Yes | Description of the image content |
| `negative_prompt` | string | No | Things to exclude |
| `creativity` | number | No | AI enhancement level 0–1 (default 0.3) |
| `style_preset` | string | No | Style preset |
| `output_format` | string | No | jpeg|png|webp |
| `seed` | number | No | Random seed |

```bash
curl -X POST https://stability-ai.mpp.paywithlocus.com/stability-ai/upscale-creative \
  -H "Content-Type: application/json" \
  -d '{"image":"<string (base64)>","prompt":"<string>","negative_prompt":"<string>","creativity":"<number>","style_preset":"<string>","output_format":"<string>","seed":"<number>"}'
```

### Sketch

Convert a rough sketch into a detailed image guided by a prompt.

**Estimated cost:** $0.058

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `image` | string (base64) | Yes | Sketch / line art image |
| `prompt` | string | Yes | Target image description |
| `control_strength` | number | No | Sketch adherence 0–1 (default 0.7) |
| `negative_prompt` | string | No | Things to exclude |
| `output_format` | string | No | jpeg|png|webp |
| `seed` | number | No | Random seed |

```bash
curl -X POST https://stability-ai.mpp.paywithlocus.com/stability-ai/sketch \
  -H "Content-Type: application/json" \
  -d '{"image":"<string (base64)>","prompt":"<string>","control_strength":"<number>","negative_prompt":"<string>","output_format":"<string>","seed":"<number>"}'
```

### Structure

Generate an image that preserves the structural layout of a source image.

**Estimated cost:** $0.058

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `image` | string (base64) | Yes | Structure reference image |
| `prompt` | string | Yes | Target image description |
| `control_strength` | number | No | Structure adherence 0–1 (default 0.7) |
| `negative_prompt` | string | No | Things to exclude |
| `output_format` | string | No | jpeg|png|webp |
| `seed` | number | No | Random seed |

```bash
curl -X POST https://stability-ai.mpp.paywithlocus.com/stability-ai/structure \
  -H "Content-Type: application/json" \
  -d '{"image":"<string (base64)>","prompt":"<string>","control_strength":"<number>","negative_prompt":"<string>","output_format":"<string>","seed":"<number>"}'
```

### Style Guide

Extract a visual style from a reference image and apply it to new content.

**Estimated cost:** $0.058

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `image` | string (base64) | Yes | Style reference image |
| `prompt` | string | Yes | Target image description |
| `fidelity` | number | No | Style fidelity 0–1 (default 0.5) |
| `aspect_ratio` | string | No | Output aspect ratio |
| `negative_prompt` | string | No | Things to exclude |
| `output_format` | string | No | jpeg|png|webp |
| `seed` | number | No | Random seed |

```bash
curl -X POST https://stability-ai.mpp.paywithlocus.com/stability-ai/style-guide \
  -H "Content-Type: application/json" \
  -d '{"image":"<string (base64)>","prompt":"<string>","fidelity":"<number>","aspect_ratio":"<string>","negative_prompt":"<string>","output_format":"<string>","seed":"<number>"}'
```

### Style Transfer

Transfer the artistic style of one image onto another.

**Estimated cost:** $0.092

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `init_image` | string (base64) | Yes | Content image to restyle |
| `style_image` | string (base64) | Yes | Style reference image |
| `prompt` | string | No | Additional prompt guidance |
| `style_strength` | number | No | Style intensity 0–1 |
| `composition_fidelity` | number | No | Preserve original composition 0–1 |
| `change_strength` | number | No | Overall change strength 0–1 |
| `output_format` | string | No | jpeg|png|webp |
| `seed` | number | No | Random seed |

```bash
curl -X POST https://stability-ai.mpp.paywithlocus.com/stability-ai/style-transfer \
  -H "Content-Type: application/json" \
  -d '{"init_image":"<string (base64)>","style_image":"<string (base64)>","prompt":"<string>","style_strength":"<number>","composition_fidelity":"<number>","change_strength":"<number>","output_format":"<string>","seed":"<number>"}'
```

### Stable Fast 3D

Generate a 3D GLTF model from a single image in seconds.

**Estimated cost:** $0.115

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `image` | string (base64) | Yes | Source image of the object |
| `texture_resolution` | number | No | 512|1024|2048 (default 1024) |
| `foreground_ratio` | number | No | Subject scale in frame (default 0.85) |
| `remesh` | string | No | none|triangle|quad |

```bash
curl -X POST https://stability-ai.mpp.paywithlocus.com/stability-ai/stable-fast-3d \
  -H "Content-Type: application/json" \
  -d '{"image":"<string (base64)>","texture_resolution":"<number>","foreground_ratio":"<number>","remesh":"<string>"}'
```

### Stable Point Aware 3D

Generate a 3D GLTF model with point-cloud awareness (SPAR3D).

**Estimated cost:** $0.046

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `image` | string (base64) | Yes | Source image of the object |
| `texture_resolution` | number | No | 512|1024|2048 (default 1024) |
| `foreground_ratio` | number | No | Subject scale in frame (default 1.3) |
| `guidance_scale` | number | No | Generation guidance scale (default 3) |
| `seed` | number | No | Random seed |

```bash
curl -X POST https://stability-ai.mpp.paywithlocus.com/stability-ai/stable-point-aware-3d \
  -H "Content-Type: application/json" \
  -d '{"image":"<string (base64)>","texture_resolution":"<number>","foreground_ratio":"<number>","guidance_scale":"<number>","seed":"<number>"}'
```

### Text to Audio

Generate music or sound effects from a text prompt.

**Estimated cost:** $0.23 (50 steps, stable-audio-2)

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `prompt` | string | Yes | Audio description prompt |
| `model` | string | No | stable-audio-2.5 ($0.23) | stable-audio-2 (step-based, default) |
| `duration` | number | No | Output duration in seconds (default 190) |
| `steps` | number | No | Inference steps — affects cost for stable-audio-2 (default 50) |
| `cfg_scale` | number | No | Guidance scale |
| `output_format` | string | No | mp3|wav (default mp3) |
| `seed` | number | No | Random seed |

```bash
curl -X POST https://stability-ai.mpp.paywithlocus.com/stability-ai/text-to-audio \
  -H "Content-Type: application/json" \
  -d '{"prompt":"<string>","model":"<string>","duration":"<number>","steps":"<number>","cfg_scale":"<number>","output_format":"<string>","seed":"<number>"}'
```

### Audio to Audio

Transform an existing audio file guided by a text prompt.

**Estimated cost:** $0.23 (50 steps, stable-audio-2)

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `audio` | string (base64) | Yes | Input audio file |
| `prompt` | string | Yes | Transformation description |
| `model` | string | No | stable-audio-2.5 | stable-audio-2 (default) |
| `strength` | number | No | Transformation intensity 0–1 (default 1) |
| `steps` | number | No | Inference steps (default 50) |
| `output_format` | string | No | mp3|wav |
| `seed` | number | No | Random seed |

```bash
curl -X POST https://stability-ai.mpp.paywithlocus.com/stability-ai/audio-to-audio \
  -H "Content-Type: application/json" \
  -d '{"audio":"<string (base64)>","prompt":"<string>","model":"<string>","strength":"<number>","steps":"<number>","output_format":"<string>","seed":"<number>"}'
```

### Audio Inpaint

Replace a section of an audio file with AI-generated content.

**Estimated cost:** $0.23 (50 steps, stable-audio-2)

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `audio` | string (base64) | Yes | Input audio file |
| `prompt` | string | Yes | Description of replacement content |
| `mask_start` | number | No | Start of masked region in seconds (default 30) |
| `mask_end` | number | No | End of masked region in seconds (default 190) |
| `model` | string | No | stable-audio-2.5 | stable-audio-2 (default) |
| `steps` | number | No | Inference steps (default 8) |
| `output_format` | string | No | mp3|wav |

```bash
curl -X POST https://stability-ai.mpp.paywithlocus.com/stability-ai/audio-inpaint \
  -H "Content-Type: application/json" \
  -d '{"audio":"<string (base64)>","prompt":"<string>","mask_start":"<number>","mask_end":"<number>","model":"<string>","steps":"<number>","output_format":"<string>"}'
```

### Result

Poll the result of an async operation (creative upscale, replace-background-and-relight).

**Estimated cost:** Free

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `id` | string | Yes | Async generation ID returned by the initiating call |

```bash
curl -X POST https://stability-ai.mpp.paywithlocus.com/stability-ai/result \
  -H "Content-Type: application/json" \
  -d '{"id":"<string>"}'
```
