🔥 20% OFF All Kling Models

Grab the Offer
Skip to main content
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.

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

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.

VariantBest forSpeedModelsLab price
flux (Schnell)Fast drafts, real-time previews, high-volume generation2-3s$0.0047/image
flux-devHigh-quality production images with strong prompt adherence3-5s$0.0047/image
flux-proBest fidelity and detail for hero and marketing assets4-6s$0.0047/image
flux-kontextInstruction-based image editing from a reference image3-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
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 }'

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

Edit an image with FLUX.1 Kontext (JavaScript)

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

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
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 FLUX-powered image features in production.

FLUX API Provider Comparison

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

FeatureModelsLabfal.aiReplicateBlack Forest Labs
FLUX.1 variantsSchnell, Dev, Pro, KontextSchnell, Dev, ProSchnell, Dev, ProPro, Ultra (official)
Other models on same key10,000+~50Thousands (self-serve)FLUX only
FLUX LoRA supportAttach + trainAttachAttach + trainNo
Image editing (Kontext)YesYesYesYes
Cold startsNone (warm)OccasionalFrequentNone
Flat per-image price$0.0047/imagePer-megapixel, varies by variantPer-second + per-imagePer-image by tier
Unlimited plan$199/moNoNoNo
Free API key (no card)YesTrial creditsTrial creditsNo

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.

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.

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:

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

Flux API FAQ

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.

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.

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.

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.

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.

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.

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

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 $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

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.