Flux Image Generation
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_KEY
environment variable in your.env
file:
FLUX_API_KEY=your_api_key_here
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