DEV Community

Cover image for anima_pipeline – browser UI + LLM ComfyUI Anima image generation automation
RHU
RHU

Posted on

anima_pipeline – browser UI + LLM ComfyUI Anima image generation automation

I've been generating anime-style images with ComfyUI's Anima workflow for a while, and the manual overhead kept bothering me: look up Danbooru tags for each character, hand-type hair/eye/outfit details, repeat for every variation.
So I designed and shipped anima_pipeline — a single Python script that runs a local HTTP server (localhost:7860), serves a browser UI, and acts as middleware between the UI and ComfyUI. Most of the implementation was done with AI coding assistance (Claude/Codex), but the design decisions, specs, and all the testing were mine.
Project page: https://tomotto1296.github.io/anima-pipeline/index_en.html
GitHub: https://github.com/tomotto1296/anima-pipeline

How it works

Single-file server (anima_pipeline.py) using only Python's stdlib http.server + requests. No frameworks, no build step.
The browser UI communicates with the server via a small REST API (POST /generate, GET /settings, GET /gallery, etc.).
On generation, the server optionally calls an LLM (/v1/chat/completions-compatible: LM Studio, Gemini, or any OpenAI-compatible endpoint), then injects the resulting prompt into a ComfyUI workflow JSON and POSTs it to ComfyUI's queue API.
Progress is streamed back to the browser via ComfyUI's WebSocket endpoint.

Design decisions I'm happy to discuss

No framework dependency. The constraint I set from the start: stdlib + requests only. The target users run this on Windows alongside ComfyUI — minimizing install friction mattered more than anything else.
LLM as optional middleware. The LLM's only job is translating Japanese character names and scene descriptions into Danbooru-style English tags. If you skip it, you type English tags directly — faster and fully offline.
i18n without a JS library. The UI supports Japanese/English toggle. We used a lookup-table replacement pass over the DOM, with normalized matching for full-width/half-width equivalence. The tricky part was dynamic labels and making round-trip switching (JA→EN→JA) not leave stale strings behind.
Log masking for non-developer users. I share this with friends who aren't developers. The requirement: mask token, api key, authorization, and Bearer ... patterns before writing to disk. Users export a ZIP from the UI without worrying about credential leaks.
Workflow JSON injection. ComfyUI's API format is a JSON graph of nodes. Parse the workflow, locate prompt nodes and KSampler by ID, patch the values, POST the modified graph. Node IDs auto-detect on workflow selection, with manual override for edge cases.

A few things I noticed

LLM quality for Danbooru tag generation varies a lot by model. Smaller local models (3–7B) frequently hallucinate tag formats; Gemini free tier was more reliable for this narrow task.
The hardest UX problem was making the tool debuggable for non-technical users without asking them to open a terminal. The log ZIP export came from hitting that wall repeatedly.

Current state

v1.4.7 released 2026-03-20
Runs on Windows (bat launcher), cross-platform via python anima_pipeline.py
Requires ComfyUI + Anima workflow (not bundled — IP reasons)
LLM is optional; works fully offline without it

Top comments (0)