Overview
FLUX is a family of open-weight diffusion models from Black Forest Labs, shipped with minimal inference code for generating and editing images from text prompts. The repository covers the full local workflow, from installing the package to running text-to-image, in/out-painting, structural conditioning, image variation, and image editing.
It targets developers and researchers who want to run image generation on their own hardware rather than only through a hosted API. The models are downloaded from Hugging Face, and the same code base also reaches the Black Forest Labs API for the Pro tier non-open-weight models.
Within the image-generation space, FLUX gives you a single command-line entry point (python -m flux) and a suite of task-specific models such as FLUX.1 [schnell], FLUX.1 [dev], FLUX.1 Fill [dev], and FLUX.1 Kontext [dev], each documented for a specific use case.
What it does
- Multiple open-weight models for distinct tasks: text-to-image (schnell, dev, Krea), Fill for in/out-painting, Canny and Depth for structural conditioning, Redux for image variation, and Kontext for image editing
- Minimal inference code you run locally after cloning the repo and installing with pip
- Single CLI entry point (python -m flux) with subcommands like kontext, plus --prompt and --loop flags
- Optional TensorRT support via an NVIDIA PyTorch container for accelerated inference
- Built-in usage tracking (--track_usage) for commercial licensing through the BFL API
- Access to the same models, including Pro tier, through the Black Forest Labs API at docs.bfl.ai
Getting started
Clone the repository, create a Python 3.10 virtual environment, and install the package; then run a model from the command line.
Install locally
Clone the repo, set up a Python 3.10 virtual environment, and install all extras.
cd $HOME && git clone https://github.com/black-forest-labs/flux
cd $HOME/flux
python3.10 -m venv .venv
source .venv/bin/activate
pip install -e ".[all]"Run a single generation
Call a model such as FLUX.1 Kontext with a prompt. Models are pulled from Hugging Face on first use.
python -m flux kontext --prompt "replace the logo with the text 'Black Forest Labs'"Enable usage tracking for commercial use
If you use an open-weight model commercially, set your BFL API key and pass --track_usage so usage is reported to the BFL API.
export BFL_API_KEY="your_api_key_here"
python -m flux kontext --track_usage --loopCommands and code are distilled from the project's own documentation — always check the official repo for the latest.
When to use it
- Generate images from text prompts locally with FLUX.1 [schnell] or [dev] instead of relying on a hosted service
- Edit existing images, including in-context edits like swapping a logo, using FLUX.1 Kontext [dev]
- Do in-painting and out-painting with FLUX.1 Fill [dev], or guide generation with edges and depth via Canny and Depth models
- Build a product on the open weights and report usage with --track_usage to stay within the commercial license
How FLUX compares
FLUX alongside other open-source image generation tools AI/TLDR tracks, ranked by GitHub stars.
| Tool | Stars | What it does |
|---|---|---|
| Stable Diffusion web UI (AUTOMATIC1111) | ★ 164k | A browser interface for running Stable Diffusion image generation locally with extensions and fine-grained controls. |
| ComfyUI | ★ 118k | A node-based visual editor for building and running image and video generation pipelines like Stable Diffusion and FLUX locally. |
| Fooocus | ★ 50.4k | A simplified image generation app built on Stable Diffusion that hides technical settings for easy prompting. |
| InvokeAI | ★ 27.5k | A self-hosted creative tool and canvas for generating and editing images with open diffusion models. |
| Stability-AI generative-models | ★ 27.2k | Stability AI's official code for its Stable Diffusion family of image and video generation models. |
| FLUX | ★ 25.6k | Open-weight diffusion models and inference code for generating and editing images from text |
| Z-Image | ★ 11.6k | Alibaba Tongyi's 6B-parameter open image model that produces photorealistic images quickly on a single GPU. |
| DALLE2-pytorch | ★ 11.3k | An open implementation of DALL-E 2 in PyTorch, with the CLIP encoder, diffusion prior, and cascading decoder you train to generate images from text. |