Login
Back to Blog
EnglishTutorial

Flux AI Image Generation Guide 2026: Models, API & Tutorial

"Complete guide to Flux AI image generation models in 2026. Learn about Flux Pro, Dev, Schnell models, API integration, and how to generate stunning images."

C
Crazyrouter Team
March 1, 2026 / 1303 views
Share:
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.

Crazyrouter availability note#

As of the current Crazyrouter docs, Flux is not exposed as a directly callable model_name on the public pricing page. Treat the Flux examples below as Black Forest Labs direct examples or historical integration notes, not as production-ready Crazyrouter model names.

For production image generation through Crazyrouter, confirm the current model_name values on GET /api/pricing or the pricing page. Current documented alternatives include gpt-image-2, dall-e-3, nano-banana, nano-banana-2, nano-banana-pro, grok-4-image, qwen-image-2.0, qwen-image-plus, qwen-image-max, doubao-seedream-4-5, and doubao-seedream-5-0.

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:

ModelResolutionSpeedBest ForPricing (BFL API)Open Weights
FLUX.2 [max]Up to 2048×2048~10sMaximum quality, grounding search$0.10/imageNo
FLUX.2 [pro]Up to 2048×2048~5sProduction at scale$0.05/imageNo
FLUX.2 [flex]Up to 2048×2048~5sFine-grained control, multi-reference$0.05/imageNo
FLUX.2 [klein]Up to 1024×1024<1sReal-time, high-volume$0.01/imageYes (Apache 2.0)
FLUX1.1 [pro] UltraUp to 4MP~8sUltra-high-res, Raw photography mode$0.06/imageNo
FLUX1.1 [pro]Up to 1440×2048~4sFast, reliable standard generation$0.04/imageNo
FLUX.1 [dev]Up to 1024×1024~10sDevelopment, fine-tuning, self-hostingFree (non-commercial)Yes
FLUX.1 [schnell]Up to 1024×1024~2sFast prototyping, local inferenceFreeYes (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#

FeatureFlux (Pro/Ultra)Midjourney v6DALL-E 3Stable Diffusion XL
Prompt Adherence★★★★★★★★★☆★★★★☆★★★☆☆
Photorealism★★★★★★★★★★★★★★☆★★★☆☆
Text Rendering★★★★★★★★☆☆★★★★★★★☆☆☆
Max Resolution4MP (Ultra)2MP1024×10241024×1024
API AccessYes (REST)No official APIOpenAI APIVarious
Open WeightsPartial (Dev/Schnell/Klein)NoNoYes
Self-HostingYesNoNoYes
Fine-TuningYes (LoRA, DreamBooth)NoNoYes
Speed<1s – 10s30-60s10-15s2-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:

bash
# 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:

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

python
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}")
bash
# Historical OpenAI-compatible-style example; verify the current Crazyrouter model name before use
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#

ModelBFL DirectCrazyrouter
FLUX.2 [max]$0.10/imageCompetitive rates
FLUX.2 [pro]$0.05/imageCompetitive rates
FLUX1.1 [pro] Ultra$0.06/imageCompetitive rates
FLUX1.1 [pro]$0.04/imageCompetitive rates
FLUX.1 [dev]Free (rate-limited)Verify on pricing page before use
FLUX.1 [schnell]Free (rate-limited)Verify on pricing page before use

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:

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

Implementation Guides

Related Posts

AI Agent Memory Patterns: Building Stateful AI Applications with Long-Term Memory in 2026Tutorial

AI Agent Memory Patterns: Building Stateful AI Applications with Long-Term Memory in 2026

"Learn how to implement memory patterns for AI agents. Covers conversation buffers, sliding windows, summary memory, vector-based retrieval, and hybrid approaches using GPT-5, Claude, and open-source tools."

Mar 13
AI Image API Playground: Test GPT Image, Imagen, Qwen Image and FLUX OnlineTutorial

AI Image API Playground: Test GPT Image, Imagen, Qwen Image and FLUX Online

A practical guide for developers who need to compare AI image generation models before building production code. Learn how to test GPT Image, Imagen, Qwen Image, FLUX, and DALL-E style workflows from one playground and one API key.

Jun 4
GLM-4.6 API Guide: Zhipu AI's Latest Model for DevelopersTutorial

GLM-4.6 API Guide: Zhipu AI's Latest Model for Developers

"Complete developer guide to GLM-4.6 by Zhipu AI — features, API setup, code examples, pricing, and comparison with GPT-4o and Claude Sonnet."

Feb 19
How to Get a Claude API Key for Teams and CI in 2026Tutorial

How to Get a Claude API Key for Teams and CI in 2026

"Learn how to get a Claude API key for teams, CI pipelines, and production apps, plus safer key management patterns and a Crazyrouter alternative."

Mar 16
How to Get a Claude API Key in 2026: Secure Setup for Production TeamsTutorial

How to Get a Claude API Key in 2026: Secure Setup for Production Teams

Step-by-step guide to getting a Claude API key, securing it, rotating secrets, and using Crazyrouter as a multi-model alternative.

Jun 5
GPT-5.3 Codex API Access Guide: Pricing, Setup, and OpenRouter AlternativesTutorial

GPT-5.3 Codex API Access Guide: Pricing, Setup, and OpenRouter Alternatives

Want to use GPT-5.3 Codex for code generation? Here's how to access it, compare pricing, and choose the best OpenRouter alternative for developer workflows.

Apr 16