OllamaDiffuser
OllamaDiffuser is a local AI image generation tool that provides an Ollama-like experience for Stable Diffusion and FLUX models. It can be interfaced via CLI, REST API, or MCP.
Setup & Installation
If the tool is not yet installed or needs specific hardware support, use these commands:
- Standard Installation:
pip install ollamadiffuser - Full Suite (Recommended):
pip install "ollamadiffuser[full]" - Low-VRAM/GGUF Support:
pip install "ollamadiffuser[gguf]" - MCP/Agent Integration:
pip install "ollamadiffuser[mcp]" - Apple Silicon (Metal):
CMAKE_ARGS="-DSD_METAL=ON" pip install stable-diffusion-cpp-python
Authentication: Gated models (e.g., FLUX.1-dev, SD 3.5) require a Hugging Face token.
export HF_TOKEN=your_token_here(Add to.bashrcor.zshrcfor persistence).
Core Workflows
1. Text-to-Image Generation
Generate an image from a text prompt.
- Tool/Command: Use the
generate_imageMCP tool or the REST API/api/generate. - Key Parameters:
prompt: Detailed description of the image.width/height: Default is usually 1024x1024 for SDXL/FLUX, 512x512 for SD1.5.seed: Optional for reproducibility.response_format: Set tob64_jsonfor agent-friendly base64 responses.
2. Model Management
Manage which models are downloaded and active in VRAM.
- Listing Models: Use
list_modelsto see installed versions. - Pulling Models: Use
ollamadiffuser pull <model-name>via shell. - Loading Models: Use
load_modelto switch active models in memory. - Recommendations: Use
ollamadiffuser recommendto find models that fit the available GPU VRAM.
3. Image-to-Image & Inpainting
Modify existing images.
- Img2Img: Use
/api/generate/img2img. Requiresimage(file/base64) andstrength(0.0-1.0; lower = closer to original). - Inpainting: Use
/api/generate/inpaint. Requiresimageand amaskimage.
4. Advanced Control (ControlNet)
Use structural guides (Canny, Depth, OpenPose) for precise control.
- Workflow:
- Ensure a ControlNet model is pulled (e.g.,
ollamadiffuser pull controlnet-canny-sd15). - Use
/api/generate/controlnet. - Provide a
control_imageand specify the preprocessor (e.g., "canny").
- Ensure a ControlNet model is pulled (e.g.,
Model Selection Guide
| Use Case | Recommended Model | VRAM | Note |
|---|---|---|---|
| Highest Quality | flux.1-dev | 20GB+ | Requires HF Token |
| Fast & High Quality | flux.1-schnell | 16GB+ | No token needed |
| Budget GPU (6GB) | flux.1-dev-gguf-q4ks | 6GB | GGUF Quantized |
| Ultra Low VRAM | flux.1-dev-gguf-q2k | 3GB | Entry-level |
| Classic/Fast | stable-diffusion-1.5 | 4GB+ | Great for img2img |
| Photorealistic | realvisxl-v4 | 6GB+ | SDXL based |
Technical Notes
- API Base URL:
http://localhost:8000 - Web UI:
http://localhost:8001(Start withollamadiffuser --mode ui) - HF Tokens: Gated models (FLUX.1-dev, SD 3.5) require
export HF_TOKEN=your_token. - GGUF Support: Install with
pip install "ollamadiffuser[gguf]"for memory-efficient runs.