A Python application that continuously generates creative images using AI. It uses an LLM for generating creative prompts and Flux for image generation.
7
stars
146
commits
Python
primary language
Aug 17, 2026
updated
Generate unlimited AI images locally with no subscriptions, no cloud APIs, and complete privacy. Your machine dreams with you! ✨
DreamGen is an independent research and artistic hobby project for exploring what local image models "dream," how their behavior changes, and where their boundaries appear. It is not a hosted production image service. Model names and upstream projects are identified for reproducibility; their inclusion does not imply sponsorship, endorsement, or affiliation.
Beautiful, VS Code-inspired dark theme with real-time generation and organized galleries. The web interface features:
Use this path if you want to run DreamGen as an installed command and do not need to edit the source code.
uv venv --python 3.11
source .venv/bin/activate # Windows PowerShell: .venv\Scripts\Activate.ps1
uv pip install dreamgen
Verify the install without downloading image models or requiring a GPU:
dreamgen generate --mock
The plain uv pip install dreamgen command resolves from PyPI. For NVIDIA systems where you specifically want CUDA 12.4 PyTorch wheels from the PyTorch index, include the extra index during install:
uv pip install dreamgen --extra-index-url https://download.pytorch.org/whl/cu124
Use this path for development, local web UI work, or Docker review.
# Clone the repository
git clone https://github.com/Agentic-Insights/dreamgen
cd dreamgen
# Install Python dependencies
uv sync
# Configure the app
cp .env.example .env
# Edit .env for your machine:
# - OLLAMA_MODEL is the preferred local prompt model; DreamGen normalizes stale values at runtime
# - OLLAMA_IMAGE_MODEL is optional and only used for IMAGE_BACKEND=ollama
# - HF_TOKEN is optional for small/turbo/smoke public models
# - IMAGE_BACKEND=qwen enables the NF4 Qwen-Image backend for text-heavy posters and signage
# - IMAGE_BACKEND=ernie enables ERNIE-Image-Turbo for prompt-enhanced multilingual text rendering
# - IMAGE_BACKEND=auto uses verified Mage-Flow when ready, then ready Z-Image-Turbo, cached FLUX, or Small SD
# - IMAGE_BACKEND=zimage forces Z-Image-Turbo with truthful Small SD fallback until ready
# - Mage-Flow is public but research-only and runs in an isolated CUDA sidecar
# Generate from the CLI
uv run dreamgen generate
# Start the API (terminal 1)
uv run uvicorn src.api.server:app --host 127.0.0.1 --port 25800
# Start the web UI (terminal 2)
cd web-ui
npm install
npm run dev
The local dev UI runs at http://localhost:3000 and talks to the API at http://localhost:25800.
Source checkouts use uv run dreamgen .... PyPI installs use dreamgen ....
For a production-style local run with the shipped ports and wiring:
cp .env.docker.example .env.docker
docker compose --env-file .env.docker up --build
That exposes:
http://localhost:7860http://localhost:25800http://localhost:25800/api/docsFor Z-Image review in Docker:
./loras/<name>/*.safetensorsZ-Image-TurboZ-ImageFor Microsoft Mage-Flow review:
microsoft/Mage-Flow@faca09c18c1c19458e7fbc3f7bce6f7a7d4d01a9Mage-Flow, or leave Auto enabled once its card reports READYlora and then select active LoRAs in the Models panelFor Ollama-backed image generation:
x/z-image-turbo or x/flux2-kleinOllama ImageFor Qwen-Image typography generation:
diffusers/qwen-image-nf4Qwen-ImageQWEN_IMAGE_MODEL=Qwen/Qwen-Image only on machines with enough memory for the full modelQWEN_IMAGE_LIGHTNING=true only if you also want the optional Lightning LoRA few-step pathFor ERNIE-Image-Turbo generation:
baidu/ERNIE-Image-TurboERNIE-ImageThese examples assume a source checkout. If you installed from PyPI, drop uv run and run dreamgen ... directly.
# Generate a single image
uv run dreamgen generate
# Generate with interactive prompt refinement
uv run dreamgen generate --interactive
# Generate multiple images in a batch
uv run dreamgen loop --batch-size 10 --interval 300
# Use mock mode (no GPU required)
uv run dreamgen generate --mock
# Force the local Z-Image backend
uv run dreamgen generate --backend zimage
# Force Qwen-Image for text-rich posters and signs
uv run dreamgen generate --backend qwen
# Force ERNIE-Image-Turbo for prompt-enhanced multilingual text rendering
uv run dreamgen generate --backend ernie
# List prompt plugins
uv run dreamgen plugins list
# Get help
uv run dreamgen --help
For detailed setup, Docker usage, and development workflow:
DreamGen includes two Cloudflare Workers for free, global image hosting:
host-image/)Purpose: Host a single showcase image from R2 storage Use Case: README badges, social media previews, landing pages
Features:
DREAM_BUCKET → continuous-image-genSetup:
cd host-image
npx wrangler deploy
Configuration (wrangler.jsonc):
{
"name": "host-image",
"main": "src/index.ts",
"r2_buckets": [
{ "binding": "DREAM_BUCKET", "bucket_name": "continuous-image-gen" }
]
}
cloudflare-gallery/)Purpose: Full gallery API with listing and image retrieval Use Case: Web UI backend, public gallery, API integrations
Features:
[[path]].js)GET /api/images → returns sorted image keysGET /api/images/{path} → streams image filesGALLERY → dreamgen-gallerySetup:
cd cloudflare-gallery
npx wrangler pages deploy public
Configuration (wrangler.toml):
name = "dreamgen-gallery"
pages_build_output_dir = "public"
[[r2_buckets]]
binding = "GALLERY"
bucket_name = "dreamgen-gallery"
API Endpoints:
# List all images (sorted by upload date, newest first)
curl https://your-worker.pages.dev/api/images
# Get specific image
curl https://your-worker.pages.dev/api/images/2024/week_52/image.png
Key Differences:
| Feature | host-image | cloudflare-gallery |
|---|---|---|
| Type | Cloudflare Worker | Pages Function |
| Routing | Single endpoint | Dynamic catch-all |
| Images | 1 hardcoded | Full R2 listing |
| Cache | 1 day | 1 year |
| Use Case | Static showcase | Dynamic gallery API |
Built by Agentic Insights • Report Issues
Python
56.1%
TypeScript
26.7%
HTML
14.0%
Shell
1.2%
A Python application that continuously generates creative images using AI. It uses an LLM for generating creative prompts and Flux for image generation.
7
stars
146
commits
Python
primary language
Aug 17, 2026
updated
Generate unlimited AI images locally with no subscriptions, no cloud APIs, and complete privacy. Your machine dreams with you! ✨
DreamGen is an independent research and artistic hobby project for exploring what local image models "dream," how their behavior changes, and where their boundaries appear. It is not a hosted production image service. Model names and upstream projects are identified for reproducibility; their inclusion does not imply sponsorship, endorsement, or affiliation.
Beautiful, VS Code-inspired dark theme with real-time generation and organized galleries. The web interface features:
Use this path if you want to run DreamGen as an installed command and do not need to edit the source code.
uv venv --python 3.11
source .venv/bin/activate # Windows PowerShell: .venv\Scripts\Activate.ps1
uv pip install dreamgen
Verify the install without downloading image models or requiring a GPU:
dreamgen generate --mock
The plain uv pip install dreamgen command resolves from PyPI. For NVIDIA systems where you specifically want CUDA 12.4 PyTorch wheels from the PyTorch index, include the extra index during install:
uv pip install dreamgen --extra-index-url https://download.pytorch.org/whl/cu124
Use this path for development, local web UI work, or Docker review.
# Clone the repository
git clone https://github.com/Agentic-Insights/dreamgen
cd dreamgen
# Install Python dependencies
uv sync
# Configure the app
cp .env.example .env
# Edit .env for your machine:
# - OLLAMA_MODEL is the preferred local prompt model; DreamGen normalizes stale values at runtime
# - OLLAMA_IMAGE_MODEL is optional and only used for IMAGE_BACKEND=ollama
# - HF_TOKEN is optional for small/turbo/smoke public models
# - IMAGE_BACKEND=qwen enables the NF4 Qwen-Image backend for text-heavy posters and signage
# - IMAGE_BACKEND=ernie enables ERNIE-Image-Turbo for prompt-enhanced multilingual text rendering
# - IMAGE_BACKEND=auto uses verified Mage-Flow when ready, then ready Z-Image-Turbo, cached FLUX, or Small SD
# - IMAGE_BACKEND=zimage forces Z-Image-Turbo with truthful Small SD fallback until ready
# - Mage-Flow is public but research-only and runs in an isolated CUDA sidecar
# Generate from the CLI
uv run dreamgen generate
# Start the API (terminal 1)
uv run uvicorn src.api.server:app --host 127.0.0.1 --port 25800
# Start the web UI (terminal 2)
cd web-ui
npm install
npm run dev
The local dev UI runs at http://localhost:3000 and talks to the API at http://localhost:25800.
Source checkouts use uv run dreamgen .... PyPI installs use dreamgen ....
For a production-style local run with the shipped ports and wiring:
cp .env.docker.example .env.docker
docker compose --env-file .env.docker up --build
That exposes:
http://localhost:7860http://localhost:25800http://localhost:25800/api/docsFor Z-Image review in Docker:
./loras/<name>/*.safetensorsZ-Image-TurboZ-ImageFor Microsoft Mage-Flow review:
microsoft/Mage-Flow@faca09c18c1c19458e7fbc3f7bce6f7a7d4d01a9Mage-Flow, or leave Auto enabled once its card reports READYlora and then select active LoRAs in the Models panelFor Ollama-backed image generation:
x/z-image-turbo or x/flux2-kleinOllama ImageFor Qwen-Image typography generation:
diffusers/qwen-image-nf4Qwen-ImageQWEN_IMAGE_MODEL=Qwen/Qwen-Image only on machines with enough memory for the full modelQWEN_IMAGE_LIGHTNING=true only if you also want the optional Lightning LoRA few-step pathFor ERNIE-Image-Turbo generation:
baidu/ERNIE-Image-TurboERNIE-ImageThese examples assume a source checkout. If you installed from PyPI, drop uv run and run dreamgen ... directly.
# Generate a single image
uv run dreamgen generate
# Generate with interactive prompt refinement
uv run dreamgen generate --interactive
# Generate multiple images in a batch
uv run dreamgen loop --batch-size 10 --interval 300
# Use mock mode (no GPU required)
uv run dreamgen generate --mock
# Force the local Z-Image backend
uv run dreamgen generate --backend zimage
# Force Qwen-Image for text-rich posters and signs
uv run dreamgen generate --backend qwen
# Force ERNIE-Image-Turbo for prompt-enhanced multilingual text rendering
uv run dreamgen generate --backend ernie
# List prompt plugins
uv run dreamgen plugins list
# Get help
uv run dreamgen --help
For detailed setup, Docker usage, and development workflow:
DreamGen includes two Cloudflare Workers for free, global image hosting:
host-image/)Purpose: Host a single showcase image from R2 storage Use Case: README badges, social media previews, landing pages
Features:
DREAM_BUCKET → continuous-image-genSetup:
cd host-image
npx wrangler deploy
Configuration (wrangler.jsonc):
{
"name": "host-image",
"main": "src/index.ts",
"r2_buckets": [
{ "binding": "DREAM_BUCKET", "bucket_name": "continuous-image-gen" }
]
}
cloudflare-gallery/)Purpose: Full gallery API with listing and image retrieval Use Case: Web UI backend, public gallery, API integrations
Features:
[[path]].js)GET /api/images → returns sorted image keysGET /api/images/{path} → streams image filesGALLERY → dreamgen-gallerySetup:
cd cloudflare-gallery
npx wrangler pages deploy public
Configuration (wrangler.toml):
name = "dreamgen-gallery"
pages_build_output_dir = "public"
[[r2_buckets]]
binding = "GALLERY"
bucket_name = "dreamgen-gallery"
API Endpoints:
# List all images (sorted by upload date, newest first)
curl https://your-worker.pages.dev/api/images
# Get specific image
curl https://your-worker.pages.dev/api/images/2024/week_52/image.png
Key Differences:
| Feature | host-image | cloudflare-gallery |
|---|---|---|
| Type | Cloudflare Worker | Pages Function |
| Routing | Single endpoint | Dynamic catch-all |
| Images | 1 hardcoded | Full R2 listing |
| Cache | 1 day | 1 year |
| Use Case | Static showcase | Dynamic gallery API |
Built by Agentic Insights • Report Issues
Python
56.1%
TypeScript
26.7%
HTML
14.0%
Shell
1.2%