Flux

Models & AI Labs 💻 Python ⚖️ Apache-2.0 🔴 No recent commits
25.9k stars

FLUX is a repository by Black Forest Labs containing minimal inference code for image generation and editing using their open-weight models. It solves the problem of running state-of-the-art text-to-image and image editing models locally. It is intended for developers and researchers who want to integrate or experiment with these models.

✨ Key features

  • Supports multiple open-weight models: schnell, dev, Fill, Canny, Depth, Redux, Kontext, Krea.
  • Includes code for text-to-image, in/out-painting, structural conditioning, image variation, and editing.
  • Provides local installation with optional TensorRT support for optimized inference.
  • Offers API access to all models including Pro tier via docs.bfl.ai.
  • Includes usage tracking for commercial licensing compliance.
  • Reference implementations for using models with tracking enabled.

🎯 Use cases

  • Generate images from text prompts using FLUX.1 [schnell] or [dev].
  • Perform inpainting or outpainting with FLUX.1 Fill [dev].
  • Apply structural conditioning with Canny or Depth models.
  • Create image variations with FLUX.1 Redux [dev].
  • Edit images in context with FLUX.1 Kontext [dev].

📦 Installation

🧰 Requirements: Python 3.10, git, and optionally enroot for TensorRT installation. For usage tracking, a BFL API key is required.

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]"

For TensorRT support:

cd $HOME && git clone https://github.com/black-forest-labs/flux
enroot import 'docker://$oauthtoken@nvcr.io#nvidia/pytorch:25.01-py3'
enroot create -n pti2501 nvidia+pytorch+25.01-py3.sqsh
enroot start --rw -m ${PWD}/flux:/workspace/flux -r pti2501
cd flux
pip install -e ".[tensorrt]" --extra-index-url https://pypi.nvidia.com

🚀 Usage

python -m flux kontext --track_usage --prompt "replace the logo with the text 'Black Forest Labs'"

For a loop with tracking:

python -m flux kontext --track_usage --loop

⚠️ Good to know

Some models are under non-commercial licenses; commercial use requires licensing and usage tracking. TensorRT installation requires NVIDIA PyTorch container.

❓ FAQ

What models are available in this repository?

The repository includes open-weight models: FLUX.1 [schnell], [dev], Fill [dev], Canny [dev], Depth [dev], Redux [dev], Kontext [dev], and Krea [dev].

How do I install FLUX locally?

Clone the repo, create a Python 3.10 virtual environment, and run pip install -e ".[all]".

Can I use the models commercially?

Some models are under non-commercial licenses. For commercial use, you must license them via bfl.ai and enable usage tracking with a BFL API key.

How do I enable usage tracking?

Set the BFL_API_KEY environment variable and use the --track_usage flag in the CLI commands.

📊 Repository

Stars★ 25,941
Forks🍴 1,913
Open issues🐛 216
Last commit🕒 Jul 31, 2025
Created📅 Aug 2024
Language💻 Python
License⚖️ Apache-2.0

🤖 Overview, features, install steps and FAQ were generated from the project's README on Sep 4, 2026. Always check the original source before running commands.