Flux, from Black Forest Labs, is one of the most searched image models on the market and one of the best around for prompt accuracy and photorealism. If you've tried to figure out how to actually call it from your own app, though, you've probably noticed the pricing and access options are scattered across a few different places. This guide pulls it all together: what Flux actually is, which variant to use, what it costs in 2026, and a working code example to get you generating images in a few minutes.
What Is the Flux API?
Flux is a family of image generation models built by Black Forest Labs, a company founded in 2024 by several of the researchers who originally created Stable Diffusion. Developers care about Flux for three reasons: image quality that holds up at high resolution, fast generation times, and licensing that's usable in commercial products (for the paid tiers, at least).
Here's the part that trips people up: there is no single, official "Flux API." Black Forest Labs runs its own hosted API, but Flux models are also available through Replicate, through other model marketplaces, and through unified APIs like Apiframe that bundle Flux alongside dozens of other image and video models behind one integration. Which route makes sense for you depends on whether you want direct access to a single vendor or a single API key that can call Flux, Midjourney, Nano Banana, and everything else you might need later.
Flux Model Variants Explained
Black Forest Labs has released several generations of Flux, and the naming has shifted along the way, so it's worth being clear on what's current.
Flux.2: the current lineup
Flux.2 is the active generation as of 2026, and it comes in five variants:
- Flux.2 [pro] is the default choice for production work. It's fast, high quality, and supports image editing with up to 8 reference images for maintaining character or product consistency across generations.
- Flux.2 [max] is the top-quality tier, with the best prompt adherence and the ability to factor in real-world visual references when generating images.
- Flux.2 [flex] trades some speed for finer control over generation parameters and stronger typography, useful if you need precise text rendering inside images.
- Flux.2 [klein] 4B and 9B are the fast, low-cost tiers, aimed at real-time or high-volume use cases where you're generating a lot of images and don't need max quality on every one.
- Flux.2 [dev] is open-weight (the model weights are publicly available) and meant for local, non-commercial use. Black Forest Labs doesn't sell it as a pay-as-you-go hosted endpoint on its own API — you either self-host it or license it commercially — though it is available as a hosted model through aggregators like Apiframe.
Flux.1: the previous generation, still available
The earlier Flux.1 family is still live on Black Forest Labs' API and still shows up across most aggregators:
- Flux1.1 [pro] and Flux1.1 [pro] Ultra (higher resolution, up to 4 megapixels) are the standard text-to-image models from this generation.
- Flux.1 Kontext [pro] and [max] were Black Forest Labs' dedicated image editing models, built for text-and-image-driven edits with strong character consistency across turns. Kontext's editing capabilities have largely been folded into Flux.2 Pro's native multi-reference support, so if you're starting fresh, Flux.2 is the more future-proof choice.
- Flux.1 Fill [pro] handles a narrower job: filling in missing parts of an image or extending its edges, where you're working on a specific region rather than editing the image as a whole.
If you're building something new, default to Flux.2. The 1.1 series is still worth knowing about since a lot of existing integrations and tutorials reference it, but it's not where new development is happening.
How to Access the Flux API
You've got three realistic paths in:
Black Forest Labs' own API. This is the most direct route, with the newest models available first and full control over parameters. You'll manage your own API key, handle your own rate limits, and integrate against BFL's request format specifically. If you only ever plan to use Flux, this is a reasonable choice.
Replicate. Replicate hosts most Flux variants (including open-weight ones like Flux.1 Dev and Schnell) alongside thousands of other models, with pay-per-use pricing and no minimum commitment. It's a good option if Flux is one of several open-source models you want to experiment with.
Unified APIs like Apiframe. If you're building a product that needs more than one model — whether that's Flux for images alongside Kling or Veo for video — a unified API removes the need to write a separate integration for each provider. You get one API key, one request and response shape, and one dashboard to track spend across models. Apiframe's Flux endpoints cover the full Flux.2 lineup (Pro, Dev, Flex, Max) plus Flux.1 Pro and Flux.1 Pro Ultra, alongside Flux Fill Pro for inpainting and outpainting.
The tradeoff is fairly simple: going direct to Black Forest Labs gets you the newest features slightly faster and cuts out a middleman; going through an aggregator saves you integration time if you need more than one model, and gives you a consistent job-polling pattern across all of them.
Flux API Pricing in 2026
Black Forest Labs prices Flux.2 by output resolution rather than a flat per-image rate, so cost scales with how big an image you're generating. Here's the official starting pricing per image, according to Black Forest Labs' own documentation:
| Model | Text-to-image (from) | Image editing (from) |
|---|---|---|
| Flux.2 [klein] 4B | $0.014 | $0.014 |
| Flux.2 [klein] 9B | $0.015 | $0.015 |
| Flux.2 [pro] | $0.03 | $0.045 |
| Flux.2 [flex] | $0.05 | $0.05 |
| Flux.2 [max] | $0.07 | $0.07 |
| Flux.2 [dev] | Local only, no hosted API | Local only |
The older Flux.1 generation is priced per image rather than by resolution:
| Model | Price per image |
|---|---|
| Flux1.1 [pro] | $0.04 |
| Flux1.1 [pro] Ultra | $0.06 |
| Flux.1 Kontext [pro] | $0.04 |
| Flux.1 Kontext [max] | $0.08 |
| Flux.1 Fill [pro] | $0.05 |
On Replicate, Flux.1 Schnell (the fastest, open-weight tier) runs around $0.003 per image, making it one of the cheapest ways to generate a Flux image if you don't need Pro-level quality. Note that Flux.2's naming dropped the "Schnell" label in favor of the Klein tiers, so if you see "Flux Schnell" pricing quoted anywhere, that's referring to the older Flux.1 line.
Batch requests multiply the base cost by the number of images you request in one call, so four images from Flux.2 Pro at the 1MP rate comes to roughly $0.12 rather than $0.03.
For comparison, that puts Flux roughly in the same range as Stable Diffusion's paid tiers and noticeably cheaper per image than Midjourney, though Midjourney doesn't offer a direct pay-per-image API in the same way. If pricing is your main constraint, Klein 4B or Flux.1 Schnell are the tiers to look at first.
How to Call the Flux API (Code Example)
Here's a working example using Apiframe's unified endpoint, which follows the same submit-and-check pattern you'd use for any image generation API that runs in the background: you submit a prompt, get back a job ID immediately, then poll (or use a webhook) until the result is ready.
import requests
import time
API_KEY = "afk_your_api_key_here"
BASE_URL = "https://api.apiframe.ai/v2"
# 1. Submit the generation request
response = requests.post(
f"{BASE_URL}/images/generate",
headers={
"X-API-Key": API_KEY,
"Content-Type": "application/json",
},
json={
"prompt": "a sleek silver sports car racing along a coastal highway at sunset, hyper-realistic",
"model": "flux-2-pro",
"fluxParams": {
"aspect_ratio": "16:9",
"output_format": "jpg",
"output_quality": 90,
},
},
)
job = response.json()
job_id = job["jobId"]
print(f"Job submitted: {job_id}, status: {job['status']}")
# 2. Poll until the job completes
while True:
status_response = requests.get(
f"{BASE_URL}/jobs/{job_id}",
headers={"X-API-Key": API_KEY},
)
status = status_response.json()
if status["status"] == "COMPLETED":
print("Done! Image URL:", status["result"]["images"][0])
break
elif status["status"] == "FAILED":
print("Job failed:", status.get("error"))
break
time.sleep(2)A few things worth calling out in that example. The request returns immediately with a QUEUED status and a job ID, it doesn't block while the image renders. You then poll the jobs endpoint until the status flips to COMPLETED (or FAILED, in which case check the error field) and pull the image URL out of the result object. If you'd rather not poll, most unified APIs, including Apiframe, support webhooks so your server gets notified the moment the job finishes.
Basic error handling matters here too. Watch for a 402 response (insufficient credits), 429 (rate limited), and 400 (something wrong with your request parameters, usually flagged in a details field). Wrapping the poll loop with a timeout is also worth doing in production so a stuck job doesn't hang your process indefinitely.
Common Use Cases
Flux shows up most often in a handful of recurring jobs: product mockups where you need a clean, realistic render before a photoshoot exists, marketing creative that needs quick iteration across dozens of variations, character and concept art for games or storyboards, and image editing with Flux.2's reference support, where you're swapping backgrounds, changing a product color, or keeping a character consistent across a series of images.
That last one, multi-reference editing, is arguably Flux.2's biggest upgrade over the 1.1 generation. Instead of a separate inpainting or outpainting call, you can pass up to 8 reference images directly into a generation request and get consistent results without a masking step. This makes image editing with Flux.2 significantly more straightforward than it was with the previous generation.
Flux vs Other Image Models
| Model | Strength | Starting price |
|---|---|---|
| Flux.2 Pro | Prompt accuracy, editing, multi-reference | $0.03/image |
| Midjourney | Stylized, artistic output | Subscription-based |
| Stable Diffusion 3.5 | Open weights, self-hostable | Free (self-hosted) to low per-image via API |
| Ideogram V3 | Text rendering inside images | Varies by tier |
Flux tends to win on photorealism and prompt adherence, which is why it's become a default choice for product and marketing imagery. Midjourney still leads for stylized, art-directed output. Stable Diffusion remains the most flexible option if you want to fine-tune or self-host. Ideogram is worth a look specifically if your images need clean, legible text baked in, like a poster or a UI mockup. If you're comparing across these regularly, Apiframe's AI image API guide and its roundup of the best AI image generation APIs both cover Flux alongside these alternatives in more depth.
FAQ
Is there an official Flux API?
Yes, run directly by Black Forest Labs. You can also reach Flux models through Replicate or unified APIs like Apiframe, which is often simpler if you're calling more than one image model.
What does Flux Pro cost per image?
Flux.2 Pro starts at $0.03 for text-to-image and $0.045 for image editing, both billed by output resolution, so larger images cost more.
Can you fine-tune Flux?
Yes, for the open-weight tiers. Black Forest Labs offers licensing plans that include fine-tuning rights (including LoRA adapters) on Flux.2 Klein and Dev models for teams running their own infrastructure.
Is Flux open source?
Partially. Flux.2 Dev is open-weight and free to run locally for non-commercial use, and Black Forest Labs doesn't sell it as a pay-as-you-go endpoint on its own API, though it is available hosted through providers like Apiframe. The Pro, Max, Flex, and Klein tiers are closed and billed per use through Black Forest Labs' API or through providers like Apiframe.
Apiframe Team
The team behind Apiframe - making AI generation accessible to everyone.