flux README

The project's README from github.com/black-forest-labs/flux. As one markdown file: README.md.

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://[email protected]#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}},
}

flux (black-forest-labs/flux)

Searching Database…

26K ·GitHub
这是什么?这是 Black Forest Labs 官方的推理仓库,面向 FLUX.1 系列图像生成与编辑扩散模型,提供运行开源权重模型的极简代码。
这是现成的应用,还是只是需要我自己运行的代码?这是推理代码(一个 Python 库或命令行工具),你需要自行安装并在本地运行来调用 Flux 模型;Black Forest Labs 也提供托管 API,作为本地推理之外的另一种选择。
除了代码,我还需要什么?你需要来自链接的 HuggingFace 仓库的模型权重以及 PyTorch;若要使用 TensorRT,还需要 NVIDIA PyTorch 容器和 enroot;若要进行商业用量追踪,需要把 BFL API 密钥设置为环境变量。
列出的 FLUX.1 模型是否都可以下载,还是有些仅限 API 使用?列出的所有模型(schnell、dev、Fill、Canny、Depth 及其 LoRA 变体、Redux、Kontext、Krea)都在 HuggingFace 上提供开源权重,但 API 还额外提供未以开源权重发布的 Pro 级别模型。
这个仓库是给谁用的?它面向希望直接运行 Flux 推理或基于它进行研究开发的开发者和研究人员,并附有引用指南;生产或商业用途需要单独授权。
所有 FLUX.1 模型都能免费使用,包括商用吗?只有 FLUX.1 schnell 和自编码器权重采用 Apache-2.0 许可;FLUX.1 dev 及其他大多数变体(Fill、Canny、Depth、LoRA 版本、Redux、Kontext、Krea)则采用 FLUX.1-dev 非商业许可证,商用需要付费的商业许可证并进行用量追踪。
FLUX.1 schnell 和 dev 有什么区别?FLUX.1 schnell 采用 Apache-2.0 许可,用于快速的文生图;FLUX.1 dev 及其变体则采用限制更严格的 FLUX.1-dev 非商业许可证,并提供编辑和结构条件控制等功能。
什么是 FLUX.1 Kontext?它是该系列中的一个开源权重模型,专门用于图像编辑,而不是从零开始生成图像。
我能把开源权重模型用于商业用途吗?可以,但你需要向 BFL 购买商业许可证,并启用用量追踪(trackusage 标志),以便通过 BFL API 上报你的使用情况。
有没有托管 API,可以不用自己运行?有,BFL 提供记录在 docs.bfl.ai 的 API,还可以使用未以开源权重发布的 Pro 级别模型。
Size
36.6 MB
Stars
26K
Updated
CommitJul 31
Age
2y
Commits · 90 Days