---
title: Stable Diffusion API — SDXL, SD 3.5, ControlNet & 10,000+ Models | ModelsLab
description: Production Stable Diffusion REST API — SDXL, SD 1.5, SD 3.5, ControlNet, LoRA and inpainting via one endpoint. Flat $0.0047/image, plans from $21/mo, no cold starts.
url: https://modelslab.com/stable-diffusion-api
canonical: https://modelslab.com/stable-diffusion-api
type: website
component: Seo/StableDiffusionApi
generated_at: 2026-08-01T06:50:47.879232Z
---

Imagen

Stable Diffusion API for Developers
---

ModelsLab's Stable Diffusion API gives developers SDXL, SD 1.5, SD 2.1, and SD 3.5 — plus ControlNet, LoRA, inpainting, and 10,000+ community checkpoints — through one REST endpoint. Image generation is a flat $0.0047 per image with 2-4 second latency and no cold starts — plans from $21/month.

[Get Your Stable Diffusion API Key](https://modelslab.com/register) [API Documentation](https://docs.modelslab.com)

What is the ModelsLab Stable Diffusion API?
---

### Production Stable Diffusion, One REST Endpoint

The ModelsLab Stable Diffusion API gives developers programmatic access to the full Stable Diffusion family — SDXL, SD 1.5, SD 2.1, and SD 3.5 — plus 10,000+ community checkpoints and LoRAs, all through a single REST endpoint. You pass a model\_id and a prompt to /api/v7/images/text-to-image and receive hosted image URLs in JSON within a few seconds.

Stable Diffusion is the most widely used open image-generation model family, and running it well in production means managing GPUs, model loading, VRAM, and scaling. ModelsLab handles all of that: popular models stay warm, so there are no cold starts, and auto-scaling absorbs traffic spikes. You keep the Stable Diffusion workflow you already know and drop the infrastructure.

Beyond base models, the API exposes the tools Stable Diffusion developers rely on — ControlNet for structural guidance, LoRA for style and subject fine-tuning, and dedicated inpainting and image-to-image endpoints. The same API key also covers FLUX and 10,000+ other image, video, audio, and LLM models when your product grows.

### What You Can Build with the Stable Diffusion API

The Stable Diffusion API supports the full range of image workflows through one key:

- Text-to-Image — Generate images from prompts with SDXL, SD 1.5, SD 2.1, or SD 3.5 at up to 2048×2048
- Image-to-Image — Transform existing images with strength-controlled, prompt-guided edits
- Inpainting — Mask a region and regenerate it from a prompt for object removal and replacement
- ControlNet — Guide generation with pose, depth, edge, and segmentation reference maps
- LoRA & Custom Checkpoints — Attach community LoRAs or upload and serve your own fine-tuned models
- Upscaling — Enhance output resolution with super-resolution models through the same API

Trusted by

![Google logo](https://imagedelivery.net/PP4qZJxMlvGLHJQBm3ErNg/669b27bc-f881-4e16-569d-4ce02f1bc000/768)

![Salesforce logo](https://imagedelivery.net/PP4qZJxMlvGLHJQBm3ErNg/8f7d9952-1dee-4108-f1e5-96ff77108e00/768)

![Amazon logo](https://imagedelivery.net/PP4qZJxMlvGLHJQBm3ErNg/b4d3bc1b-8c2b-4d98-7c87-ed162ccbf400/768)

![IBM logo](https://imagedelivery.net/PP4qZJxMlvGLHJQBm3ErNg/41bf250b-c933-4d8a-6355-07cf4a2fda00/768)

![Adobe logo](https://imagedelivery.net/PP4qZJxMlvGLHJQBm3ErNg/9eb124dd-95c4-4889-c838-faa0f6317000/768)

![Sony logo](https://imagedelivery.net/PP4qZJxMlvGLHJQBm3ErNg/2d67a30b-a490-4b96-ce1d-28d8371da300/768)

1B+

Images Processed Monthly

500K+

Active Developers

5K+

Discord Community Members

300+

Available AI APIs

Stable Diffusion Models on One API
---

Every major Stable Diffusion base model, selected with a single model\_id. Pricing is a flat $0.0047 per image across all of them.

| Model | Best for | Native resolution | ModelsLab price |
|---|---|---|---|
| sdxl | High-quality general-purpose generation and photorealism | 1024×1024 | $0.0047/image |
| sd-3.5 | Improved prompt following, typography, and composition | 1024×1024 | $0.0047/image |
| sd-1.5 | Fast generation and the largest community LoRA ecosystem | 512×512 | $0.0047/image |
| sd-2.1 | Higher-resolution SD generation with refined outputs | 768×768 | $0.0047/image |

Stable Diffusion API Quick Start
---

Generate an image in seconds with a single REST call — cURL, Python, or JavaScript.

### Generate with SDXL using cURL

curl

```
<code>1curl -X POST "https://modelslab.com/api/v7/images/text-to-image" \
2  -H "Content-Type: application/json" \
3  -d '{
4    "key": "YOUR_API_KEY",
5    "model_id": "sdxl",
6    "prompt": "a cozy reading nook by a rainy window, warm light, photorealistic",
7    "negative_prompt": "blurry, distorted, low quality",
8    "width": 1024,
9    "height": 1024,
10    "samples": 1,
11    "num_inference_steps": 30,
12    "guidance_scale": 7.5
13  }'</code>
```

### Generate with Python (SD 3.5)

Python

```
<code>1import requests
2

3url = "https://modelslab.com/api/v7/images/text-to-image"
4payload = {
5    "key": "YOUR_API_KEY",
6    "model_id": "sd-3.5",
7    "prompt": "isometric illustration of a solar-powered smart home, clean vector style",
8    "width": 1024,
9    "height": 1024,
10    "samples": 2,
11    "num_inference_steps": 28,
12    "guidance_scale": 4.5
13}
14

15response = requests.post(url, json=payload)
16data = response.json()
17

18# data["output"] is a list of generated image URLs
19for i, image_url in enumerate(data["output"]):
20    print(f"Image {i+1}: {image_url}")</code>
```

### Inpainting with JavaScript

JavaScript

```
<code>1const response = await fetch('https://modelslab.com/api/v7/images/inpaint', {
2  method: 'POST',
3  headers: { 'Content-Type': 'application/json' },
4  body: JSON.stringify({
5    key: 'YOUR_API_KEY',
6    model_id: 'sdxl',
7    init_image: 'https://example.com/photo.jpg',
8    mask_image: 'https://example.com/mask.png',
9    prompt: 'replace with a bouquet of white peonies',
10    samples: 1
11  })
12});
13

14const data = await response.json();
15// data.output = array of inpainted image URLs
16data.output.forEach((url, i) => console.log(`Result ${i + 1}: ${url}`));</code>
```

One API: SDXL, SD 3.5, ControlNet & LoRA
---

Text-to-image, image-to-image, inpainting, ControlNet guidance, and custom checkpoints — all behind a single Stable Diffusion endpoint and one API key.

Every Stable Diffusion Base Model SDXL, SD 1.5, SD 2.1, and SD 3.5 are all available through the same text-to-image endpoint. Switch model\_id to move between speed, resolution, and quality without changing your integration.

ControlNet & LoRA Built In Use ControlNet for pose, depth, edge, and segmentation guidance, and attach community LoRAs to steer style. Both run through the standard API — no custom pipeline assembly required.

Inpainting & Image-to-Image Dedicated /inpaint and /image-to-image endpoints handle masked edits, object removal, and strength-controlled transformations, so editing workflows are a single call.

Custom Checkpoints Upload your own fine-tuned Stable Diffusion or SDXL checkpoints and serve them through the same endpoint as the base models — ideal for brand-specific pipelines.

![Every Stable Diffusion Base Model](https://imagedelivery.net/PP4qZJxMlvGLHJQBm3ErNg/8741a716-a81d-419a-c14f-88155af00c00/768)

![Example of AI outpainting result](https://images.modelslab.sh/?image=https://assets.modelslab.ai/generations/09738200-f1fc-442c-9852-7d6a9cd56d34.png&quality=25)

![Example of AI outpainting result](https://images.modelslab.sh/?image=https://assets.modelslab.ai/generations/851c5561-3239-4915-a66b-46d58d6c377c.png&quality=25)

![Example of AI outpainting result](https://images.modelslab.sh/?image=https://assets.modelslab.ai/generations/70d56252-0444-431d-82b9-ad15c260263e.png&quality=25)

![Example of AI outpainting result](https://images.modelslab.sh/?image=https://assets.modelslab.ai/generations/7b9995d6-68e1-48ba-bc0c-8e3a8f824faf.png&quality=25)

![Example of AI outpainting result](https://images.modelslab.sh/?image=https://assets.modelslab.ai/generations/878fc33a-be9d-4fef-a8a5-f2f9931cd1d3.jpg&quality=25)

Everything developers need to ship Stable Diffusion features in production.

[Get Started](https://modelslab.com/register)

Stable Diffusion API Comparison
---

How ModelsLab compares to other ways to run Stable Diffusion in production.

| Feature | ModelsLab | Self-hosted GPU | Generic serverless |
|---|---|---|---|
| Models available | SDXL, SD 1.5/2.1/3.5 + 10,000+ | Whatever you install | A handful, provider-picked |
| ControlNet & LoRA | Built in | DIY setup | Varies |
| Inpainting & image-to-image | Dedicated endpoints | DIY | Varies |
| Cold starts | None (warm) | None (always on) | Frequent |
| GPU / DevOps to manage | None | All of it | None |
| Cost model | $0.0047/image or $149/mo unlimited | Fixed GPU rental + ops time | Per-second, spiky |
| Free tier | Paid, from $21/mo | No | Trial credits |

Data as of July 2026. Self-hosted and serverless figures reflect typical setups; your costs will vary with hardware, utilization, and traffic pattern.

Related image API guides
---

[### Image Generation API

Full catalog: SDXL, SD 3.5, FLUX, and 10,000+ models through one endpoint.](https://modelslab.com/image-generation-api) [### Flux API

FLUX.1 Schnell, Dev, Pro, and Kontext via the same REST API and key.](https://modelslab.com/flux-api) [### ComfyUI API

Run ComfyUI workflows in the cloud without self-hosting the pipeline.](https://modelslab.com/comfyui-api)

How to Use the Stable Diffusion API
---

Generate your first image in under 5 minutes.

STEP 01

STEP 01

### Step 1: Get Your API Key

Create a ModelsLab account, subscribe to a plan (from $21/month), and generate your API key from the dashboard. Every plan includes SDXL, SD 3.5, ControlNet, and inpainting.

STEP 02

STEP 02

### Step 2: Choose a Model and Prompt

Send a POST request to /api/v7/images/text-to-image with model\_id set to sdxl, sd-3.5, or any community checkpoint, plus your prompt and parameters like width, height, and steps.

STEP 03

STEP 03

### Step 3: Get Your Images

Receive hosted image URLs in the JSON response within a few seconds. Use the /inpaint and /image-to-image endpoints for masked edits and transformations.

[Start Generating with Stable Diffusion ](https://modelslab.com/register)

### Stable Diffusion API Pricing

The Stable Diffusion API uses simple, flat pricing: $0.0047 per image on pay-as-you-go, the same across SDXL, SD 1.5, SD 2.1, and SD 3.5 with no resolution upcharge up to 2048×2048. That is roughly 8.5x cheaper than OpenAI DALL-E 3 at $0.040 per image, and undercuts the Stability AI API on comparable Stable Diffusion generation.

For high-volume workloads, the $149/month Open Source Unlimited plan removes per-image cost entirely — the cheapest option at scale. Paid plans start at $21/month (Basic) and $47/month (Standard), and dedicated enterprise endpoints with custom SLAs start at $249/month. Compared with self-hosting, you avoid GPU rental, VRAM tuning, and on-call ops entirely.

### API Response Format

The Stable Diffusion API returns a consistent JSON response across all endpoints. Generated images come back as publicly accessible URLs (available for 24 hours) or as base64 data for direct embedding. Synchronous requests return images in the response; for longer or batched jobs, use asynchronous mode and poll the fetch endpoint with the returned request\_id, or register a webhook to receive completions.

### Integration and SDKs

ModelsLab provides SDKs and integration paths for the Stable Diffusion API across popular stacks:

- Python SDK — pip install modelslab — full endpoint coverage with async support
- JavaScript/TypeScript — npm install modelslab — works in Node.js, Deno, and the browser
- REST API — standard HTTP endpoints usable from any language (cURL, Go, Ruby, PHP, Java)
- Webhook callbacks — receive generation completion notifications for async pipelines
- Documentation — per-parameter guides and examples at docs.modelslab.com

Why ModelsLab for the Stable Diffusion API?
---

Key advantages that set us apart

SDXL, SD 1.5, SD 2.1, SD 3.5 plus 10,000+ checkpoints on one endpoint

Flat $0.0047 per image with no resolution upcharge

$149/mo unlimited plan for high-volume generation

ControlNet for pose, depth, edge, and segmentation guidance

LoRA support and custom checkpoint upload

Dedicated inpainting and image-to-image endpoints

No cold starts on popular models — warm inference

No GPU, VRAM, or DevOps to manage

FLUX and 10,000+ other models on the same key

Plans start at $21/month (Basic, 3,250 API calls)

Our Popular Use Cases

What developers build with the Stable Diffusion API:

Design & Creative ToolsE-Commerce Product ImageryMarketing Creative AutomationCustom-Style ProductsControlNet WorkflowsContent Platforms

Embed Stable Diffusion generation and editing into design apps, letting users create, transform, and inpaint images on demand.

![Design & Creative Tools](https://imagedelivery.net/PP4qZJxMlvGLHJQBm3ErNg/0fbacb1a-6e34-4254-0a9d-5e75178cf200/768)

Stable Diffusion API FAQ
---

### What is the Stable Diffusion API?

The Stable Diffusion API is a REST API for generating and editing images with the Stable Diffusion model family. ModelsLab exposes SDXL, SD 1.5, SD 2.1, and SD 3.5 — plus ControlNet, LoRA, inpainting, and 10,000+ community checkpoints — through a single endpoint at /api/v7/images/text-to-image, so you can generate from text or edit existing images with a single model\_id change.


Stable Diffusion image generation is a flat $0.0047 per image on pay-as-you-go, the same across SDXL, SD 1.5, SD 2.1, and SD 3.5 with no resolution upcharge up to 2048×2048. That is about 8.5x cheaper than OpenAI DALL-E 3. For high volume, the $149/month unlimited plan removes per-image cost, and enterprise dedicated endpoints start at $249/month. Plans start at $21/month (Basic, 3,250 API calls).

### Which Stable Diffusion models are supported?

SDXL, SD 1.5, SD 2.1, and SD 3.5 are all supported, alongside 10,000+ community fine-tuned checkpoints and LoRAs. You select any of them with the model\_id parameter, and you can also upload and serve your own fine-tuned checkpoints.

### Does the API support ControlNet, LoRA, and inpainting?

Yes. ControlNet (pose, depth, edge, segmentation), LoRA styling, and dedicated inpainting and image-to-image endpoints are all available through the same API key. Text-to-image, image-to-image, inpainting, and ControlNet share one integration.

### How is this different from self-hosting Stable Diffusion?

Self-hosting means renting GPUs and managing model loading, VRAM, scaling, and on-call operations. The ModelsLab API removes all of that: popular models stay warm with no cold starts, auto-scaling absorbs spikes, and you pay a flat $0.0047 per image or $149/month for unlimited generation instead of paying for idle GPU time.


Yes. Migration is an endpoint and payload swap: point text-to-image calls at /api/v7/images/text-to-image, image edits at /api/v7/images/image-to-image, and masked edits at /api/v7/images/inpaint. Your prompts, guidance settings, and ControlNet workflows carry over, and responses return hosted image URLs in JSON.

### Is there a free way to test the Stable Diffusion API?

ModelsLab is a paid service — plans start at $21/month (Basic, 3,250 API calls) and include SDXL, SD 1.5, SD 3.5, ControlNet, and inpainting. Creating an account is free; API generation requires an active plan. The $47/month Standard plan (10,000 API calls) suits production volume.

Your Data is Secure: GDPR Compliant AI Services
---

![ModelsLab GDPR Compliance Certification Badge](https://imagedelivery.net/PP4qZJxMlvGLHJQBm3ErNg/28133112-07fe-4c1c-44eb-36948d51ae00/768)

AI Image API Pricing Starting at $0.0047 Per Image
---

ModelsLab offers subscription plans from $21/month (Basic) and $47/month (Standard, 10,000 API calls) to $149/month (Open Source Unlimited). All plans include access to Flux, SDXL, Stable Diffusion 3, and 10,000+ community models. Start free, cancel anytime, 100% refund policy.

Coming Soon
---

We are making some changes to our pricing, please check back later.

Get Expert Support in Seconds

We're Here to Help.
---

Want to know more? You can email us anytime at <support@modelslab.com>

Chat with support[View Docs](https://docs.modelslab.com)


Explore Our Other Solutions
---

Unlock your creative potential and scale your business with ModelsLab's comprehensive suite of AI-powered solutions.

[Audio Gen

### AI Audio Generation

Text-to-speech, voice cloning, music generation, and audio processing APIs.

Explore Audio Gen](https://modelslab.com/audio-gen) [Video Fusion

### AI Video Generation & Tools

Create, edit, and enhance videos with AI-powered generation and transformation tools.

Explore Video Fusion](https://modelslab.com/video-generation) [Chat

### Engage Seamlessly with LLM

Access powerful language models for chatbots, content generation, and AI assistants.

Explore Chat](https://modelslab.com/custom-llm) [3D Verse

### Create Stunning 3D Models

Transform images and text into 3D models with advanced AI-powered generation.

Explore 3D Verse](https://modelslab.com/text-to-3d)

Plugins

Explore Plugins for Pro
---

Our plugins are designed to work with the most popular content creation software.

[Explore Plugins](https://modelslab.com/pro#plugins) [Learn More](https://modelslab.com/pro)

API

Build Apps with ModelsLab

ML

 API
---

Use our API to build apps, generate AI art, create videos, and produce audio with ease.

[API Documentation](https://docs.modelslab.com) [Playground](https://modelslab.com/models)

## Frequently Asked Questions

### Which Stable Diffusion models does the API support?
ModelsLab serves the full Stable Diffusion family through one REST API: SDXL, SD 1.5, SD 2.1, and SD 3.5, plus 10,000+ community checkpoints and LoRAs. You select a model with a single model_id parameter, so you can move between base models and fine-tunes without changing your integration.

### Does the Stable Diffusion API support ControlNet, LoRA, and inpainting?
Yes. The API exposes ControlNet for pose, depth, and edge guidance, LoRA support for style and subject fine-tuning, and dedicated inpainting and image-to-image endpoints. Text-to-image, image-to-image, inpainting, and ControlNet all run through the same API key.

### How much does the Stable Diffusion API cost?
Stable Diffusion image generation is a flat $0.0047 per image on pay-as-you-go, with no resolution upcharge up to 2048×2048. High-volume teams use the $199/month Open Source Unlimited plan for unlimited generation. Paid plans start at $21/month (Basic) and $47/month (Standard). Pricing verified July 2026.

### How do I call the Stable Diffusion API?
Send a POST request to https://modelslab.com/api/v7/images/text-to-image with your API key, model_id (for example "sdxl" or "sd-3.5"), and a prompt. Images are returned as hosted URLs in the JSON response, usually within a few seconds. Python, JavaScript, and cURL examples are documented at docs.modelslab.com.

### Can I migrate an existing Stable Diffusion integration?
Yes. If you already build with Stable Diffusion locally or on another host, migration is an endpoint and payload swap: point text-to-image calls at /api/v7/images/text-to-image, image edits at /api/v7/images/image-to-image, and masked edits at /api/v7/images/inpaint. Your prompts, guidance settings, and ControlNet workflows carry over.

### Is there a free Stable Diffusion API tier?
ModelsLab's Stable Diffusion API is paid — plans start at $21/month (Basic, 3,250 API calls) and include SDXL, SD 1.5, SD 3.5, ControlNet, and inpainting. There are no cold starts — popular models stay warm — so your first request is as fast as your hundredth.


---

*This markdown version is optimized for AI agents and LLMs.*

**Links:**
- [Website](https://modelslab.com)
- [API Documentation](https://docs.modelslab.com)
- [Blog](https://modelslab.com/blog)

---
*Generated by ModelsLab - 2026-08-01*