README.md

starling #

A terminal gallery for networked image/video generation. Rust + ratatui, renders through the kitty graphics protocol (ghostty, kitty, wezterm all work). Starling is a pure HTTP client: it knows endpoints from a TOML file and nothing about the infrastructure behind them.

Workflow #

search box --> text model expands prompt --> batch fan-out across image
endpoints --> optional CV relevance gate --> gallery grid (kitty thumbnails)
--> Enter full view --> v queues a still for video --> status badge updates
--> p plays frames in-TUI | v in full view opens mpv | f opens feh

Config #

~/.config/starling/config.toml (or starling -c path):

# One [[image]] entry per sd-server (stable-diffusion.cpp) instance.
# Batches fan out round-robin, so N endpoints = N GPUs in parallel.
[[image]]
base_url = "http://10.1.0.24:8006"
label = "eris-sd"

# OpenAI-compatible text model used to expand a short query into a rich
# prompt (set [batch].use_text_expansion = false to skip).
[text]
base_url = "http://localhost:8199/v1"
model = "qwen4exp"

# Optional video worker. Expected REST shape:
#   POST {base_url}{generate_path} {prompt, image_b64, ...} -> {id}
#   GET  {base_url}{status_path}/{id} -> {status, result_url | video_b64}
# [video]
# base_url = "http://10.1.0.43:8007"
# generate_path = "/generate"
# status_path = "/jobs"
# image_to_video = true

# Optional CV gate: vision model scores each still 0-10 against the query;
# below min_score it is dropped before reaching the gallery.
# [cv]
# base_url = "http://localhost:8093/v1"
# model = "qwen-vl"
# min_score = 5

[batch]
count = 4          # stills per search
width = 832
height = 480
steps = 4
cfg = 1.0
concurrency = 2    # in-flight jobs per starling
use_text_expansion = true

[gallery]
dir = "~/.local/share/starling"
cell_w = 16        # terminal cell size in px (for kitty layout math)
cell_h = 32

Keys #

key search mode gallery mode full view
Enter generate batch view still / play video back / play video
arrows edit query move selection
v queue for video / open video open in mpv
p play frames in-TUI
f feh gallery feh gallery
o xdg-open still
/ new search
Esc quit back to search back
q quit quit

Design notes #

  • No scheduler coupling. sd-server jobs are submitted to /sdcpp/v1/img_gen and polled; anything matching the shape in the config works for video. Starling never shells out to infrastructure.
  • kitty protocol: images are uploaded once (chunked APc transfers, 3 KB frames), placed with a=p at cell rects, and deleted when they scroll out of view. ratatui owns the text cells; images float above them. The cursor is saved/restored around APc writes so the two painters do not fight.
  • In-TUI video extracts frames with ffmpeg (8 fps, 640 px) into the temp dir and cycles them under the same upload cache. For real playback, v hands off to mpv with the terminal cleanly suspended.
  • CV gate ordering: scores and stills can race; the App stashes early scores in pending_cv so filtering is order-independent.

Build #

cargo build --release

Tested against sd-server (z-image-turbo) and an eris vLLM pool behind an admission gate on 4x Radeon R9700 (gfx1201), but nothing in the binary knows that.