来自 Black Forest Labs: https://bfl.ai.
我们的 API 文档可以在这里找到:docs.bfl.ai.

此仓库包含了使用我们的 FLUX 开放权重模型进行图像生成和编辑的最小推理代码。
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]"
如果你想安装支持 TensorRT 的仓库,目前需要从 NVIDIA 安装一个 PyTorch 镜像。首先安装 enroot,然后按照以下步骤操作:
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
我们提供了一系列广泛的开放权重模型。有关各个模型的更多信息,请参考 用法 下的链接。
| 名称 | 用法 | HuggingFace 仓库 | 许可证 |
|---|---|---|---|
FLUX.1 [schnell] |
文生图 | https://huggingface.co/black-forest-labs/FLUX.1-schnell | apache-2.0 |
FLUX.1 [dev] |
文生图 | https://huggingface.co/black-forest-labs/FLUX.1-dev | FLUX.1-dev 非商业许可证 |
FLUX.1 Fill [dev] |
内外绘制 | https://huggingface.co/black-forest-labs/FLUX.1-Fill-dev | FLUX.1-dev 非商业许可证 |
FLUX.1 Canny [dev] |
结构条件控制 | https://huggingface.co/black-forest-labs/FLUX.1-Canny-dev | FLUX.1-dev 非商业许可证 |
FLUX.1 Depth [dev] |
结构条件控制 | https://huggingface.co/black-forest-labs/FLUX.1-Depth-dev | FLUX.1-dev 非商业许可证 |
FLUX.1 Canny [dev] LoRA |
结构条件控制 | https://huggingface.co/black-forest-labs/FLUX.1-Canny-dev-lora | FLUX.1-dev 非商业许可证 |
FLUX.1 Depth [dev] LoRA |
结构条件控制 | https://huggingface.co/black-forest-labs/FLUX.1-Depth-dev-lora | FLUX.1-dev 非商业许可证 |
FLUX.1 Redux [dev] |
图像变体 | https://huggingface.co/black-forest-labs/FLUX.1-Redux-dev | FLUX.1-dev 非商业许可证 |
FLUX.1 Kontext [dev] |
图像编辑 | https://huggingface.co/black-forest-labs/FLUX.1-Kontext-dev | FLUX.1-dev 非商业许可证 |
FLUX.1 Krea [dev] |
文生图 | https://huggingface.co/black-forest-labs/FLUX.1-Krea-dev | FLUX.1-dev 非商业许可证 |
自动编码器的权重也基于 apache-2.0 发布,可以在上面的 HuggingFace 仓库中找到。
我们的 API 提供对所有模型的访问,包括我们专业级的非开放权重模型。查看我们的 API 文档 docs.bfl.ai 以了解更多。
你可以在这里为商业用途获取我们的模型许可:https://bfl.ai/pricing/licensing
由于费用基于月度使用量,我们提供了通过 BFL API 自动跟踪使用情况的代码。要启用使用跟踪,请在命令行中选择 *track_usage* 或在我们的演示中勾选相应的复选框。
我们提供了一个参考实现,用于在启用商业许可使用跟踪的情况下运行 FLUX.1。
只要使用情况报告准确,可以根据需要对此进行定制。
为了使报告逻辑正常工作,你需要在运行前将你的 API 密钥设置为环境变量:
export BFL_API_KEY="your_api_key_here"
你可以像这样激活跟踪来调用 FLUX.1 Kontext [dev]:
python -m flux kontext --track_usage --loop
对于单次生成:
python -m flux kontext --track_usage --prompt "将徽标替换为文字 'Black Forest Labs'"
上述报告逻辑对于 FLUX.1 [dev] 和 FLUX.1 Tools [dev] 的工作方式类似。
请注意,这仅在商业使用我们的一个或多个开放权重模型时需要。有关商业许可的更多信息,请访问 BFL 帮助中心。
如果你发现提供的代码或模型对你的研究有用,请考虑引用它们:
@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}},
}