Nodes/ComfyUi_zaknak_nodes/Vision Chat Once
ComfyUI Node

Vision Chat Once

Hand your generation to a VLM and get a caption back

By zaknak·Created 6 months ago·Updated 6 months ago· 0
Vision Chat Once
  • endpoint
  • image
  • text
  • response_json
  • finish_reason
  • usage_json
system_prompt
user_prompt
max_tokens10240
seed0
extra_body_toml
strict_finish_reasontrue
strip_think_tagsfalse
timeout_seconds60.0

This is the "what did I just generate?" node. It takes an image straight from your ComfyUI graph, sends it - along with a text prompt - to a vision-capable LLM on a local OpenAI-compatible server, and hands you back the model's answer as a string. Auto-captioning for a dataset, tagging, an LLM-as-judge critique of your own output, "describe this for a prompt": all of it becomes a node in your graph instead of a round trip to some website.

It's the sibling of Chat Once in the same pack - same outputs, same one-shot philosophy, same zero-extra-dependency approach - but with an image input bolted on and a stricter requirement: the model on your server actually has to see images. Most local LLMs don't, so this is the node where the model choice matters most.

How it works

It takes the first image of whatever IMAGE batch you feed it (yes, only the first frame - a deliberate v1 limitation, not a bug) and encodes it to a PNG data URL using only Python's standard library - struct, zlib, base64, hand-rolled PNG chunks. No PIL, no torchvision, no extra package that could go stale or, worse, be compromised. It then builds the OpenAI-compatible image_url message format and POSTs to {base_url}/chat/completions, exactly like Chat Once but with a picture in the user message.

You must still supply the endpoint from Compatible Endpoint - that's where the model name comes from, and that's where you'll pick a vision model.

The inputs and outputs that matter

  • endpoint - from Compatible Endpoint; the model on it must support images.
  • image - the IMAGE tensor; first frame only.
  • system_prompt / user_prompt - prompt it to describe, tag, or judge.
  • max_tokens (10240), seed, timeout_seconds (60) - same as Chat Once.
  • extra_body_toml - add temperature or response_format here.
  • strict_finish_reason (true) / strip_think_tags (false) - same semantics as the text node.

Outputs: text (the reply), response_json (raw response - useful when a VLM says something weird and you want to see what it actually returned), finish_reason, usage_json.

Install

Part of ComfyUi_zaknak_nodes - ComfyUI Manager, or git clone https://github.com/zaknak/ComfyUi_zaknak_nodes into ComfyUI/custom_nodes, then restart. No model downloads on the ComfyUI side; the vision model lives in your server. LM Studio, Ollama, llama.cpp server, and vLLM all expose OpenAI-compatible vision endpoints if you load a vision model in them.

Troubleshooting

  • Text-only model on the server: it'll usually error, sometimes confusingly (empty content, odd finish reasons). The fix isn't the node - load a real VLM like a Qwen-VL or Llama 3.2 Vision build in your server.
  • "image input is empty": the IMAGE tensor had zero frames. Check what's upstream.
  • Only the first image got sent: yes, that's by design - multi-image input is explicitly out of scope for v1.
  • finish_reason must be 'stop', got: 'length': truncation again; raise max_tokens or relax strict_finish_reason.
  • Struggling with output format: use extra_body_toml with a response_format for structured answers, or a Prompt Preset template with tight instructions.
Categoryzaknak/llm

Inputs (10)

NameTypeDefaultDescription
endpointCOMPATIBLE_ENDPOINT
imageIMAGE
system_promptSTRING
user_promptSTRING
max_tokensINT102400–65535
seedINT00–2147483647
extra_body_tomlSTRING
strict_finish_reasonBOOLEANtrue
strip_think_tagsBOOLEANfalse
timeout_secondsFLOAT60.00.1–300

Outputs (4)

NameTypeDescription
textSTRING
response_jsonSTRING
finish_reasonSTRING
usage_jsonSTRING