Repository navigation
Releases
Releases · kabatin/klein-api
v0.1.1
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
v0.1.0
First version.
- HTTP job API per docs/api.md: health (vpipe-api / wan-api compatible), capabilities,
workflow listing with JSON Schemas, typed submit route, job status with progress over all images, queue
position,waiting_for, estimate and timings (incl.coordination_seconds), per-index PNG download,
cancel. One error envelope for every failure. - Workflow
flux2-klein: FLUX.2 [klein] text (and, once enabled, reference images) to 1–4 images; ~1 MP
generation sizes in multiples of 64, lanczos cover crop to the exact size, 8-bit RGB PNG verified per image. - Backend
drawthings:draw-things-cliheadless under a pty,--local --offline --no-download-missing --disable-preview, 4 steps / CFG 1, one process per image (seed + i), stopped on cancel/timeout, orphans
reaped after a restart. Output parsing isolated indrawthings_output.py. - Coordination with other GPU servers (
coordinate_with,settle_seconds): a job starts on an all-idle
check, and not beforesettle_secondsafter any server was last seen busy; unreachable servers count as idle (warning); peer tokens never logged, redirects not followed. - Resident engine for
standardjobs (resident, default on): a loopback-onlygRPCServerCLI-macOSkeeps the
9B loaded between jobs (~19.5 s instead of ~26 s per image); stopped when idle, when a coordinated server is
busy, before draft jobs, after failed jobs and on shutdown; leftovers reaped after a crash. - Live findings applied: references are FLUX.2 references at strength 1.0 (default
max_reference_images= 2,
--strengthnever passed), measured per-model sizes and conservative estimates, text-encoder-tensordata
checks, recorded CLI output fixtures, paths removed from engine error messages. - Job store/queue, security and process handling adapted from wan-api 0.1.0.
Install
uv tool install git+https://github.com/kabatin/klein-api@v0.1.0Setup, configuration and the LaunchAgent: see the README.