
"Flux AI Image Generation Guide 2026: Models, API & Tutorial"
Flux AI Image Generation Guide 2026: Models, API & Tutorial#
Flux has rapidly become the most important name in AI image generation. If you're a developer building image generation into your product — or even just exploring what's possible — this guide covers everything you need to know about the Flux model family in 2026, from architecture to API integration.
What Is Flux AI?#
Flux is a family of generative image models built by Black Forest Labs (BFL), the company founded by the original creators of Stable Diffusion. The team includes Robin Rombach and Andreas Blattmann, who led the latent diffusion research at Stability AI before striking out on their own.
Where Stable Diffusion pioneered open-source image generation, Flux represents the next evolution: models that rival or surpass closed-source alternatives like Midjourney and DALL-E 3 in prompt adherence, photorealism, and text rendering — while still offering open-weight variants for self-hosting.
In 2025-2026, BFL expanded the lineup significantly, shipping FLUX.2 with multi-reference editing, the Kontext editing model, and the lightweight Klein series for real-time inference. The ecosystem now spans everything from sub-second generation to 4-megapixel ultra-high-resolution output.
Flux Model Variants#
The Flux family has grown into a full product line. Here's how the models compare:
| Model | Resolution | Speed | Best For | Pricing (BFL API) | Open Weights |
|---|---|---|---|---|---|
| FLUX.2 [max] | Up to 2048×2048 | ~10s | Maximum quality, grounding search | $0.10/image | No |
| FLUX.2 [pro] | Up to 2048×2048 | ~5s | Production at scale | $0.05/image | No |
| FLUX.2 [flex] | Up to 2048×2048 | ~5s | Fine-grained control, multi-reference | $0.05/image | No |
| FLUX.2 [klein] | Up to 1024×1024 | <1s | Real-time, high-volume | $0.01/image | Yes (Apache 2.0) |
| FLUX1.1 [pro] Ultra | Up to 4MP | ~8s | Ultra-high-res, Raw photography mode | $0.06/image | No |
| FLUX1.1 [pro] | Up to 1440×2048 | ~4s | Fast, reliable standard generation | $0.04/image | No |
| FLUX.1 [dev] | Up to 1024×1024 | ~10s | Development, fine-tuning, self-hosting | Free (non-commercial) | Yes |
| FLUX.1 [schnell] | Up to 1024×1024 | ~2s | Fast prototyping, local inference | Free | Yes (Apache 2.0) |
Key Highlights#
- FLUX.2 [max]: The flagship. Best prompt adherence and photorealism in the lineup, with multi-reference editing (up to 10 source images simultaneously).
- FLUX1.1 [pro] Ultra: Generates 4-megapixel images with an optional Raw mode that produces candid, less synthetic photography aesthetics.
- FLUX.1 [dev]: The go-to for developers who want to fine-tune or self-host. Open weights under a non-commercial license.
- FLUX.1 [schnell]: The speed demon. Apache 2.0 licensed, runs locally on consumer GPUs, perfect for real-time applications.
- FLUX.1 Kontext: A specialized editing model for natural-language-driven image manipulation — change objects, add text, swap styles using conversational prompts.
Flux vs Midjourney vs DALL-E 3 vs Stable Diffusion#
| Feature | Flux (Pro/Ultra) | Midjourney v6 | DALL-E 3 | Stable Diffusion XL |
|---|---|---|---|---|
| Prompt Adherence | ★★★★★ | ★★★★☆ | ★★★★☆ | ★★★☆☆ |
| Photorealism | ★★★★★ | ★★★★★ | ★★★★☆ | ★★★☆☆ |
| Text Rendering | ★★★★★ | ★★★☆☆ | ★★★★★ | ★★☆☆☆ |
| Max Resolution | 4MP (Ultra) | 2MP | 1024×1024 | 1024×1024 |
| API Access | Yes (REST) | No official API | OpenAI API | Various |
| Open Weights | Partial (Dev/Schnell/Klein) | No | No | Yes |
| Self-Hosting | Yes | No | No | Yes |
| Fine-Tuning | Yes (LoRA, DreamBooth) | No | No | Yes |
| Speed | <1s – 10s | 30-60s | 10-15s | 2-10s (local) |
Bottom line: Flux dominates on prompt adherence, text rendering, and developer flexibility. Midjourney still excels at artistic aesthetics. DALL-E 3 is the easiest to integrate (OpenAI API). But Flux is the only option that gives you production-grade quality and the ability to self-host open-weight models.
How to Use the Flux API#
Direct BFL API (Async Polling)#
The native BFL API uses an asynchronous pattern: submit a generation request, receive a polling URL, then poll for the result.
cURL Example:
# Submit generation request
export BFL_API_KEY="your_key_here"
request=$(curl -s -X POST \
'https://api.bfl.ai/v1/flux-pro-1.1' \
-H 'accept: application/json' \
-H "x-key: ${BFL_API_KEY}" \
-H 'Content-Type: application/json' \
-d '{
"prompt": "A futuristic Tokyo street at night, neon reflections on wet pavement, cinematic lighting",
"width": 1024,
"height": 1024
}')
polling_url=$(echo $request | jq -r .polling_url)
# Poll for result
while true; do
sleep 1
result=$(curl -s -X GET "${polling_url}" \
-H 'accept: application/json' \
-H "x-key: ${BFL_API_KEY}")
status=$(echo $result | jq -r .status)
if [ "$status" == "Ready" ]; then
echo "Image URL: $(echo $result | jq -r .result.sample)"
break
fi
done
Python Example:
import os
import time
import requests
BFL_API_KEY = os.environ["BFL_API_KEY"]
# Submit request
response = requests.post(
"https://api.bfl.ai/v1/flux-pro-1.1",
headers={
"accept": "application/json",
"x-key": BFL_API_KEY,
"Content-Type": "application/json",
},
json={
"prompt": "A futuristic Tokyo street at night, neon reflections on wet pavement",
"width": 1024,
"height": 1024,
},
).json()
polling_url = response["polling_url"]
# Poll for result
while True:
time.sleep(1)
result = requests.get(
polling_url,
headers={"accept": "application/json", "x-key": BFL_API_KEY},
).json()
if result["status"] == "Ready":
print(f"Image URL: {result['result']['sample']}")
break
OpenAI-Compatible API via Crazyrouter#
If you're already using the OpenAI SDK or want a simpler synchronous interface, Crazyrouter provides Flux models through an OpenAI-compatible API. This means you can swap in Flux with a one-line change — no polling, no async handling:
from openai import OpenAI
client = OpenAI(
api_key="your_crazyrouter_key",
base_url="https://crazyrouter.com/v1"
)
response = client.images.generate(
model="flux-pro-1.1",
prompt="A futuristic Tokyo street at night, neon reflections on wet pavement",
size="1024x1024",
n=1,
)
image_url = response.data[0].url
print(f"Image URL: {image_url}")
# cURL with OpenAI-compatible format
curl -X POST https://crazyrouter.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your_crazyrouter_key" \
-d '{
"model": "flux-pro-1.1",
"prompt": "A futuristic Tokyo street at night, neon reflections on wet pavement",
"size": "1024x1024"
}'
This is particularly useful if your codebase already integrates with the OpenAI images API — you just change the base_url and model parameters.
Pricing Comparison#
| Model | BFL Direct | Crazyrouter |
|---|---|---|
| FLUX.2 [max] | $0.10/image | Competitive rates |
| FLUX.2 [pro] | $0.05/image | Competitive rates |
| FLUX1.1 [pro] Ultra | $0.06/image | Competitive rates |
| FLUX1.1 [pro] | $0.04/image | Competitive rates |
| FLUX.1 [dev] | Free (rate-limited) | Available |
| FLUX.1 [schnell] | Free (rate-limited) | Available |
Crazyrouter aggregates multiple AI providers under a single API key and unified billing, often at competitive rates compared to going direct. The real savings come from the unified API format — you don't need to maintain separate SDKs, auth flows, and error handling for each provider.
Advanced Features#
Inpainting with FLUX.1 Fill#
Flux provides dedicated inpainting and outpainting through the FLUX.1 Fill model. You supply a source image, a mask (white = areas to regenerate), and a text prompt:
import base64
# Encode image and mask
with open("source.png", "rb") as f:
image_b64 = base64.b64encode(f.read()).decode()
with open("mask.png", "rb") as f:
mask_b64 = base64.b64encode(f.read()).decode()
response = requests.post(
"https://api.bfl.ai/v1/flux-fill",
headers={"x-key": BFL_API_KEY, "Content-Type": "application/json"},
json={
"prompt": "A red sports car",
"image": image_b64,
"mask": mask_b64,
"width": 1024,
"height": 1024,
},
).json()
Outpainting#
Same endpoint, different mask strategy — extend images beyond their original boundaries by providing a mask that covers the canvas expansion area.
Multi-Reference Editing (FLUX.2)#
FLUX.2 models support referencing up to 10 input images simultaneously. This enables consistent character generation, product mockups with real faces, and complex scene composition where identity is preserved across subjects.
ControlNet & LoRA Support#
The open-weight models (Dev, Schnell, Klein) support the full ecosystem of community ControlNets (Canny, Depth, Pose, etc.) and LoRA fine-tuning. This makes Flux the most flexible platform for custom image generation pipelines.
FAQ#
Is Flux AI free to use?#
FLUX.1 [schnell] is completely free and open source (Apache 2.0). FLUX.1 [dev] has open weights for non-commercial use. The Pro, Ultra, and FLUX.2 models are paid via the BFL API or through third-party providers like Crazyrouter.
Can I self-host Flux models?#
Yes. FLUX.1 [dev], FLUX.1 [schnell], and FLUX.2 [klein] all have downloadable weights. You'll need a GPU with at least 12GB VRAM (24GB+ recommended for Dev). Klein models run on consumer hardware.
How does Flux handle text in images?#
Flux has best-in-class text rendering. It can accurately generate text within images — signs, labels, logos, handwriting — which was historically a weak point for diffusion models. FLUX.2 models further improve this capability.
What resolution does Flux support?#
Ranges from 1024×1024 (Schnell/Dev) up to 4 megapixels with FLUX1.1 [pro] Ultra. FLUX.2 models support up to 2048×2048.
Can I fine-tune Flux?#
Yes. The open-weight models support LoRA and DreamBooth fine-tuning. The community has built extensive tooling around Flux fine-tuning, with platforms like Replicate and Hugging Face offering one-click training.
How does Flux compare to Midjourney for photorealism?#
Both produce excellent photorealistic output. Flux edges ahead on prompt adherence and text rendering, while Midjourney has a distinctive artistic style some prefer. The key differentiator: Flux offers API access and open weights, while Midjourney remains Discord-only with no public API.
Summary#
Flux has established itself as the most versatile AI image generation platform available in 2026. Whether you need sub-second inference for real-time apps, 4MP ultra-high-resolution output, or fine-grained multi-reference editing, there's a Flux model for the job.
For developers, the open-weight models (Schnell, Dev, Klein) provide an unmatched combination of quality and flexibility. For production workloads, the Pro and FLUX.2 series deliver state-of-the-art results via a straightforward API.
If you want the simplest path to integrating Flux into your existing OpenAI-compatible stack, check out Crazyrouter — it gives you access to Flux models (plus hundreds of other AI models) through a single API key and the familiar OpenAI SDK format. No async polling, no separate billing accounts, just drop in and generate.
Ready to start building with Flux? Get your API key at Crazyrouter →


