Skip to main content
< All Topics
Print

FLUX Image Generation

name: flux-image-generation

description: Generate and edit images using Black Forest Labs FLUX models via the ITI multi-backend image generation API. Covers text-to-image, image editing, multi-reference composition, prompt engineering for FLUX (natural language, hex colors, text rendering), BFL API model selection, and local Klein 4B inference. Use when generating product images, marketing visuals, brand-consistent assets, images with text, or editing existing images with AI.

FLUX Image Generation

Instructions

Generate images using FLUX models through the ITI image generation API at http://localhost:7860 (native) or http://stable-diffusion:7860 (Docker network).

Two FLUX backends are available:

Backend Model Speed Cost License
flux-local FLUX.2 Klein 4B Sub-second (GPU) Free Apache 2.0
flux-api Any FLUX model via BFL cloud 2-10s $0.014-0.07/image Commercial API

Text-to-image with FLUX API (cloud):


curl -X POST http://localhost:7860/api/txt2img \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A professional product photograph of wireless earbuds on a marble surface, soft studio lighting, photorealistic",
    "backend": "flux-api",
    "bfl_model": "flux-2-pro-preview",
    "width": 1024,
    "height": 1024
  }'

Text-to-image with FLUX Klein (local):


curl -X POST http://localhost:7860/api/txt2img \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A cat holding a sign that says hello world",
    "backend": "flux-local",
    "width": 1024,
    "height": 1024
  }'

Image editing (multi-reference):


curl -X POST "http://localhost:7860/api/img2img?prompt=change+background+to+beach+at+sunset&backend=flux-api" \
  -F "image=@photo.png"

BFL API model selection guide:

Model Best For Price Key Feature
flux-2-pro-preview Production quality, general use $0.03/MP Latest quality
flux-2-pro Reproducible workflows $0.03/MP Fixed snapshot
flux-2-max Highest quality, real-time info $0.07/MP Grounding search
flux-2-flex Typography, text overlays $0.06/MP Best text rendering
flux-2-klein-4b High volume, budget $0.014+/img Sub-second
flux-2-klein-9b-preview Balanced quality/speed $0.015+/img Latest Klein

Prompt engineering for FLUX:

FLUX uses natural language prompts — not the keyword-heavy style of Stable Diffusion:

  • Write descriptive sentences: “A golden retriever sitting in a sunlit garden with dappled shadows”
  • Text rendering works: ‘A coffee mug with the text “Good Morning” in serif font’
  • Hex colors are precise: “A vase with color gradient from #02eb3c to #edfa3c”
  • Structured prompting for complex scenes:

{
  "subject": "Luxury watch on dark velvet",
  "background": "deep black, subtle gradient",
  "lighting": "dramatic side lighting, warm highlights",
  "style": "product photography, high contrast",
  "camera_angle": "45 degree overhead",
  "composition": "centered, shallow depth of field"
}
  • Multi-reference editing: FLUX can combine elements from multiple source images while maintaining identity (up to 4 images for Klein, 10 for Pro/Max)
  • Negative prompts are NOT used — quality is controlled through positive prompting
  • Caption upsampling (caption_upsample_temperature: 0.15) can improve output when using Flux2Pipeline (dev model)

FLUX Klein parameter defaults:

Parameter Distilled (default) Base (fine-tuning)
num_inference_steps 4 20-50
guidance_scale 1.0-4.0 4.0-7.0
Max resolution 2048×2048 2048×2048

FLUX vs Stable Diffusion — when to use which:

Capability FLUX Stable Diffusion
Photorealism Superior Good
Text in images Reliable Poor
Prompt following Natural language, precise Keyword-heavy
Color control Hex code exact matching Approximate
Multi-reference editing Built-in (no fine-tuning) Requires LoRA/fine-tune
Community LoRAs Growing Largest ecosystem
Speed (local) 4 steps (Klein) 30-50 steps
VRAM ~13GB (Klein 4B) ~5GB (SD 2.1)

n8n workflow integration:

Use an HTTP Request node. Add "backend": "flux-api" or "flux-local" to the JSON body:


{
  "prompt": "Marketing hero image for SaaS product launch, modern tech aesthetic",
  "backend": "flux-api",
  "bfl_model": "flux-2-pro-preview",
  "width": 1440,
  "height": 1024
}

Common use cases:

  • Marketing asset generation with brand-consistent colors (hex code control)
  • Product mockup creation with text labels and pricing
  • Social media graphics with readable text overlays
  • Blog post featured images from natural language descriptions
  • E-commerce product photography variations
  • Concept visualization for consulting deliverables
  • Character-consistent image sets (multi-reference editing)

Resource awareness:

Backend Speed (1024×1024) Memory Cost
FLUX Klein local (MPS) ~5-15s ~13 GB Free
FLUX API (cloud) ~2-10s Negligible $0.014-0.07/img
Table of Contents