Stable Diffusion 3 — Local Image Generation on Your Fleet
Run Stable Diffusion 3 Medium and Stable Diffusion 3.5 Large (SD3.5) on your own Apple Silicon hardware. DiffusionKit provides MLX-native Stable Diffusion inference — no CUDA, no cloud, no per-image costs. The fleet router picks the best device for every Stable Diffusion generation request.
Stable Diffusion Supported Models
| Stable Diffusion Model | Backend | Speed (M3 Ultra) | Peak RAM | Quality |
|---|
| SD3 Medium | DiffusionKit | ~9s (512px) | 3.5GB | Good — fast Stable Diffusion iterations |
| SD3.5 Large |
DiffusionKit | ~67s (512px) | 11.6GB | Highest — Stable Diffusion with T5 encoder |
|
z-image-turbo | mflux | ~7s (512px) | 4GB | Good — fastest option |
|
flux-dev | mflux | ~30s (1024px) | 6GB | High — detailed output |
|
x/z-image-turbo | Ollama native | ~19s (1024px) | 12GB | Good — experimental |
Stable Diffusion Setup
CODEBLOCK0
Install DiffusionKit for Stable Diffusion models
CODEBLOCK1
macOS 26 users: Apply a one-time patch for Stable Diffusion compatibility:
CODEBLOCK2
First Stable Diffusion run downloads model weights from HuggingFace (~2-8GB depending on SD3 model). No models are downloaded during installation — all Stable Diffusion pulls are user-initiated.
Install mflux for Flux models (optional, recommended alongside Stable Diffusion)
CODEBLOCK3
The router prefers mflux over Ollama native for shared models to avoid evicting LLMs from memory during Stable Diffusion workloads.
Generate Stable Diffusion Images
Stable Diffusion 3 Medium (fast SD3 generation)
CODEBLOCK4
Stable Diffusion 3.5 Large (highest quality SD3)
CODEBLOCK5
Stable Diffusion Python Integration
CODEBLOCK6
Stable Diffusion Parameters
| SD3 Parameter | Default | Description |
|---|
| INLINECODE0 | (required) | INLINECODE1 , sd3.5-large, z-image-turbo, flux-dev, INLINECODE5 |
| INLINECODE6 |
(required) | Stable Diffusion text description of the image |
|
width |
1024 | Stable Diffusion image width in pixels |
|
height |
1024 | Stable Diffusion image height in pixels |
|
steps |
4 | Stable Diffusion inference steps (20-30 recommended for SD3) |
|
guidance | (model default) | Stable Diffusion guidance scale |
|
seed | (random) | Seed for reproducible Stable Diffusion output |
|
negative_prompt |
"" | What to avoid in Stable Diffusion generation |
Monitor Stable Diffusion Generation
CODEBLOCK7
Web dashboard at http://localhost:11435/dashboard — Stable Diffusion queues show with [IMAGE] badge alongside LLM queues.
Also Available on This Fleet
LLM inference alongside Stable Diffusion
Llama 3.3, Qwen 3.5, DeepSeek-V3, DeepSeek-R1 — any Ollama model through the same router that handles Stable Diffusion.
Speech-to-text
CODEBLOCK8
Embeddings
CODEBLOCK9
Full Stable Diffusion Documentation
Contribute
Ollama Herd is open source (MIT). We welcome contributions from both humans and AI agents:
- - GitHub — star the repo, open issues, submit PRs
- 444 tests, fully async Python, Pydantic v2 models
- INLINECODE19 provides full context for AI agents
Stable Diffusion Guardrails
- - No automatic downloads — Stable Diffusion model weights are downloaded on first use, not during installation. All SD3 pulls require user confirmation.
- Stable Diffusion model deletion requires explicit user confirmation.
- Never delete or modify files in
~/.fleet-manager/ (contains Stable Diffusion routing data). - All Stable Diffusion requests stay local — no data leaves your network.
Stable Diffusion 3 — 在你的设备集群上本地生成图像
在你的 Apple Silicon 硬件上运行 Stable Diffusion 3 Medium 和 Stable Diffusion 3.5 Large (SD3.5)。DiffusionKit 提供 MLX 原生 Stable Diffusion 推理——无需 CUDA、无需云端、无单张图像成本。集群路由器会为每个 Stable Diffusion 生成请求选择最佳设备。
Stable Diffusion 支持的模型
| Stable Diffusion 模型 | 后端 | 速度 (M3 Ultra) | 峰值内存 | 质量 |
|---|
| SD3 Medium | DiffusionKit | ~9秒 (512px) | 3.5GB | 良好 — 快速 Stable Diffusion 迭代 |
| SD3.5 Large |
DiffusionKit | ~67秒 (512px) | 11.6GB | 最高 — 带 T5 编码器的 Stable Diffusion |
|
z-image-turbo | mflux | ~7秒 (512px) | 4GB | 良好 — 最快选项 |
|
flux-dev | mflux | ~30秒 (1024px) | 6GB | 高 — 细节输出 |
|
x/z-image-turbo | Ollama 原生 | ~19秒 (1024px) | 12GB | 良好 — 实验性 |
Stable Diffusion 设置
bash
pip install ollama-herd # 来自 PyPI 的 Stable Diffusion 集群路由器
herd # 启动 Stable Diffusion 路由器(端口 11435)
herd-node # 在每个设备上运行 — 查找用于 Stable Diffusion 路由的路由器
安装用于 Stable Diffusion 模型的 DiffusionKit
bash
uv tool install diffusionkit # Stable Diffusion 3 和 SD3.5 后端
macOS 26 用户: 应用一次性补丁以确保 Stable Diffusion 兼容性:
bash
./scripts/patch-diffusionkit-macos26.sh
首次运行 Stable Diffusion 时会从 HuggingFace 下载模型权重(根据 SD3 模型不同,约 2-8GB)。安装过程中不会下载任何模型——所有 Stable Diffusion 拉取操作均由用户发起。
安装用于 Flux 模型的 mflux(可选,建议与 Stable Diffusion 配合使用)
bash
uv tool install mflux
对于共享模型,路由器优先使用 mflux 而非 Ollama 原生,以避免在 Stable Diffusion 工作负载期间将 LLM 从内存中驱逐。
生成 Stable Diffusion 图像
Stable Diffusion 3 Medium(快速 SD3 生成)
bash
curl -o sd3_cityscape.png http://localhost:11435/api/generate-image \
-H Content-Type: application/json \
-d {model: sd3-medium, prompt: Stable Diffusion 渲染黄昏时分的未来城市景观, width: 1024, height: 1024, steps: 20}
Stable Diffusion 3.5 Large(最高质量 SD3)
bash
curl -o sd3_portrait.png http://localhost:11435/api/generate-image \
-H Content-Type: application/json \
-d {model: sd3.5-large, prompt: Stable Diffusion 油画肖像,戏剧性光线, width: 1024, height: 1024, steps: 30}
Stable Diffusion Python 集成
python
import httpx
def generatestablediffusion(prompt, model=sd3-medium, width=1024, height=1024):
通过集群路由器使用 Stable Diffusion SD3 生成图像。
sd3_response = httpx.post(
http://localhost:11435/api/generate-image,
json={model: model, prompt: prompt, width: width, height: height, steps: 20},
timeout=180.0,
)
sd3response.raisefor_status()
return sd3_response.content # Stable Diffusion PNG 字节数据
使用 SD3 Medium 快速迭代 Stable Diffusion
sd3
png = generatestable_diffusion(一个以 Stable Diffusion 风格绘制日落的机器人)
with open(stable
diffusionoutput.png, wb) as f:
f.write(sd3_png)
Stable Diffusion 参数
| SD3 参数 | 默认值 | 描述 |
|---|
| model | (必需) | sd3-medium、sd3.5-large、z-image-turbo、flux-dev、flux-schnell |
| prompt |
(必需) | Stable Diffusion 图像文本描述 |
| width | 1024 | Stable Diffusion 图像宽度(像素) |
| height | 1024 | Stable Diffusion 图像高度(像素) |
| steps | 4 | Stable Diffusion 推理步数(SD3 建议 20-30) |
| guidance | (模型默认) | Stable Diffusion 引导比例 |
| seed | (随机) | 用于可重现 Stable Diffusion 输出的种子 |
| negative_prompt | | Stable Diffusion 生成中要避免的内容 |
监控 Stable Diffusion 生成
bash
Stable Diffusion 生成统计(最近 24 小时)
curl -s http://localhost:11435/dashboard/api/image-stats | python3 -m json.tool
哪些节点拥有 Stable Diffusion 模型
curl -s http://localhost:11435/fleet/status | python3 -c
import sys, json
Stable Diffusion 节点检查
for n in json.load(sys.stdin).get(nodes, []):
img = n.get(image, {})
if img:
sd3
models = [m[name] for m in img.get(modelsavailable, [])]
print(f{n[\node
id\]}: {sd3models})
Web 仪表板位于 http://localhost:11435/dashboard — Stable Diffusion 队列会与 LLM 队列一起显示 [IMAGE] 标签。
该集群还提供以下功能
与 Stable Diffusion 并行的 LLM 推理
Llama 3.3、Qwen 3.5、DeepSeek-V3、DeepSeek-R1 — 通过处理 Stable Diffusion 的同一路由器使用任何 Ollama 模型。
语音转文字
bash
curl http://localhost:11435/api/transcribe -F file=@recording.wav -F model=qwen3-asr
嵌入
bash
curl http://localhost:11435/api/embed \
-d {model: nomic-embed-text, input: 在 Apple Silicon 上的 Stable Diffusion 3 图像生成}
完整 Stable Diffusion 文档
- - 图像生成指南 — 所有 3 个 Stable Diffusion 和 Flux 后端
- 代理设置指南 — 包括 Stable Diffusion 在内的所有 4 种模型类型
- API 参考 — 完整的 Stable Diffusion 端点文档
贡献
Ollama Herd 是开源项目(MIT 许可证)。我们欢迎人类和 AI 代理的贡献:
- - GitHub — 给仓库加星标、提交 issue、提交 PR
- 444 个测试,完全异步 Python,Pydantic v2 模型
- CLAUDE.md 为 AI 代理提供完整上下文
Stable Diffusion 安全护栏
- - 无自动下载 — Stable Diffusion 模型权重在首次使用时下载,而非安装过程中。所有 SD3 拉取操作都需要用户确认。
- 删除 Stable Diffusion 模型需要明确的用户确认。
- 切勿删除或修改 ~/.fleet-manager/ 中的文件(包含 Stable Diffusion 路由数据)。
- 所有 Stable Diffusion 请求保持本地化——没有数据离开你的网络。