Skip to main content
LibreChat is joining ClickHouse to power the open-source Agentic Data Stack šŸŽ‰ Learn more
LibreChat

Flux Image Generation

Setup and usage instructions for Flux image generation

Archived documentation

You are reading the frozen documentation for v0.8.7, which is no longer maintained. Go to the latest docs.

Flux is a powerful image generation tool that can create high-quality images from text descriptions. It supports various artistic styles and offers extensive customization options.

Setup Instructions

  1. Get your API key from bfl.ml
  2. Set the FLUX_API_KEY environment variable in your .env file:
FLUX_API_KEY=your_api_key_here
  1. Restart LibreChat and add Flux to an agent's Tools list.
DeploymentCommand
Dockerdocker compose down && docker compose up -d
LocalStop the server, then run npm run backend again

Features

Core Capabilities

  • Generate high-quality images from detailed text descriptions
  • Support for multiple artistic styles
  • Customizable image dimensions
  • Adjustable generation parameters
  • Multiple endpoint options for different use cases
  • Batch generation support (up to 24 images)

Available Endpoints

  • /v1/flux-pro - Standard endpoint (default)
  • /v1/flux-pro-1.1 - Enhanced version
  • /v1/flux-dev - Development version
  • /v1/flux-pro-1.1-ultra - Premium quality endpoint

Parameters

The Flux tool supports three main actions:

  1. generate - Create a new image from a text prompt
  2. generate_finetuned - Create an image using a fine-tuned model
  3. list_finetunes - List available custom models for the user

For generate action:

• prompt – Text description for the image (required)
• width – Width in pixels (multiple of 32)
• height – Height in pixels (multiple of 32)
• prompt_upsampling – Whether to perform upsampling on the prompt (default: false)
• steps – Number of diffusion steps (1-50, default: 40)
• seed – Optional seed for reproducibility
• safety_tolerance – Tolerance level for moderation (0-6, default: 6)
• endpoint – Model endpoint to use:

  • /v1/flux-pro-1.1 (default)
  • /v1/flux-pro
  • /v1/flux-dev
  • /v1/flux-pro-1.1-ultra • raw – Generate less processed images (only for ultra endpoint, default: false)

For generate_finetuned action:

• All parameters from generate plus:
• finetune_id – ID of the fine-tuned model (required)
• finetune_strength – Strength of the fine-tuning effect (0.1-1.2, default: 1.1)
• guidance – Guidance scale (default: 2.5)
• aspect_ratio – Aspect ratio for ultra models (default: "16:9")
• endpoint – Must be one of:

  • /v1/flux-pro-finetuned (default)
  • /v1/flux-pro-1.1-ultra-finetuned

Best Practices

Prompt Writing

  1. Be specific and detailed in descriptions
  2. Include key elements:
    • Subject matter
    • Style and artistic approach
    • Composition details
    • Lighting and atmosphere
    • Color preferences
    • Technical specifications

Tips for Best Results

  • Write prompts in English
  • Balance specificity with creative freedom
  • Avoid conflicting concepts
  • Focus on visual descriptions
  • Consider composition layers (foreground, middle ground, background)

Technical Details

Image Processing

  • Images are automatically saved and managed
  • Supports PNG output format
  • Includes built-in moderation and safety features
  • Asynchronous generation with status tracking

Integration Features

  • Seamless integration with chat interfaces
  • Markdown-formatted output
  • Built-in error handling and logging
  • Support for batch processing

Usage Examples

Here are some example prompts that work well with Flux:

A serene mountain landscape at sunset, with snow-capped peaks reflected in a crystal-clear alpine lake. Warm golden light illuminates wispy clouds, creating a dramatic atmosphere. Photorealistic style with rich colors and sharp details.

A futuristic cityscape at night, featuring neon-lit skyscrapers and flying vehicles. Cyberpunk style with deep blues and purples, accented by bright neon colors. Rain-slicked streets reflect the city lights, creating a moody atmosphere.

Error Handling

Common error messages and solutions:

  • API key issues: Verify your API key is correctly set in environment variables
  • Generation failures: Check prompt length and content guidelines
  • Timeout errors: May occur during high server load, retry after a brief wait

Rate Limits and Usage

  • Free tier includes generous usage limits
  • Multiple images can be generated in a single request
  • Consider using lower step counts for faster generations during testing