MCPcopy
hub / github.com/black-forest-labs/flux

github.com/black-forest-labs/flux @main sqlite

repository ↗ · DeepWiki ↗
271 symbols 1,115 edges 35 files 25 documented · 9%
README

FLUX

by Black Forest Labs: https://bfl.ai.

Documentation for our API can be found here: docs.bfl.ai.

grid

This repo contains minimal inference code to run image generation & editing with our Flux open-weight models.

Local installation

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

Local installation with TensorRT support

If you would like to install the repository with TensorRT support, you currently need to install a PyTorch image from NVIDIA instead. First install enroot, next follow the steps below:

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

Open-weight models

We are offering an extensive suite of open-weight models. For more information about the individual models, please refer to the link under Usage.

Name Usage HuggingFace repo License
FLUX.1 [schnell] Text to Image https://huggingface.co/black-forest-labs/FLUX.1-schnell apache-2.0
FLUX.1 [dev] Text to Image https://huggingface.co/black-forest-labs/FLUX.1-dev FLUX.1-dev Non-Commercial License
FLUX.1 Fill [dev] In/Out-painting https://huggingface.co/black-forest-labs/FLUX.1-Fill-dev FLUX.1-dev Non-Commercial License
FLUX.1 Canny [dev] Structural Conditioning https://huggingface.co/black-forest-labs/FLUX.1-Canny-dev FLUX.1-dev Non-Commercial License
FLUX.1 Depth [dev] Structural Conditioning https://huggingface.co/black-forest-labs/FLUX.1-Depth-dev FLUX.1-dev Non-Commercial License
FLUX.1 Canny [dev] LoRA Structural Conditioning https://huggingface.co/black-forest-labs/FLUX.1-Canny-dev-lora FLUX.1-dev Non-Commercial License
FLUX.1 Depth [dev] LoRA Structural Conditioning https://huggingface.co/black-forest-labs/FLUX.1-Depth-dev-lora FLUX.1-dev Non-Commercial License
FLUX.1 Redux [dev] Image variation https://huggingface.co/black-forest-labs/FLUX.1-Redux-dev FLUX.1-dev Non-Commercial License
FLUX.1 Kontext [dev] Image editing https://huggingface.co/black-forest-labs/FLUX.1-Kontext-dev FLUX.1-dev Non-Commercial License
FLUX.1 Krea [dev] Text to Image https://huggingface.co/black-forest-labs/FLUX.1-Krea-dev FLUX.1-dev Non-Commercial License

The weights of the autoencoder are also released under apache-2.0 and can be found in the HuggingFace repos above.

API usage

Our API offers access to all models including our Pro tier non-open weight models. Check out our API documentation docs.bfl.ai to learn more.

Licensing models for commercial use

You can license our models for commercial use here: https://bfl.ai/pricing/licensing

As the fee is based on a monthly usage, we provide code to automatically track your usage via the BFL API. To enable usage tracking please select track_usage in the cli or click the corresponding checkmark in our provided demos.

Example: Using FLUX.1 Kontext with usage tracking

We provide a reference implementation for running FLUX.1 with usage tracking enabled for commercial licensing. This can be customized as needed as long as the usage reporting is accurate.

For the reporting logic to work you will need to set your API key as an environment variable before running:

export BFL_API_KEY="your_api_key_here"

You can call FLUX.1 Kontext [dev] like this with tracking activated:

python -m flux kontext --track_usage --loop

For a single generation:

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

The above reporting logic works similarly for FLUX.1 [dev] and FLUX.1 Tools [dev].

Note that this is only required when using one or more of our open weights models commercially. More information on the commercial licensing can be found at the BFL Helpdesk.

Citation

If you find the provided code or models useful for your research, consider citing them as:

@misc{labs2025flux1kontextflowmatching,
      title={FLUX.1 Kontext: Flow Matching for In-Context Image Generation and Editing in Latent Space},
      author={Black Forest Labs and Stephen Batifol and Andreas Blattmann and Frederic Boesel and Saksham Consul and Cyril Diagne and Tim Dockhorn and Jack English and Zion English and Patrick Esser and Sumith Kulal and Kyle Lacey and Yam Levi and Cheng Li and Dominik Lorenz and Jonas Müller and Dustin Podell and Robin Rombach and Harry Saini and Axel Sauer and Luke Smith},
      year={2025},
      eprint={2506.15742},
      archivePrefix={arXiv},
      primaryClass={cs.GR},
      url={https://arxiv.org/abs/2506.15742},
}

@misc{flux2024,
    author={Black Forest Labs},
    title={FLUX},
    year={2024},
    howpublished={\url{https://github.com/black-forest-labs/flux}},
}

Core symbols most depended-on inside this repo

to
called by 97
src/flux/trt/engine/base_engine.py
cpu
called by 43
src/flux/trt/engine/base_engine.py
get_noise
called by 8
src/flux/sampling.py
get_schedule
called by 8
src/flux/sampling.py
denoise
called by 8
src/flux/sampling.py
unpack
called by 8
src/flux/sampling.py
load_flow_model
called by 8
src/flux/util.py
load_t5
called by 8
src/flux/util.py

Shape

Method 150
Function 67
Class 54

Languages

Python100%

Modules by API surface

src/flux/trt/engine/base_engine.py30 symbols
src/flux/modules/layers.py29 symbols
src/flux/modules/autoencoder.py29 symbols
src/flux/util.py18 symbols
src/flux/trt/trt_config/base_trt_config.py14 symbols
src/flux/trt/engine/vae_engine.py14 symbols
src/flux/trt/trt_manager.py12 symbols
src/flux/trt/trt_config/vae_trt_config.py12 symbols
src/flux/sampling.py11 symbols
src/flux/trt/trt_config/transformer_trt_config.py9 symbols
src/flux/modules/image_embedders.py9 symbols
demo_st_fill.py8 symbols

Dependencies from manifests, versioned

accelerate
einops
fire0.6.0 · 1×
huggingface-hub
protobuf
ruff0.6.8 · 1×
safetensors
sentencepiece
tokenizers
transformers4.45.2 · 1×

For agents

$ claude mcp add flux \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact