FLUX.2 API

flux-2
It targets both creative and commercial applications, ranging from concept art and marketing visuals to prototyping and synthetic data generation.
Output
$0.0156 / MP (variable)
Released
Nov 26, 2025

How to use FLUX.2 API

Install any OpenAI-compatible SDK, point it at api.aimlapi.com/v1, and set the model to flux-2.
import requests

r = requests.post(
    "https://api.aimlapi.com/v1/images/generations",
    headers={"Authorization": "Bearer " + AIMLAPI_KEY},
    json={
      "model": "flux-2",
      "prompt": "A cat holding a sign that says hello"
    },
)
print(r.json())
const r = await fetch("https://api.aimlapi.com/v1/images/generations", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.AIMLAPI_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "model": "flux-2",
    "prompt": "A cat holding a sign that says hello"
  }),
});
console.log(await r.json());
curl -X POST https://api.aimlapi.com/v1/images/generations \
  -H "Authorization: Bearer $AIMLAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"flux-2","prompt":"A cat holding a sign that says hello"}'

OpenAI-compatible — swap the base URL and it works with your existing SDK.

FLUX.2 API Pricing

TypePrice
Output
$0.0156 / MP (variable)

Overview

What Is Flux 2?

Flux 2 is a professional visual foundation model from Black Forest Labs that combines a powerful vision‑language backbone with a rectified flow transformer to understand both world knowledge and fine‑grained spatial relationships. It is designed to handle text‑to‑image, image‑to‑image, and complex editing inside one architecture, simplifying pipelines for teams that previously juggled multiple models.​

Core Capabilities

  • Generates photorealistic images and detailed illustrations at resolutions up to roughly 4 megapixels, suitable for print, product pages, and high‑impact advertising.​
  • Natively supports infographics, UI mockups, and complex typography, delivering clean, readable on‑image text and multi‑language layouts.​
  • Handles both new image creation from prompts and transformation of existing assets with the same underlying model, streamlining integration and QA

Architecture Highlights

  • Built on a latent flow‑matching approach that improves learnability and image quality while maintaining strong compression for practical deployment.​
  • Couples a large vision‑language model (Mistral‑3 24B class) with a rectified flow transformer to capture semantics, materials, lighting, and composition more reliably than earlier diffusion systems.​
  • Retrained latent space from scratch to push past the typical “quality vs. compression vs. learnability” trade‑off, resulting in sharper details and more faithful prompt adherence.

Performance Benchmarks

  • Outperforms all other open-weight alternatives in text-to-image generation and image editing tasks.
  • Achieves photorealistic detail, stable lighting, and texture sharpness on par with professional closed-source models.

‍

Flux 2 API For Image Generation

By interpreting narrative intent, motion cues, and stylistic direction directly from text, the model generates videos that feel purposeful rather than procedural. Scenes evolve naturally, transitions remain consistent, and visual identity is preserved from the first frame to the last.

Prompt Adherence & Visual Quality

  • Interprets complex prompts that specify camera angle, lens, materials, mood, and composition, keeping scenes coherent even at high detail.​
  • Produces realistic lighting and physics that avoid the typical “AI look,” with accurate perspective, spatial reasoning, and object placement.​
  • Supports exact color targeting (including HEX codes) so brand palettes and UI themes are reproduced consistently across large batches.

API Pricing

  • $0.0156 per megapixel

Flux 2 Edit: Redefining How You Edit Visuals

Flux.2 Edit API represents the model’s advanced editing layer, focused on controlled, context-aware image refinement. Rather than applying generic filters or destructive edits, it understands the structure and meaning of an image before making changes.

  • Takes an input image plus an edit instruction (and optionally masks/strength settings), then adjusts only the requested regions while preserving overall composition.​
  • Keeps character identity, camera framing, and design structure stable so refreshed assets still match original campaigns or product shots.​
  • Accepts standard formats like JPEG or PNG, returning web‑ and print‑ready outputs that drop directly into design and post‑production workflows.

API Pricing

  • $0.0156 per Megapixel (1 MP input + N MP output).

How Flux.2 Works

The Flux.2 experience is designed to be intuitive from the first interaction. Users begin by describing an idea or uploading a reference image. The model interprets intent, context, and style preferences before generating a refined visual result.

From there, images can be adjusted incrementally through follow-up instructions, allowing creators to fine-tune details without restarting the process. This conversational approach to image creation makes Flux.2 feel less like a tool and more like a creative collaborator.

Why Choose Flux.2?

Flux.2 stands out by combining expressive generation with reliable editability. Instead of producing static outputs, it supports evolving creative direction, a critical advantage for professional design and content workflows. The model is optimized for speed and scalability, enabling rapid experimentation as well as high-volume asset production. Whether used for branding, storytelling, education, or commercial visuals, Flux.2 adapts seamlessly to different creative demands.

Most importantly, Flux.2 lowers the technical barrier to high-quality visual creation. Complex results no longer require complex software.

Use cases

  • Product mockups requiring precise text and visual detail
  • Marketing and branding materials with strict adherence to typography and style
  • UI/UX design and infographic generation with high fidelity text rendering
  • Creative workflows needing flexible output control with cost efficiency
  • Research and development via open-weight models for experimentation in image generation and editing

‍

Playground

You can try this model in the browser before writing any code: open the AI/ML API playground, select the model and send a prompt. Nothing has to be installed locally — an API key is all you need. The same request is shown as cURL, Python and JavaScript in the code examples on this page, so a prompt that works in the playground can be copied straight into an application.

Open the playground

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.Machine-readable API summary for LLM agents (llms.txt)

FLUX.2 vs other models

ModelInputOutputContextBest for
FLUX.2
This page
$0.0156 / MP (variable)
Image generation at scale
$0.325 / 1M tokens
$78 / 1M tokens
128K tokens
Image generation at scale
$6.5 / 1M tokens
$39 / 1M tokens
Image generation at scale
Image generation at scale
$0.0195 / MP (variable)
Image generation at scale

Frequently asked questions

FLUX.2 takes image, text as input and returns image.

FLUX.2 is priced at $0.0156 / MP (variable).

FLUX.2 is billed per generation — a fixed charge per output rather than by prompt length.

Yes, FLUX.2 accepts image input as well as a text prompt.

FLUX.2 was built by Black Forest Labs.

Send a request to https://api.aimlapi.com/v1/images/generations with flux-2 as the model id.

Yes. FLUX.2 is served through AI/ML API, so the same key and endpoint format used for other models applies.

FLUX.2 is accessed via https://api.aimlapi.com/v1/images/generations.

Start building with FLUX.2

Get API Key
1000+ models, one API.