Repository navigation
klein-api setup [--models klein-9b,klein-4b,z-image-turbo] [--check] [--yes] [--json] [--lan] [--service] [--port N] [--prefix DIR] [--label-suffix S] [--coordinate-with NAME=URL]: the uniform setup command shared
with vpipe-api, wan-api, ace-step-api and sfx-api. Installs draw-things-cli + gRPCServerCLI-macOS v26.1011.0
from the GitHub release (SHA-256 pinned; a hand-configured CLI is never replaced), fetches models with
draw-things-cli models ensureunder a silence watchdog (resumes), checks disk first, merges the config
without removing keys (0600, atomic, token never printed), and with--servicewrites and loads a
LaunchAgent (waiting for launchd to drop the old one), waits for/v1/health(never via a proxy) and reports
the macOS "access other apps' data" dialog asneeds_humanwhen the agent is new or changed. Arguments, the
LAN token and peers are validated before anything runs; usage errors with--jsonare one JSON report.- Workflow
z-image-turbo: Z Image Turbo (Apache-2.0) text to image, 1–4 PNGs at the exact size; text encoder
and VAE from Draw Things' model definition, the model's recommended settings (8 steps, CFG 1, UniPC Trailing) passed explicitly so an offline Mac without
Draw Things' cached catalog does not fall back to generic defaults. Timing measured (33 s per
image); memory and non-square sizes not yet. /v1/healthgainsworkflows[id].{available, reason, qualities}(qualities.draft/.standardfor
flux2-klein); a submit to a workflow (orflux2-kleintier) whose
model is missing gets503 workflow_unavailable.servestarts while any model is installed;doctor
warns (instead of failing) about the others anddoctor --smokeskips them.
Install / update
uv tool install git+https://github.com/kabatin/klein-api@v0.1.1 # new install
uv tool install --reinstall git+https://github.com/kabatin/klein-api@v0.1.1 # update an existing installThe config and its token are kept. Restart the server after updating, once /v1/health shows "running": 0:
launchctl kickstart -k gui/$(id -u)/com.github.kabatin.klein-api for the LaunchAgent, or run klein-api setup --service again.
ixa 0.8.3 and later do this for you: pnpm ixa ai install upgrades an older klein-api before checking what is installed.
Full changes: v0.1.0...v0.1.1