Stable Diffusion API Overview
Overview of the Stable Diffusion API — endpoints, authentication, request structure, and supported models.
What is the Stable Diffusion API?
The Stable Diffusion API is a REST API for generating images using Stable Diffusion 1.5, SDXL, Flux, ControlNet, LoRA, and 1,000+ community models — all without managing GPU infrastructure.
Authentication
Every request requires an API key. Get yours at modelslab.com/register — the free tier includes 20 image generations.
{
"key": "YOUR_API_KEY",
"model_id": "sd-1.5",
"prompt": "..."
}
Available endpoints
- Text to Image — generate from a text prompt
- Image to Image — transform an existing image
- Inpainting — regenerate masked regions
- Fetch Queued Images — poll async results
- ControlNet — guided generation with edge maps, depth, pose
- Super Resolution — upscale 2x or 4x
Response format
Responses are JSON. Successful generations return an array of image URLs in the output field. Async requests return a fetch_result URL to poll.
Rate limits
Rate limits vary by plan. Free tier: 20 generations total. Paid plans (from $8/mo) include unlimited generations with concurrent-request limits per tier.
Error handling
The API returns standard HTTP status codes. 401 for invalid keys, 429 for rate-limit, 5xx for server errors. Retry with exponential backoff for transient failures.