Nodes/comfyui-api-pack/Zero-Shot Classification
ComfyUI Node

Zero-Shot Classification

Ask Five Typed Questions, Get Answers Without Any Text Generation

By alchemine·Created 14 days ago·Updated 14 days ago· 0
Zero-Shot Classification
  • image
  • answers
  • summary
◄state►
◄questions{ "positive": { "type": "noul", "instructions": "Is the text positive?" } }►
◄base_urlhttp://localhost:8082►
◄api_key►
◄model►

Most LLM-in-ComfyUI nodes ask a chat model to write something and pray the output is clean. This one doesn't generate text at all. Give it some text - a caption, a customer message, an image if you want - and a JSON object of typed questions, and a local decision model answers all of them in one forward pass, returning probabilities instead of prose. No sampling, no assistant: leaking into your prompt, no regex to strip a preamble. It's the heavy half of a two-node pair; the extraction half is Zero-Shot Answer.

The mechanism, concretely

The node POSTs to /v1/systemone on a llama-server you run yourself. Default http://localhost:8082. The payload is state (your content) and questions, plus model and base64 PNGs only if you filled those in.

The server side is what people miss. /v1/systemone is a real llama.cpp endpoint, but it only works with a native decision model - one whose /v1/models entry advertises decisions as an output modality. The obvious pick is clef-flash, Cloudflare's 9B multimodal decision model post-trained from Qwen3.5-9B, which is what the pack's README points at. A clef-only server answers /v1/systemone and nothing else - no chat fallback. Start it on the right port, too - llama-server defaults to 8080, this node to 8082:

llama-server -m /path/to/clef-flash.gguf --mmproj /path/to/clef-flash-mmproj.gguf --port 8082

Three question types, three answer shapes. choice gives you the winning option, its probability and a confidence; score gives the expected level as a decimal - 1.88 on a three-level scale, not a hard integer; noul gives a single probability of true.

Writing the questions JSON

questions is one multiline string holding a JSON object keyed by whatever ids you like. Getting this right is most of using the node:

{
  "route": {
    "type": "choice",
    "instructions": "Which team should handle the message?",
    "criteria": {"billing": "Payments or invoices", "technical": "Bugs or outages"}
  },
  "urgency": {"type": "score", "instructions": "How urgent is it?", "criteria": ["Can wait", "This week", "Today"]},
  "outage": {"type": "noul", "instructions": "Is a service down?"}
}

Those criteria descriptions aren't decoration - they're all the model has to tell "technical" from "billing", so write them like you're briefing a new colleague. instructions is the question itself. state is the content, base_url the server address, api_key goes as a Bearer header only when set, model likewise (a single-model server ignores it). The optional image input takes a batch; the server places images ahead of the state, which is why clef-flash ships a vision encoder.

What comes out

Two strings. answers is the answers object dumped as indented JSON, keyed by your question ids - that goes into Zero-Shot Answer to pull out the one you care about. summary is the readable version, one line per question:

route: technical (0.96)
urgency: Today (1.88)
outage: true (0.81)

Determinism, and what the scores mean

No temperature, top_k, top_p or seed here, and that's not an omission. Nothing is sampled: same input, same answers every run - which is what makes it a usable branch condition.

The numbers aren't calibrated truth, though: probabilities are scaled by temperatures stored in the model file, and llama.cpp warns they aren't guaranteed calibrated for your data. 0.96 means "much more likely", not "right 96% of the time".

Installing it

Manager, search ComfyUI-API-Pack, install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/alchemine/comfyui-api-pack
pip install -r comfyui-api-pack/requirements.txt

The only Python dependency is python-dotenv; requests, torch, numpy and Pillow ship with ComfyUI. The heavy install is the server, which isn't a ComfyUI thing at all - llama-server plus a decision-model GGUF. Budget for that, not the node.

One honest word on reputation: the pack is new (first push October 2026), single author, no stars, and the repo's first issue tracks these nodes moving over from the author's earlier comfyui-alchemine-pack. There's essentially no community chatter about clef-flash or /v1/systemone yet, so you'd be early. The mitigation is that the node is about forty lines of requests.post in a GPL-3.0 repo - read it and you know everything it does.

Where people get burned

Connection refused, instantly. The connect timeout is one second, so a dead host fails fast rather than hanging - a feature, until you assume the node is broken. Check the port first: 8082 in the node, 8080 out of the box in llama-server.

404 on /v1/systemone. Either the server predates the endpoint or the model isn't a decision model. A normal instruct GGUF serves chat completions happily and gives you nothing here.

A batch-size error. clef evaluates state plus every question and option in one batch, so a long state with a fat questions object can blow past --ubatch-size. Trim it or raise the flag.

Images doing nothing. No --mmproj, no vision: the request succeeds and the model answers from the text alone.

Malformed questions. It's parsed before any request goes out, so a trailing comma in that box errors in ComfyUI, not on the server. Node complains with no network call in the log? That's your culprit.

CategoryApiPack/Inference

Inputs (6)

NameTypeDefaultDescription
stateSTRING—
questionsSTRING{ "positive": { "type": "noul", "instructions": "Is the text positive?" } }—
base_urlSTRINGhttp://localhost:8082—
api_keySTRING—
modelSTRING—
imageoptIMAGE—

Outputs (2)

NameTypeDescription
answersSTRING—
summarySTRING—