Unlimited Open Source Models

Get Plan
Skip to main content
Imagen

AI Image Generation API

Call Flux, SDXL and 10,000+ models on one REST API. Self-hosted image models cost $0.0047 per image, and the $149 plan makes them unlimited.

  • From $0.0047 per image
  • Unlimited open-source images for $149/mo
  • Plans from $21/mo

One API for text to image, image to image and inpainting

The ModelsLab AI image generation API turns a prompt or an input image into new images. Text to image, image to image and inpainting use the same REST API and the same API key. You pick the model with one parameter, model_id.

One subscription and one API key cover image, video, speech and LLM APIs. API calls need a paid plan, from $21 a month.

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
500M+

API Requests Processed

400K+

Registered Users

5K+

Discord Community Members

300+

Available AI APIs

500

GPUs in Our Own Datacenter

Text to image API

Send a prompt and a model_id to POST /api/v7/images/text-to-image. The response contains the URLs of the generated images.

  • prompt: the text that describes the image.
  • model_id: the model to run, for example flux or sdxl.
  • samples: up to 4 images per request.
  • webhook: a URL. We post the result to it when the images are ready.

Optional fields such as negative_prompt, width and height control what the model leaves out and the image size.

Image to image, inpainting and editing

To change an existing image, send its URL in init_image with a prompt to POST /api/v7/images/image-to-image. Use it to restyle a photo, change a scene or make variations.

Inpainting edits only the masked part of an image and keeps the rest. Both workflows use the same API key and the same models as text to image. Self-hosted models cost the same $0.0047 per image.

Models you can call

Flux, SDXL, Juggernaut XL, Realistic Vision and 10,000+ community checkpoints and LoRAs run on our own GPUs. To change the model, change model_id. The request shape stays the same.

For model-specific parameters and examples, read the Flux API and Stable Diffusion API guides.

Quick start

Generate images with the v7 text to image endpoint. Replace YOUR_API_KEY with the key from your dashboard.

Text to image with Python

Python
1import requests
2
3url = "https://modelslab.com/api/v7/images/text-to-image"
4payload = {
5 "key": "YOUR_API_KEY",
6 "model_id": "flux",
7 "prompt": "professional product photo of a sneaker, studio lighting, white background",
8 "negative_prompt": "blurry, distorted, low quality",
9 "width": 1024,
10 "height": 1024,
11 "samples": 4
12}
13
14response = requests.post(url, json=payload)
15data = response.json()
16
17# data["output"] is a list of image URLs
18for i, image_url in enumerate(data["output"]):
19 print(f"Image {i + 1}: {image_url}")

Text to image with JavaScript (Node.js)

JavaScript
1const response = await fetch('https://modelslab.com/api/v7/images/text-to-image', {
2 method: 'POST',
3 headers: { 'Content-Type': 'application/json' },
4 body: JSON.stringify({
5 key: 'YOUR_API_KEY',
6 model_id: 'flux',
7 prompt: 'professional product photo of a sneaker, studio lighting',
8 width: 1024,
9 height: 1024,
10 samples: 4
11 })
12});
13
14const data = await response.json();
15// data.output is an array of image URLs
16data.output.forEach((url, i) => console.log(`Image ${i + 1}: ${url}`));

Text to image with cURL and a webhook

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 coffee shop interior, warm lighting, rain on windows",
7 "width": 1024,
8 "height": 1024,
9 "samples": 1,
10 "webhook": "https://example.com/modelslab-webhook"
11 }'

Image generation API pricing

Each plan is a dollar allowance, not a call count. Self-hosted image models cost $0.0047 per image on Basic and Standard and have no per-image charge on the $149 plan. Partner models use the plan allowance first on Basic and Standard, then the wallet, and bill from the wallet on the $149 plan. Compare costs by volume on the cheapest image generation API breakdown, or see what the Unlimited AI API plan covers.

PlanPrice per monthSelf-hosted image modelsParallel generations
Basic$21$0.0047 per image from the plan allowance5
Standard$47$0.0047 per image from the plan allowance10
Open Source Unlimited$149No per-image charge (about $0.0015 per image at 100,000 images a month)15

Yearly plans: Basic $210, Standard $451, Open Source Unlimited $1,500.

Plans from $21 a month

Basic is $21/month and Standard $47/month; self-hosted image models cost $0.0047 per image from that allowance. Open Source Unlimited is $149/month with no per-image charge on self-hosted models. Every plan covers Flux, SDXL and 10,000+ community models. Cancel anytime.

100% refund policy on monthly & yearly plans — cancel anytime
Contact Sales
Best Value

Open Source Unlimited

Mission-Critical

$149/month

🛡️ 100% refund policy · cancel anytime

Unlimited Open Source Models
100% refund policy
24x7 Support
15 parallel generations ⚡
Access to all APIs
Unlimited generations on all open-source models
For mission critical workloads
Add Team Members
Priority GPU Clusters
Most Popular

Standard

Production

$47/month

🛡️ 100% refund policy · cancel anytime

Moderate Traffic
100% refund policy
Priority Developer Support
10 concurrent API requests ⚡
For Production workloads
API access to all models
Prototype

Basic

Prototype

$21/month

🛡️ 100% refund policy · cancel anytime

Moderate Traffic
100% refund policy
Developer Support via Discord/Email
5 concurrent API requests ⚡
API access to all models
Shared GPU

Get your AI image generation API key

Plans start at $21 a month. The same key works for image, video, speech and LLM APIs.

Get API key

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

A REST API that takes a text prompt and returns a generated image. Modern image generation APIs like ModelsLab also accept input images for editing, ControlNet conditions for guided generation, and parameters like negative prompts, seed and guidance scale.

Create an account at modelslab.com, subscribe to a plan (from $21/month), generate an API key, then POST to /api/v7/images/text-to-image with your key, prompt and model_id (e.g. "flux" or "sdxl"). Every plan covers all 10,000+ models.

Flux (photorealistic), SDXL (versatile), SD 3.5 (latest Stable Diffusion), SD 1.5 (legacy), plus ~10,000 community fine-tunes including Realistic Vision, DreamShaper, Pony, Illustrious and CivitAI imports. Specialised models for face swap, anime, logos and headshots are also exposed via the same endpoint.

Speed depends on the model, the resolution and how busy the queue is. Requests return an image URL when the render finishes, or you can pass a webhook and ModelsLab posts the result to you.

Yes. Image-to-image at /api/v7/images/image-to-image, inpainting at /api/v7/images/inpaint, and ControlNet (pose/depth/canny/openpose) via the conditioning parameter. All endpoints share the same auth and request shape — switch use cases with a one-line code change.

Self-hosted image models cost $0.0047 per image on every plan. Plans start at $21/month (Basic) and $47/month (Standard), and the price is paid from the usage included in the plan. Open Source Unlimited at $149/month has no per-image charge on self-hosted models, which works out to about $0.0015 per image at 100,000 images a month.

Yes. Set samples to up to 4 images per request on /api/v7/images/text-to-image. For larger jobs, send requests in parallel (5 at once on Basic, 10 on Standard, 15 on Open Source Unlimited) and pass a webhook URL so ModelsLab posts each result back as it finishes.

Yes. The same /text-to-image endpoint accepts model_id="sdxl", model_id="flux", or any of the 10,000+ community model IDs. You do not need a separate integration per model family.

Yes. Text to image is the main endpoint: POST a prompt and a `model_id` to /api/v7/images/text-to-image and get image URLs back. Image to image, inpainting and ControlNet use the same key and request shape.
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.