# FLUX

> Open-weight diffusion models and inference code for generating and editing images from text

- Category: Multimodal Generation / Image Generation
- Language: Python
- Licence: Apache-2.0
- Repository: https://github.com/black-forest-labs/flux
- Website: https://blackforestlabs.ai
- Canonical page: https://ai-tldr.dev/tools/flux/

## In short

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 sits in the Image Generation category of the Multimodal Generation tools and is open-source, written in Python and licensed Apache-2.0.

## 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.

1. Install locally

   Clone the repo, set up a Python 3.10 virtual environment, and install all extras.

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

2. Run a single generation

   Call a model such as FLUX.1 Kontext with a prompt. Models are pulled from Hugging Face on first use.

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

3. 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.

```bash
export BFL_API_KEY="your_api_key_here"
python -m flux kontext --track_usage --loop
```

## 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
