ComfyUI Extension: comfyui-fal-flux-2-John
Custom nodes for ComfyUI that integrate with fal.ai's FLUX 2 and FLUX 1 LoRA APIs for text-to-image generation.
Custom Nodes (0)
README
ComfyUI fal.ai FLUX 2 Custom Nodes
Custom nodes for ComfyUI/RunComfy that integrate with fal.ai's FLUX 2 and FLUX 1 LoRA APIs.
š Features
Standard Nodes
| Node | Description | Endpoint |
|------|-------------|----------|
| FLUX.2 [dev] | Text-to-image with FLUX.2 | fal-ai/flux-2 |
| FLUX.2 PRO | Premium quality FLUX.2 | fal-ai/flux-2-pro |
| FLUX.2 [dev] + LoRA | Text-to-image with LoRA support | fal-ai/flux-2/lora |
| FLUX.2 LoRA Weight | Helper to chain multiple LoRAs | - |
| FLUX.1 [dev] + LoRA | Original FLUX.1 with LoRA | fal-ai/flux-lora |
š JSON Structured Prompting Nodes (NEW!)
| Node | Description | Endpoint |
|------|-------------|----------|
| FLUX.2 [dev] JSON | Structured prompting with intuitive fields | fal-ai/flux-2 |
| FLUX.2 PRO JSON | Premium with structured prompting | fal-ai/flux-2-pro |
| FLUX.2 [dev] + LoRA JSON | LoRA + structured prompting | fal-ai/flux-2/lora |
| FLUX.1 [dev] + LoRA JSON | FLUX.1 with structured prompting | fal-ai/flux-lora |
FLUX.2 Capabilities
- šØ Enhanced realism and crisper text generation
- š Supports resolutions up to 2048x2048
- šÆ JSON structured prompts for precise control
- šØ HEX color code control
- š¼ļø Multi-image referencing with
@syntax - ā” Acceleration modes (regular, high)
- š§ LoRA fine-tuning support
š¦ Installation
Method 1: ComfyUI Manager (Recommended)
- Open ComfyUI Manager
- Search for "fal flux" or install from Git URL:
https://github.com/YOUR_USERNAME/comfyui-fal-flux2
Method 2: Manual Installation
# Navigate to ComfyUI custom nodes directory
cd ComfyUI/custom_nodes
# Clone this repository
git clone https://github.com/YOUR_USERNAME/comfyui-fal-flux2.git
# Install dependencies
cd comfyui-fal-flux2
pip install -r requirements.txt
# Restart ComfyUI
Method 3: Direct Copy
- Download/copy the entire
comfyui-fal-flux2folder - Place it in
ComfyUI/custom_nodes/ - Install dependencies:
pip install requests Pillow numpy torch - Restart ComfyUI
š API Key Setup
You need a fal.ai API key. Get one at: https://fal.ai/dashboard/keys
Option A: Environment Variable (Recommended)
Linux/Mac:
export FAL_KEY="your-api-key-here"
Add to your .bashrc or .zshrc for persistence:
echo 'export FAL_KEY="your-api-key-here"' >> ~/.bashrc
source ~/.bashrc
Windows (Command Prompt):
setx FAL_KEY "your-api-key-here"
Windows (PowerShell):
[Environment]::SetEnvironmentVariable("FAL_KEY", "your-api-key-here", "User")
Option B: Direct Input
Enter your API key directly in the node's api_key field.
ā ļø Less secure - your key will be visible in saved workflows.
šļø Node Parameters
FLUX.2 [dev] (FalFlux2)
| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| prompt | string | - | Your text prompt (required) |
| api_key | string | env | fal.ai API key |
| image_size | enum | landscape_4_3 | Preset sizes or "custom" |
| custom_width | int | 1024 | Width when size is "custom" (512-2048) |
| custom_height | int | 768 | Height when size is "custom" (512-2048) |
| guidance_scale | float | 2.5 | Prompt adherence (0-20) |
| num_inference_steps | int | 28 | Denoising steps (1-100) |
| seed | int | -1 | Random seed (-1 for random) |
| num_images | int | 1 | Batch size (1-4) |
| acceleration | enum | regular | Speed mode: none/regular/high |
| enable_prompt_expansion | bool | false | Auto-enhance prompts |
| enable_safety_checker | bool | true | NSFW filter |
| output_format | enum | png | png/jpeg/webp |
FLUX.2 [dev] + LoRA (FalFlux2LoRA)
Same as above, plus:
| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| loras | FAL_LORA_LIST | - | Connect LoRA Weight nodes |
| lora_url_1 | string | "" | Direct LoRA URL |
| lora_scale_1 | float | 1.0 | LoRA 1 strength (0-2) |
| lora_url_2 | string | "" | Second LoRA URL |
| lora_scale_2 | float | 1.0 | LoRA 2 strength (0-2) |
FLUX.2 LoRA Weight (FalFlux2LoRAWeight)
| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| lora_url | string | "" | URL to .safetensors file |
| scale | float | 1.0 | Weight scale (0-2) |
| previous_loras | FAL_LORA_LIST | - | Chain input for multiple LoRAs |
š Image Size Presets
| Preset | Resolution |
|--------|------------|
| square_hd | 1024Ć1024 |
| square | 512Ć512 |
| portrait_4_3 | 768Ć1024 |
| portrait_16_9 | 576Ć1024 |
| landscape_4_3 | 1024Ć768 |
| landscape_16_9 | 1024Ć576 |
| custom | User-defined (512-2048) |
š” Usage Examples
Basic Text-to-Image
Prompt: "A majestic lion in the African savanna at golden hour,
dramatic lighting, wildlife photography, 8K resolution"
Using LoRAs
Method 1: Direct URLs
- Set
lora_url_1to your LoRA safetensors URL - Adjust
lora_scale_1(default 1.0)
Method 2: Chained LoRA Nodes
- Add multiple
FLUX.2 LoRA Weightnodes - Connect them in series via
previous_loras - Connect final output to
FLUX.2 + LoRAnode'slorasinput
JSON Structured Prompts (NEW! š)
The new JSON nodes provide an intuitive, field-based approach to building prompts:
Two Modes:
- Text Mode - Traditional text prompt (same as standard nodes)
- JSON Structured Mode - Fill in individual fields that get intelligently combined
Structured Fields:
| Field | Description | Example |
|-------|-------------|---------|
| subject | Main subject/scene | "a majestic knight in full armor" |
| style | Artistic style | "cinematic photography" |
| lighting | Lighting setup | "dramatic sunset lighting" |
| camera | Camera settings | "50mm lens, f/1.8" |
| composition | Framing | "close-up shot" |
| colors | Color palette | "warm golden and orange tones" |
| mood | Atmosphere | "epic and heroic" |
| details | Quality terms | "highly detailed, 8k, sharp focus" |
How It Works:
The node automatically builds a well-structured prompt from your inputs:
Input Fields:
- Subject: "a vintage red sports car"
- Style: "professional automotive photography"
- Lighting: "golden hour sunlight"
- Camera: "35mm lens, wide angle"
- Colors: "vibrant reds and warm tones"
- Details: "4K, highly detailed"
Generated Prompt:
a vintage red sports car, in professional automotive photography style, 35mm lens, wide angle, with golden hour sunlight, vibrant reds and warm tones color palette, 4K, highly detailed
Benefits:
ā Intuitive - No need to write complex prompts manually ā Consistent - Fields ensure proper structure every time ā Flexible - Leave any field empty, only use what you need ā Switchable - Toggle to text mode for traditional prompting ā Learnable - Great for beginners learning prompt structure
HEX Color Control
Include HEX codes in your prompt:
"A sports car in color #FF4500 with accents in hex #1A1A1A"
š° Pricing (fal.ai)
| Endpoint | Price | |----------|-------| | FLUX.2 [dev] | $0.012/megapixel | | FLUX.2 [dev] + LoRA | $0.021/megapixel | | FLUX.1 + LoRA | $0.035/megapixel |
1 megapixel ā 1024Ć1024 image
š§ Troubleshooting
"FAL_KEY not found"
- Set the
FAL_KEYenvironment variable, OR - Enter your API key in the node's
api_keyfield
"Request failed" / Timeout
- Check your internet connection
- Verify your API key is valid at https://fal.ai/dashboard
- fal.ai may have temporary service issues
Images not loading
- Ensure you have
requestsandPillowinstalled - Check if the returned URLs are accessible
"No module named 'nodes'"
- Ensure the folder structure is correct:
ComfyUI/custom_nodes/comfyui-fal-flux2/ āāā __init__.py āāā nodes.py āāā requirements.txt
š API Reference
- fal.ai FLUX.2 Documentation
- fal.ai FLUX.2 + LoRA Documentation
- fal.ai FLUX.1 + LoRA Documentation
- FLUX.2 Developer Guide
š License
MIT License - Use freely in personal and commercial projects.
š Credits
- fal.ai - API infrastructure
- Black Forest Labs - FLUX models
- ComfyUI community