---
title: Flux API — FLUX.1 Schnell, Dev, Pro & Kontext Image Generation | ModelsLab
description: FLUX image generation REST API — FLUX.1 Schnell, Dev, Pro, and Kontext through one endpoint. Flat $0.0047/image, 2-4s latency, free API key. Python, JS, cURL.
url: https://modelslab.com/flux-api
canonical: https://modelslab.com/flux-api
type: website
component: Seo/FluxApi
generated_at: 2026-07-21T20:51:46.149368Z
---

Imagen

Flux API for Developers
---

ModelsLab's Flux API gives developers FLUX.1 Schnell, Dev, Pro, and Kontext through a single REST endpoint. Image generation is a flat $0.0047 per image — no per-variant surcharge — with 2-4 second latency and a free API key. Attach LoRAs, edit images with Kontext, and scale to unlimited generation on the $199/month plan.

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

What is the ModelsLab Flux API?
---

### FLUX.1 Image Generation, One REST Endpoint

The ModelsLab Flux API gives developers programmatic access to the full FLUX.1 model family — Schnell, Dev, Pro, and Kontext — through a single REST endpoint. Instead of wiring up separate integrations for each variant, you pass a model\_id and a prompt to /api/v7/images/text-to-image and receive hosted image URLs in JSON within 2-4 seconds.

FLUX.1, from Black Forest Labs, is a state-of-the-art rectified-flow transformer known for sharp detail, strong prompt adherence, and legible in-image text. ModelsLab hosts every variant so you can trade speed for quality with a one-line change: Schnell for fast drafts, Dev for high-quality output, Pro for the best fidelity, and Kontext for instruction-based image editing.

Because ModelsLab manages GPU allocation, model loading, auto-scaling, and warm instances, there are no cold starts on popular FLUX models — your first request is as fast as your hundredth. The same API key also covers 10,000+ other image, video, audio, and LLM models when your product grows beyond FLUX.

### What You Can Build with the Flux API

The Flux API supports the full range of FLUX image workflows through one key:

- Text-to-Image — Generate images from natural-language prompts with FLUX.1 Schnell, Dev, or Pro at up to 2048×2048
- Image Editing — Apply instruction-based edits to an existing image with FLUX.1 Kontext while preserving the rest of the scene
- LoRA Styling — Attach FLUX LoRAs to steer style, or train and deploy your own for branded and subject-specific pipelines
- Batch Generation — Request multiple samples per call for A/B testing and variation exploration
- Async + Webhooks — Fire-and-forget generation with webhook callbacks for high-volume pipelines

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

FLUX.1 Model Variants
---

One endpoint, every FLUX.1 variant. Switch with a single model\_id — pricing stays a flat $0.0047 per image across all of them.

| Variant | Best for | Speed | ModelsLab price |
|---|---|---|---|
| flux (Schnell) | Fast drafts, real-time previews, high-volume generation | 2-3s | $0.0047/image |
| flux-dev | High-quality production images with strong prompt adherence | 3-5s | $0.0047/image |
| flux-pro | Best fidelity and detail for hero and marketing assets | 4-6s | $0.0047/image |
| flux-kontext | Instruction-based image editing from a reference image | 3-5s | $0.0047/image |

Flux API Quick Start
---

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

### Generate a FLUX image with 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": "flux",
6    "prompt": "a neon-lit ramen bar in the rain, cinematic, 35mm",
7    "width": 1024,
8    "height": 1024,
9    "samples": 1,
10    "num_inference_steps": 4
11  }'</code>
```

### Generate with Python

Python

```
<code>1import requests
2

3url = "https://modelslab.com/api/v7/images/text-to-image"
4payload = {
5    "key": "YOUR_API_KEY",
6    "model_id": "flux-dev",
7    "prompt": "product photo of a matte black watch on concrete, studio lighting",
8    "negative_prompt": "blurry, low quality",
9    "width": 1024,
10    "height": 1024,
11    "samples": 2,
12    "num_inference_steps": 28,
13    "guidance_scale": 3.5
14}
15

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

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

### Edit an image with FLUX.1 Kontext (JavaScript)

JavaScript

