AI and VoIP Blog

VOIP | AI | Cloud | Kamailio | Open Source


flux-generator: Local Image Generation on Apple Silicon with Open WebUI Integration using Flux LLM

flux voipnuggets

I created Flux Generator to brings the power of local image generation to Apple Silicon Macs, offering both a standalone UI and seamless integration with Open WebUI. This tool leverages MLX for efficient image generation without requiring an internet connection or API keys.
The tool is available here, please star the repo to make the algorithm work.

Key Features

  • 🚀 Fast local image generation on Apple Silicon
  • 🎨 Built-in web interface
  • 🔌 Open WebUI compatibility
  • 📊 Real-time memory usage monitoring
  • 🔄 Multiple model options (black-forest-labs Flux schnell/dev, stabilityai sdxl-turbo/stable-diffusion-2-1)

Quick Start

  1. Install the requirements:
python3.11 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
  1. Run the Flux server:
# Local use only (most secure).
Can be used when Open WebUI is running on the same maching:
python3.11 flux_app.py
# For Open WebUI integration running on different machine:
python3.11 flux_app.py --listen-all

– The UI is accessable here http://127.0.0.1:7860 .
– Enter a prompt and click generate button.
– On the first use the model will get downloaded which is about 23 GB in size.
– The downloaded status is visible on the terminal.
– Once the model is downloaded the image generation will start.

Download the model using CLI for better download speed.

# Install the HuggingFace CLI
pip install -U "huggingface_hub[cli]"
# Install hf_transfer for blazingly fast
speeds
pip install hf_transfer
# Login to your HF account
huggingface-cli login
# Now you can download any model with
uncapped speeds
HF_HUB_ENABLE_HF_TRANSFER=1
huggingface-cli download <model-id>

Integration with Open WebUI

To use Flux Generator with Open WebUI:

  1. Start Flux server with network access:
./run_flux.sh
  1. Run Open WebUI container:
docker run -d -p 3000:8080 \
  --add-host=host.docker.internal:host-gateway \
  -e AUTOMATIC1111_BASE_URL=http://host.docker.internal:7860/ \
  -e ENABLE_IMAGE_GENERATION=True \
  -v open-webui:/app/backend/data \
  --name open-webui \
  ghcr.io/open-webui/open-webui:main
  1. Access Open WebUI at http://localhost:3000
Open WebUI configuration

Add the Base URL http://host.docker.internal:7860
If running Open WebUI directly without docker then use following base URL http://127.0.0.1:7860

flux openwebui flux app
Screenshot

The connection works like this:

Open WebUI (Docker) -> host.docker.internal:7860 -> Flux API (Host)

Model Options

  1. Flux Schnell
  • Fast generation (2 steps)
  • Good for rapid prototyping
  • Default choice for quick results
  1. Flux Dev
  • Higher quality (50 steps)
  • Better for final images
  • More resource intensive

Two new Stable Diffusion Models recently added
SD 2.1 Base
SDXL Turbo

Generation Parameters

  • Width/Height: 256-1024px (must be divisible by 64)
  • Steps: 1-100 (default: 2 for schnell, 50 for dev)
  • Guidance Scale: 1-20 (default: 4.0)
  • Seed: Optional for reproducible results

Resource Usage

The tool provides real-time memory monitoring:

  • Text Encoding: ~9GB
  • Image Generation: ~30GB
  • Decoding: ~27GB

Ensure your Mac has sufficient memory for optimal performance.

Security Notes

  • Local mode (./run_flux.sh) is most secure
  • Network mode (./run_flux.sh --network) listens to all IPs and is less secure
  • Use network mode only in trusted environments

Benefits

  • No internet required after initial model download
  • No API keys or subscriptions needed
  • Full control over generation parameters
  • Native Apple Silicon optimization
  • Real-time performance monitoring

Requirements

  • Apple Silicon Mac (M1/M2/M3)
  • macOS
  • Python 3.10+
  • MLX framework

Whether you prefer the clean, built-in UI or the powerful Open WebUI interface, Flux Generator provides a robust solution for local image generation on Apple Silicon Macs.

Leave a Reply

Join 48 other subscribers

Akash Gupta
Senior VoIP Engineer and AI Enthusiast



Discover more from AI and VoIP Blog

Subscribe to get the latest posts sent to your email.



One response to “flux-generator: Local Image Generation on Apple Silicon with Open WebUI Integration using Flux LLM”

  1. Sounds great! Can you apply LoRA’s or use other checkpoints? Thanks for putting this together!

Leave a Reply

Discover more from AI and VoIP Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading