Home
Login

FLUX.1 is an advanced text-to-image generation AI model developed by Black Forest Labs, supporting high-quality image generation and editing.

Apache-2.0Python 23.2kblack-forest-labsflux Last Updated: 2025-07-01

FLUX.1 Project Detailed Introduction

Project Overview

FLUX.1 is a state-of-the-art text-to-image generation AI model series developed by Black Forest Labs. This GitHub repository provides the official inference code for the FLUX.1 models, allowing users to run image generation and editing functionalities.

Core Features

Model Architecture

  • Base Architecture: Based on Rectified Flow Transformer blocks
  • Parameter Scale: Scaled to 12 billion parameters
  • Technical Innovation: Trained using latent adversarial diffusion distillation techniques

Model Versions

FLUX.1 offers multiple versions to meet different needs:

  1. FLUX.1 [schnell]

    • Fast version, generates high-quality images in just 1-4 steps
    • Released under the Apache-2.0 license
    • Supports personal, research, and commercial use
  2. FLUX.1 [dev]

    • Development version, provides higher generation quality
    • Suitable for developers for research and experimentation
  3. FLUX.1 [pro]

    • Professional version, offers the highest performance
    • Supports 4MP image generation
    • Includes raw mode for more realistic results

Functionality

  • Text-to-Image Generation: Generates high-quality images from text descriptions
  • Image Editing: Supports local editing and generative modification
  • Text Handling: Improved typography generation capabilities
  • Unified Model: A single model supports various generation and editing tasks
  • Character Consistency: Supports iterative workflows and maintains character consistency

Installation and Usage

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

TensorRT Support Installation

If TensorRT support is required, use NVIDIA's PyTorch image:

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

API Usage

Python Interface

from flux.api import ImageRequest

# Create an API request
request = ImageRequest("A beautiful beach", name="flux.1.1-pro")
# Or use an API key: request = ImageRequest("A beautiful beach", name="flux.1.1-pro", api_key="your_key_here")

# Get the result URL
request.url
# -> https:<...>/sample.jpg

# Get the image byte data
request.bytes
# -> b"..." bytes for the generated image

# Save to local
request.save("outputs/api.jpg")

# Get the PIL image object
request.image
# -> a PIL image

Command-Line Interface

# Get the URL of the generated image
$ python -m flux.api --prompt="A beautiful beach" url
https:<...>/sample.jpg

# Generate and save the result
$ python -m flux.api --prompt="A beautiful beach" save outputs/api

# Display the image directly
$ python -m flux.api --prompt="A beautiful beach" image show

API Service

Black Forest Labs provides a complete API service:

  • API Documentation: docs.bfl.ml
  • API Registration: api.bfl.ml
  • Usage: Requires account registration and API key creation

API Key Configuration

export BFL_API_KEY=<your_key_here>

Or provide it directly in the code:

api_key="your_key_here"

Technical Advantages

  1. High-Quality Output: Generated image quality reaches industry-leading levels
  2. Precise Prompt Following: Accurately understands and executes complex text prompts
  3. Diverse Output: Supports image generation in various styles and themes
  4. Fast Inference: The schnell version can complete generation in very few steps
  5. Flexible Deployment: Supports local deployment and cloud API calls

Related Resources

Summary

FLUX.1 represents the highest level of current text-to-image generation technology. Through its advanced architecture design and multi-version strategy, it provides a powerful and flexible image generation solution for various users, from researchers to commercial users. Whether pursuing rapid prototyping for speed or requiring the highest quality for professional applications, FLUX.1 can provide the corresponding solution.

Star History Chart