Unlimited Open Source Models

Get Plan
Skip to main content
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.

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
Salesforce logo
Amazon logo
IBM logo
Adobe logo
Sony logo
Google logo
Salesforce logo
Amazon logo
IBM logo
Adobe logo
Sony logo
Google logo
Salesforce logo
Amazon logo
IBM logo
Adobe logo
Sony logo
Google logo
Salesforce logo
Amazon logo
IBM logo
Adobe logo
Sony logo
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.

ModelBest forNative resolutionModelsLab price
sdxlHigh-quality general-purpose generation and photorealism1024×1024$0.0047/image
sd-3.5Improved prompt following, typography, and composition1024×1024$0.0047/image
sd-1.5Fast generation and the largest community LoRA ecosystem512×512$0.0047/image
sd-2.1Higher-resolution SD generation with refined outputs768×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
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 }'

Generate with Python (SD 3.5)

Python
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}")

Inpainting with JavaScript

JavaScript
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}`));

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
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result
Example of AI outpainting result

Everything developers need to ship Stable Diffusion features in production.

Stable Diffusion API Comparison

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

FeatureModelsLabSelf-hosted GPUGeneric serverless
Models availableSDXL, SD 1.5/2.1/3.5 + 10,000+Whatever you installA handful, provider-picked
ControlNet & LoRABuilt inDIY setupVaries
Inpainting & image-to-imageDedicated endpointsDIYVaries
Cold startsNone (warm)None (always on)Frequent
GPU / DevOps to manageNoneAll of itNone
Cost model$0.0047/image or $149/mo unlimitedFixed GPU rental + ops timePer-second, spiky
Free tierPaid, from $21/moNoTrial credits

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

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.

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:

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

Design & Creative Tools

Stable Diffusion API FAQ

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).

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.

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.

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.

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

GDPR Compliant

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

View Docs

Plugins

Explore Plugins for Pro

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

API

Build Apps with
ML
API

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