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
- Get your API key from bfl.ml
- Set the
FLUX_API_KEYenvironment variable in your.envfile:
FLUX_API_KEY=your_api_key_here- Restart LibreChat and add Flux to an agent's Tools list.
| Deployment | Command |
|---|---|
| Docker | docker compose down && docker compose up -d |
| Local | Stop 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:
- generate - Create a new image from a text prompt
- generate_finetuned - Create an image using a fine-tuned model
- 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
- Be specific and detailed in descriptions
- 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