Flux, from Black Forest Labs, is one of the most searched image models on the market and one of the best around for following a prompt closely and producing photorealistic results. If you have tried to work out how to call it from your own app, you have probably noticed the pricing and access options are scattered across several places. This guide pulls it together: what Flux actually is, which version 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 former Stability AI researchers who worked on the original Stable Diffusion. Developers pick Flux for three reasons: image quality that holds up at high resolution, fast generation, and licensing that works for commercial products, including one open-weight model you can use commercially for free.
Here is 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 one API key that can call Flux, Midjourney, Nano Banana, and whatever else you might need later. For a wider view of how these access routes compare, our AI image API guide covers the same decision for image models in general.
Flux Model Variants Explained
Black Forest Labs has released several generations of Flux, and the naming has shifted along the way, so it is worth being clear on what is current.
Flux 3: the newest release
Flux 3 arrived in two stages. Black Forest Labs announced the multimodal Flux 3 family on July 23, 2026, led by video with synchronized audio, and this was the company's first move beyond still images. Flux 3 Image followed on October 1, 2026, completing the image side of the family. It is already live on Apiframe, and our Flux 3 launch post covers what shipped.
Flux 3 Image is priced per image by resolution tier, from $0.041 at 768 x 768 up to $0.607 at 4K, with a cheaper Flux 3 Image Klein tier running from $0.008 to $0.036. Flux 3 Video is billed per second of output, starting around $0.15 a second at HD and rising with resolution, with a draft mode at $0.06 a second for testing ideas before you commit. If video is what brought you here, our Flux 3 versus Hailuo 3 comparison weighs it against the obvious rival. If you only need still images today, Flux.2 remains the better documented choice, and the rest of this guide focuses there.
Flux.2: the workhorse lineup
Flux.2 is the generation most production apps are running in 2026, and it covers six models:
- Flux.2 [pro] is the default choice for production work. It is fast, high quality, and supports image editing with up to 8 reference images, which is how you keep a character or product consistent across generations.
- Flux.2 [max] is the top-quality tier. It follows prompts most closely and is the only variant that can look up real-world references while it generates, which Black Forest Labs calls grounding search.
- Flux.2 [flex] trades some speed for finer control over generation settings and stronger typography, useful if you need precise text inside an image. It is cheaper than Max for plain text-to-image, but the two cost the same once you start editing.
- Flux.2 [klein] 4B and 9B are the fast, low-cost tiers, built for real-time or high-volume work where you generate a lot of images and do not need top quality on every one. Both ship with open weights. The 4B model is Apache 2.0, so you can run it commercially for free, while 9B is under Black Forest Labs' non-commercial license.
- Flux.2 [dev] is a 32B open-weight model, meaning the weights are published for anyone to download, released under a non-commercial license. Black Forest Labs lists it as local only, with no hosted endpoint on its own API. You either run it yourself, buy a commercial license, or reach it through hosted providers like Apiframe and Replicate.
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 marketplaces:
- Flux1.1 [pro], Flux1.1 [pro] Ultra (higher resolution, up to 4 megapixels), and Flux1.1 [pro] Raw (tuned for a candid, unposed photographic look) 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 edits driven by both text and a source image, with strong character consistency across repeated edits. Kontext's editing features have largely been folded into Flux.2 Pro's built-in multi-reference support, so if you are starting fresh, Flux.2 is the safer bet.
- Flux.1 Fill [pro] handles a narrower job: filling in missing parts of an image or extending its edges, where you are working on a specific region rather than editing the whole image. Black Forest Labs also sells a set of smaller Flux Tools for outpainting, erasing objects, removing blur, and virtual try-on.
If you are building something new, default to Flux.2, or Flux 3 if you need video as well. The 1.1 series is still worth knowing about since a lot of existing integrations and tutorials reference it, but it is not where new development is happening.
How to Access the Flux API
You have 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 will manage your own API key, handle your own rate limits, and build against Black Forest Labs' request format specifically. If you only ever plan to use Flux, this is a reasonable choice. Whichever route you pick, keep the key on your server rather than in client-side code, as our guide to AI media API security and authentication explains.
Replicate. Replicate hosts most Flux variants, including open-weight ones like Flux.2 Dev and Flux.1 Schnell, alongside thousands of other models, with pay-per-use pricing and no minimum commitment. It is a good option if Flux is one of several open models you want to experiment with. See our Replicate pricing breakdown for more on how that billing works.
Unified APIs like Apiframe. If you are building a product that needs more than one model, whether that is 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 format, and one dashboard to track spend across models. Apiframe's Flux endpoints cover Flux.2 Pro, Dev, Flex, and Max, plus Flux.1 Pro and Flux.1 Pro Ultra, along with Flux Fill Pro for filling and extending images. Flux 3 is available there too. Our unified AI API guide explains how that pattern works across image, video, and music.
The trade-off is fairly simple: going direct to Black Forest Labs gets you the newest features slightly sooner and cuts out a middleman. Going through a unified API saves you integration time if you need more than one model, and gives you the same job-checking pattern across all of them. Our guide on how to choose an AI media API walks through that decision in more detail.
Flux API Pricing in 2026
Every Flux.2 model, Klein tiers included, is priced by output resolution rather than a flat per-image rate. The first megapixel costs a set amount, and each megapixel beyond that adds a smaller step. The figures below are the starting rates Black Forest Labs publishes, which means a 1-megapixel image with no reference images attached.
| Model | Text-to-image (from) | Image editing (from) | Each extra MP |
|---|---|---|---|
| Flux.2 [klein] 4B | $0.014 | $0.015 | +$0.001 |
| Flux.2 [klein] 9B | $0.015 | $0.017 | +$0.002 |
| Flux.2 [pro] | $0.03 | $0.045 | +$0.015 |
| Flux.2 [flex] | $0.05 | $0.10 | +$0.05 |
| Flux.2 [max] | $0.07 | $0.10 | +$0.03 |
| Flux.2 [dev] | Local only, licensed separately | Local only, licensed separately | n/a |
That last column matters more than it looks. Because only the first megapixel carries the full price, a bigger image never costs proportionally more. A 4-megapixel Flux.2 Pro image works out at roughly $0.075, not four times the $0.03 base. The editing rate works the same way: the "from $0.045" figure for Pro is the $0.03 base plus one megapixel of reference image, so attaching more or larger references pushes it up from there.
The older Flux.1 generation is simpler, priced as a flat rate per image:
| Model | Price per image |
|---|---|
| Flux1.1 [pro] | $0.04 |
| Flux1.1 [pro] Ultra | $0.06 |
| Flux1.1 [pro] Raw | $0.06 |
| Flux.1 Kontext [pro] | $0.04 |
| Flux.1 Kontext [max] | $0.08 |
| Flux.1 Fill [pro] | $0.05 |
Note that Flux.2 dropped the "Schnell" label in favor of the Klein tiers, so if you see "Flux Schnell" pricing quoted anywhere, that refers to the older Flux.1 line, not Flux.2.
Asking for several images in one call multiplies the base cost, so four images from Flux.2 Pro at the 1MP rate comes to about $0.12 rather than $0.03. Black Forest Labs bills in credits, where 1 credit equals $0.01, and failed or moderated generations are not charged.
For comparison, that puts Flux in a similar range to Stable Diffusion's paid tiers and well under Midjourney per image, though Midjourney does not sell a direct pay-per-image API in the same way. If price is your main constraint, start with Klein 4B. Its weights are Apache 2.0, so you also have the option of running it on your own hardware and paying nothing per image, an angle our roundup of free AI image generation APIs covers in full. Our AI image API pricing breakdown and our guide to the best AI media generation APIs both go wider if you are weighing Flux against other providers on cost alone.
How to Call the Flux API (Code Example)
Here is a working example using Apiframe's unified endpoint. It follows the same submit-and-check pattern you would use for most image generation APIs that run in the background: you submit a prompt, get back a job ID right away, then keep checking (or wait for 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. Check back until the job finishes, with a timeout so it cannot hang
deadline = time.time() + 300
while time.time() < deadline:
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
if status["status"] == "FAILED":
print("Job failed:", status.get("error"))
break
time.sleep(2)
else:
print("Timed out waiting for job", job_id)A few things worth calling out. The request returns immediately with a QUEUED status and a job ID, so it does not sit and wait while the image renders. You then check the jobs endpoint until the status flips to COMPLETED (or FAILED, in which case read the error field) and pull the image URL out of the result. Checking on a timer is fine at low volume, but at scale you want the API to call you instead. Apiframe and most other unified APIs support webhooks, and our guide on setting up webhook callbacks for media generation covers that pattern.
Basic error handling matters too. Watch for a 402 response (out of credits), 429 (too many requests), and 400 (something wrong with your request parameters, usually flagged in a details field). Note the timeout in the loop above: without one, a stuck job will 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 are swapping backgrounds, changing a product color, or holding a character steady across a series of images. Our AI image editing API guide covers that last category in more depth.
That last one, multi-reference editing, is arguably Flux.2's biggest upgrade over the 1.1 generation. Instead of a separate fill or extend call, you can pass up to 8 reference images straight into a generation request and get consistent results without first painting over the area you want changed. Keep an eye on cost here, since reference images add to the per-request price. If you need the same face or product across a whole set, our walkthrough on keeping AI characters consistent shows how to structure those requests.
Flux vs Other Image Models
| Model | Strength | Starting price |
|---|---|---|
| Flux.2 Pro | Prompt accuracy, editing, multi-reference | $0.03 per image at 1MP |
| 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 on following the prompt you actually wrote, which is why it has become a default for product and marketing imagery. Midjourney still leads for stylized, art-directed output, though reaching it programmatically means going through a third party, as our roundup of Midjourney API options explains. Stable Diffusion remains the most flexible option if you want to fine-tune or self-host, and our Stable Diffusion API guide covers that route. Ideogram is worth a look if your images need clean, legible text baked in, like a poster or a UI mockup, which the Ideogram API guide gets into.
For a head-to-head, our comparison of Flux, Stable Diffusion, and Midjourney sits alongside our roundups of the best AI image generation APIs and the best AI image generator APIs for developers. If your app also needs video, our Veo 3 API guide is a useful next stop.
FAQ
Is there an official Flux API?
Yes and no. Black Forest Labs runs an official hosted API for Flux, but there is no single endpoint every provider shares. You can also reach Flux models through Replicate or unified APIs like Apiframe, which is often simpler if you are calling more than one image model.
What does Flux Pro cost per image?
Flux.2 Pro starts at $0.03 for a 1-megapixel text-to-image generation, and from $0.045 for image editing. Cost rises with output resolution, but not in a straight line: each megapixel past the first adds $0.015, so a 4-megapixel image lands around $0.075 rather than $0.12. The Klein tiers work the same way, starting from $0.014.
Can you fine-tune Flux?
Yes, for the open-weight tiers. Black Forest Labs sells licensing plans that include fine-tuning rights, including LoRA adapters, which are small add-on files that teach a model a specific style or subject, on Flux.2 Klein and Dev for teams running their own infrastructure. Black Forest Labs also runs fine-tuned Flux.2 endpoints in public beta, billed at the same rate as the base model.
Is Flux open source?
Partially. Flux.2 Dev and both Klein models ship with open weights. Klein 4B is Apache 2.0, so you can use it commercially for free. Klein 9B and Dev are under Black Forest Labs' non-commercial license, which means research and hobby use unless you buy a commercial license. The Pro, Max, and Flex tiers are closed and billed per use. If you are unsure what you are allowed to do with the images themselves, our guide on copyright and commercial rights for AI-generated art covers the licensing picture. If you want to try Flux alongside other image and video models without wiring up separate accounts, you can get an API key and start with free credits. To compare what other providers give away first, see our comparison of AI media APIs with free trials.
Apiframe Team
The team behind Apiframe - making AI generation accessible to everyone.