Claude CLI (Vision+Text)
Ask Claude what's in your frames without leaving ComfyUI
- images
- response
- session_id
- stderr
- session_usage
The name makes it sound like you need an API key and a credit-card dance. The name is a lie, in the good direction. Claude CLI (Vision+Text) doesn't call any API and needs no key - it shells out to the claude CLI already on your machine (Claude Code) and uses whatever session you set up with claude login. No model loader, no VRAM pressure, no ANTHROPIC_API_KEY. If you've run Claude Code in a terminal before, the setup is two minutes.
Why put a language model inside ComfyUI at all? Because your workflow's output is a pile of video frames, and someone has to look at them. This is the node that looks. Describe a frame, check for flicker, ask whether two frames show the same subject, caption a batch for a dataset, triage generations by quality. The text answer comes back as a STRING you can route anywhere - save it, feed a text encoder, use it to steer the next generation.
How it works
Each invocation runs claude -p <prompt> --output-format json as a subprocess. Wire up images and the node downsamples your frame(s) to a 1568px long edge (safe across Haiku/Sonnet/Opus vision limits), writes a temp PNG, attaches it to the prompt, and deletes the file once the call finishes. Your response is the parsed .result from the CLI's JSON envelope - clean text, not a wall of stream-json.
The setting that actually saves you money is session reuse. Every claude -p call cold-starts an agent environment, which costs roughly 30k tokens. Across a 100-frame batch that's catastrophic. Turn on reuse_session and paste the same UUID into session_id, and later calls resume the cached context instead. The node auto-generates a UUID, and the session_id output tells you which one was actually used - copy it back into the widget to keep the session alive run after run.
The inputs that matter
model- dropdown, defaults tohaiku. That default is the right instinct for captioning and frame analysis; Haiku is fast and cheap. Reach forsonnetoropuswhen the reasoning genuinely needs the big models.user_prompt/system_prompt- multiline text rendered as headers above the fields. "Describe the image." becomes "list every visible text string, verbatim" in seconds.send_all_frames- off by default, which means only frame 0 of a batch gets sent. Flip it on for cross-frame reasoning, but keep the batch small - that's what the pack's SplitImageBatchToListOfImageBatches node exists for.reuse_session+session_id- the pair above. Leave reuse on; a fresh-session button on the node gives you a new UUID when a session bloats.timeout_seconds(default 120),on_error(defaultretry_once),is_enable- sensible defaults.retry_onceshrugs off transient CLI hiccups.- Optional
api_key- the headless escape hatch. Fill it in and the node runs--barewith that key, which disables session reuse. Leave it empty unless you need unattended runs.
Outputs: response (the parsed text), session_id (the effective UUID - this is the one to copy back), stderr (for debugging), and session_usage, a token-and-cost summary read from your local Claude session logs that nudges you when a session has outlived its usefulness.
Installing it
Two prerequisites, both outside ComfyUI: install Claude Code and run claude login once. Then either clone:
cd <ComfyUI>/custom_nodes
git clone https://github.com/RandyHaylor/comfyui-claude-cli-vision-text-node.git
or search "Claude CLI (Vision+Text)" in ComfyUI Manager. Restart ComfyUI and hard-refresh the browser tab (Ctrl+Shift+R) so the new node schema registers. There's no pip install step - the pack only uses numpy, torch, and Pillow, all already in ComfyUI. That's refreshingly boring for a "vision node" pack, and after the ComfyUI_LLMVISION incident made that whole category a scary phrase, a node with zero mystery wheels and zero API calls is worth a trusting look rather than a paranoid one.
The traps
claude: command not found- the CLI isn't on PATH. Install Claude Code and fix your PATH; the node will tell you.- "Not logged in" failures - the node detects them and raises a visible "Run
claude login" error instead of failing quietly. Run it. - A non-UUID in
session_idraises cleanly rather than silently corrupting a session - validation is strict. - The big one: skip session reuse and every frame pays the ~30k-token cold start. That's the setting that hits your wallet.
- Temp PNGs are deleted after each call - the only thing on disk is a debug log under
ComfyUI/output/claude-sessions/when a call fails - and Anthropic's context cache is server-side, so nothing piles up locally.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| system_prompt | STRING | You are an assistant aiding in completing user request. Be succinct and accurate. | — |
| user_prompt | STRING | Describe the image. | — |
| model | COMBO | haiku | 6 options: haiku, sonnet, opus, claude-haiku-4-5, claude-sonnet-4-6, claude-opus-4-7 |
| agent | COMBO | general-purpose | 6 options: general-purpose, Explore, Plan, code-reviewer, debugger, data-scientist |
| reuse_session | BOOLEAN | true | — |
| session_id | STRING | Paste a UUID here and keep reuse_session ON to avoid the ~30k-token cold-start per call. A blank id auto-generates one — copy it from the output and paste back to reuse across runs. | |
| send_all_frames | BOOLEAN | false | — |
| timeout_seconds | INT | 12010–900 | — |
| on_error | COMBO | retry_once | 3 options: empty, raise, retry_once |
| is_enable | BOOLEAN | true | — |
| imagesopt | IMAGE | — | |
| api_keyopt | STRING | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| response | STRING | — |
| session_id | STRING | — |
| stderr | STRING | — |
| session_usage | STRING | — |