```
<code>1const response = await fetch('https://modelslab.com/api/v7/images/image-to-image', {
2  method: 'POST',
3  headers: { 'Content-Type': 'application/json' },
4  body: JSON.stringify({
5    key: 'YOUR_API_KEY',
6    model_id: 'flux-kontext',
7    init_image: 'https://example.com/room.jpg',
8    prompt: 'change the sofa to emerald green velvet',
9    samples: 1
10  })
11});
12

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

One Flux API, Every Variant Plus LoRAs
---

Text-to-image, image editing with Kontext, and custom LoRA fine-tunes — all behind a single FLUX endpoint and one API key.

Every FLUX.1 Variant Schnell, Dev, Pro, and Kontext are all available through the same text-to-image and image-to-image endpoints. Switch model\_id to trade speed for fidelity without touching the rest of your integration.

FLUX LoRA Fine-Tuning Attach existing FLUX LoRAs to steer style, or train and deploy your own. Custom LoRAs run through the standard endpoint by referencing them in the request — ideal for consistent brand or character styling.

Kontext Image Editing FLUX.1 Kontext takes an input image plus an instruction prompt and applies the edit while preserving the rest of the scene. Product recolors, background swaps, and targeted changes all run through the API.

Predictable Flat Pricing Every FLUX variant costs a flat $0.0047 per image — no per-megapixel math and no premium for Pro. High-volume teams cap spend entirely with the $199/month unlimited plan.

![Every FLUX.1 Variant](https://imagedelivery.net/PP4qZJxMlvGLHJQBm3ErNg/8741a716-a81d-419a-c14f-88155af00c00/768)

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

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

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

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

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

Everything developers need to ship FLUX-powered image features in production.

[Start Free Trial](https://modelslab.com/register)

FLUX API Provider Comparison
---

How ModelsLab compares to other ways to access FLUX.1 models.

| Feature | ModelsLab | fal.ai | Replicate | Black Forest Labs |
|---|---|---|---|---|
| FLUX.1 variants | Schnell, Dev, Pro, Kontext | Schnell, Dev, Pro | Schnell, Dev, Pro | Pro, Ultra (official) |
| Other models on same key | 10,000+ | ~50 | Thousands (self-serve) | FLUX only |
| FLUX LoRA support | Attach + train | Attach | Attach + train | No |
| Image editing (Kontext) | Yes | Yes | Yes | Yes |
| Cold starts | None (warm) | Occasional | Frequent | None |
| Flat per-image price | $0.0047/image | Per-megapixel, varies by variant | Per-second + per-image | Per-image by tier |
| Unlimited plan | $199/mo | No | No | No |
| Free API key (no card) | Yes | Trial credits | Trial credits | No |

Data as of July 2026. Competitor pricing based on publicly published per-image and per-megapixel rates for FLUX.1 variants; verify current rates before comparing for your workload.

Related image API guides
---

[### Image Generation API

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

SDXL, SD 3.5, ControlNet, and LoRA via the same REST API and key.](https://modelslab.com/stable-diffusion-api) [### Cheapest AI Image API

Flat $0.0047/image and the $199 unlimited plan compared across providers.](https://modelslab.com/cheapest-ai-image-api)

How to Use the Flux API
---

Generate your first FLUX image in under 5 minutes.

STEP 01

STEP 01

### Step 1: Get Your API Key

Create a free ModelsLab account and generate your API key. No credit card required — the free tier includes credits to test every FLUX variant.

STEP 02

STEP 02

### Step 2: Pick a Variant and Prompt

Send a POST request to /api/v7/images/text-to-image with model\_id set to flux, flux-dev, or flux-pro, plus your prompt and generation parameters like width, height, and steps.

STEP 03

STEP 03

### Step 3: Get Your Images

Receive hosted image URLs in the JSON response within 2-4 seconds. Use flux-kontext with an init\_image to edit images instead of generating from scratch.

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

### Flux API Pricing

The Flux API uses simple, flat pricing: $0.0047 per image on pay-as-you-go, the same across FLUX.1 Schnell, Dev, Pro, and Kontext 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 generation.

Against fal.ai and Replicate, ModelsLab is competitive on their cheapest FLUX variants and becomes the cheapest option at scale: the $199/month Open Source Unlimited plan removes per-image cost entirely for high-volume generation. Paid plans start at $21/month (Basic) and $47/month (Standard), and dedicated enterprise endpoints with custom SLAs start at $249/month. A free tier lets you evaluate before committing.

### API Response Format

The Flux API returns a consistent JSON response. 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 Flux 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 FLUX completion notifications for async pipelines
- Documentation — per-parameter guides and examples at docs.modelslab.com

Why ModelsLab for the Flux API?
---

Key advantages that set us apart

Every FLUX.1 variant — Schnell, Dev, Pro, Kontext — on one endpoint

Flat $0.0047 per image with no per-variant surcharge

$199/mo unlimited plan for high-volume FLUX generation

Attach FLUX LoRAs or train and deploy your own

Kontext image editing through the same API key

No cold starts on popular FLUX models

Up to 2048×2048 native generation, no resolution upcharge

2-4 second latency with async + webhook support

10,000+ other image, video, audio, and LLM models on the same key

Free API key with no credit card to evaluate

Our Popular Use Cases

What developers build with the Flux API:

Design & Creative ToolsE-Commerce Product ImageryMarketing Creative AutomationBranded Style PipelinesContent PlatformsRapid Prototyping

Embed FLUX text-to-image and Kontext editing directly into design apps, letting users generate and refine high-fidelity visuals on demand.

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

Flux API FAQ
---

### What is the Flux API?

The Flux API is a REST API for generating and editing images with the FLUX.1 model family from Black Forest Labs. ModelsLab exposes FLUX.1 Schnell, Dev, Pro, and Kontext through a single endpoint — /api/v7/images/text-to-image — so you can generate images from text or edit existing images with a single model\_id change.

### How much does the Flux API cost?

FLUX image generation is a flat $0.0047 per image on pay-as-you-go, the same across every FLUX.1 variant with no resolution upcharge up to 2048×2048. That is about 8.5x cheaper than OpenAI DALL-E 3. For high volume, the $199/month unlimited plan removes per-image cost, and enterprise dedicated endpoints start at $249/month. A free tier is included.

### Which FLUX models are available?

FLUX.1 Schnell (fastest), FLUX.1 Dev (higher quality), FLUX.1 Pro (best fidelity), and FLUX.1 Kontext (instruction-based image editing). All four are available through the same API and key, selected with the model\_id parameter.

### Does the Flux API support LoRA fine-tuning?

Yes. You can attach existing FLUX LoRAs to influence style, and you can train and deploy your own FLUX LoRAs through ModelsLab. Custom LoRAs are referenced in the request and run through the standard text-to-image endpoint — no extra infrastructure needed.

### How does the Flux API compare to fal.ai and Replicate?

ModelsLab is competitive with fal.ai and Replicate on their cheapest FLUX variants and becomes the cheapest option at scale thanks to the $199/month unlimited plan. ModelsLab also keeps popular FLUX models warm to avoid cold starts and offers 10,000+ additional models on the same key.

### How do I call the FLUX.1 Kontext editing model?

Send a POST request to /api/v7/images/image-to-image with model\_id set to flux-kontext, an init\_image URL, and an instruction prompt describing the edit. Kontext applies the change while preserving the rest of the scene and returns the edited image URL in the JSON response.

### Is there a free way to test the Flux API?

Yes. Create an API key without a credit card and test FLUX.1 Schnell, Dev, Pro, and Kontext on the free tier. Paid plans start at $21/month (Basic) and $47/month (Standard) when you need 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 $199/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 FLUX models does the ModelsLab FLUX API support?
ModelsLab serves the full FLUX.1 family through one endpoint: FLUX.1 Schnell for the fastest, lowest-latency generations, FLUX.1 Dev for higher-quality output, FLUX.1 Pro for the best fidelity, and FLUX.1 Kontext for prompt-based image editing. You switch between them with a single model_id parameter — no separate integrations.

### How much does the FLUX API cost?
FLUX image generation is a flat $0.0047 per image on pay-as-you-go — the same price across every FLUX variant, with no resolution upcharge up to 2048×2048. High-volume teams use the $199/month Open Source Unlimited plan for unlimited generation, and dedicated enterprise endpoints start at $249/month. Pricing verified July 2026.

### How do I call the FLUX API?
Send a POST request to https://modelslab.com/api/v7/images/text-to-image with your API key, model_id set to "flux" (or a specific variant), and a prompt. The response returns hosted image URLs in JSON within 2-4 seconds. Python, JavaScript, and cURL examples are documented at docs.modelslab.com.

### Does the FLUX API support LoRA and custom fine-tunes?
Yes. You can attach FLUX LoRAs to steer style, and you can train and deploy your own FLUX LoRAs through the API. Custom LoRAs run through the same text-to-image endpoint by referencing them in the request, so branded or subject-specific pipelines work without extra infrastructure.

### Can I edit images with FLUX.1 Kontext through the API?
Yes. FLUX.1 Kontext is an image-editing model: send an input image plus an instruction prompt and it applies the edit while preserving the rest of the scene. It is available through the same ModelsLab image API, so text-to-image generation and Kontext-based editing share one API key.

### Is there a free way to test the FLUX API?
Yes. Create a ModelsLab API key without a credit card and test FLUX.1 Schnell, Dev, Pro, and Kontext on the free tier before choosing a plan. Paid plans start at $21/month (Basic) and $47/month (Standard) for production volume.


---

*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-07-22*