Freya diffusion worker — the GPU-side HTTP facade for DataKnifeAI Freya. Serves OpenAI-shaped image/GIF generation, checkpoint + LoRA install jobs, and inventory for Studio sessions. This repo builds Harbor image library/freya-diffusion-worker.
Called by freya-api (FREYA_DIFFUSION_WORKER_URL). Meta compose/pins, stack docs, and the channel/compat scaffold live in freya-web (deploy/compose/, docs/stack/, channels/).
- Rust
freya-workerbinary on:8091— auth-gated/v1/*, open/health - Optional Diffusers/CUDA engine sidecar on
:8092(FREYA_ENGINE_URL) for real GPU generate - Without an engine URL, generate returns a stub PNG (CI / wiring)
- Models tree under
FREYA_MODELS_DIR(loras/,checkpoints/); weights load on demand and unload after generate unlessFREYA_ENGINE_KEEP_LOADED=1
freya-api talks to this worker over HTTP. Bearer auth when FREYA_WORKER_TOKEN is set (same secret on API).
| Method | Path | Role |
|---|---|---|
GET |
/health |
Liveness (no auth) |
GET |
/v1/stats |
Inventory + engine/VRAM hints |
GET/PUT |
/v1/base-model |
Active checkpoint / HF id |
GET |
/v1/loras, /v1/checkpoints, /v1/embeddings, /v1/vae |
Asset lists |
POST |
/v1/images/generations |
Still generate (OpenAI-ish JSON) |
POST |
/v1/videos/generations |
Local multi-frame GIF (format=gif) |
POST |
/v1/assets/install |
Sync install (operator / legacy) |
GET/POST |
/v1/assets/jobs |
Async install queue |
POST |
/v1/assets/jobs/clear |
Clear finished jobs |
GET/POST |
/v1/assets/jobs/{id} / …/cancel |
Job status / cancel |
DELETE |
/v1/assets |
Remove asset under models dir |
Compat: treat as api ^0.1 ↔ worker ^0.1 until the FOO-48 channel matrix is published from freya-web channels/. Pin via FreyaDiffusionWorker.spec.image or Compose FREYA_WORKER_IMAGE.
Sister components: freya-api, freya-web, freya-mcp, freya-operator.
cp .env.example .env # optional
cargo build --release
mkdir -p data/models/loras data/models/checkpoints
./target/release/freya-worker --port 8091 --models-dir ./data/models
# curl -sS http://127.0.0.1:8091/healthGPU image (Diffusers + CUDA — production worker hosts):
docker build -t freya-diffusion-worker:local .
./scripts/run-local-worker.sh
# or:
# docker run --rm --gpus all -p 8091:8091 \
# -e FREYA_WORKER_TOKEN=… \
# -v "$FREYA_MODELS_DIR:/models" \
# freya-diffusion-worker:localStub image (no GPU, for CI/wiring):
docker build -f Dockerfile.stub -t freya-diffusion-worker:stub .Published image name: library/freya-diffusion-worker (Harbor). Operator / freya-web Compose pin the tag; this repo does not own cluster manifests.
| Path | Purpose |
|---|---|
src/ |
Rust HTTP worker |
deploy/worker/engine/ |
Diffusers FastAPI engine (server.py) |
deploy/worker/entrypoint.sh |
Starts engine then worker |
Dockerfile |
GPU Harbor image |
Dockerfile.stub |
Distroless stub binary only |
scripts/ |
Local GPU host setup / update helpers |
Freya is a tool: you supply keys and hardware, and you are liable for prompts and outputs. Third-party terms (Civitai, Hugging Face, model licenses) still apply.
Apache License 2.0 — see LICENSE.
