ComfyUI Node

Claude Chat

Put Claude in your ComfyUI graph (with a real API key and a real bill)

By lazniak·Created 2 years ago·Updated 11 months ago· 7
Claude Chat
  • image
  • response_text
  • usage_info
  • input_tokens
  • stop_reason
  • conversation_id
  • history_messages
  • cost_usd
  • model_info
api_key
modelclaude-3-5-sonnet-latest
promptHello, Claude!
system_promptYou are a helpful AI assistant in ComfyUI environment. Provide clear, accurate, and concise responses. When discussing code or technical concepts, use specific examples where helpful. If you're not sure about something, say so.
max_tokens1024
temperature0.70
new_sessionfalse
clear_historyno
summarizetrue
show_model_infofalse
buy_me_a_coffeefalse
image_promptWhat can you see in this image?
conversation_id

This node ("Claude Chat" in the menu) drops Anthropic's Claude right into your graph as a chat-and-vision node. It's not a local model and it's not free: you paste an API key, every run makes a real API call to Anthropic, and your prompt (and any image you feed it) leaves your machine. That's the entire deal, so know it going in - this is the "bring an LLM in to write a prompt or look at an image" pattern, not another sampler.

So why reach for it? In the videoclipgenerator world it slots in nicely upstream of everything else: Claude writes the lyrics, the voiceover script, or the per-shot image prompts that VibeMusicEngine and MovingTitles then consume. Feed it a generated frame through the optional image input and it'll describe what's on screen - useful when you're trying to prompt a consistent style across a video's worth of shots. The output plumbing is unusually generous: response_text, plus input_tokens, cost_usd, stop_reason, and a conversation_id you can reuse to keep chatting.

The inputs that actually matter

  • api_key - your Anthropic key. Leave it blank and it falls back to an ANTHROPIC_API_KEY environment variable; blank both and it throws.
  • model - four choices baked in: claude-3-5-sonnet-latest, claude-3-opus, claude-3-sonnet, claude-3-haiku. The tooltip's cost framing is the point: Opus is the expensive brain, Haiku is the cheap fast one.
  • prompt and system_prompt - your message and the persona/constraints it operates under. The default system prompt is "you are a helpful AI assistant in ComfyUI" which is fine to replace.
  • max_tokens (default 1024) and temperature (default 0.7) - response length and randomness. Drop temperature toward 0 when you want structured, repeatable output.
  • new_session and clear_history (no/yes/all) - control conversation state. conversation_id in the optional section lets you resume a specific thread later.
  • summarize (default on) - auto-summarizes history as you approach the context window so a long dialogue doesn't hard-fail.

The optional image input takes an IMAGE tensor, with image_prompt being the specific question ("What can you see in this image?"). Note the tooltip's fine print: vision is only supported by Claude 3 models except Haiku.

What comes out

response_text is what you actually use. usage_info and input_tokens track spend, cost_usd is the nice-to-have that tells you what that run just cost you in dollars, history_messages reports how much context got carried, and model_info is a readout when you tick show_model_info.

Installing it

It ships inside the videoclipgenerator pack. ComfyUI Manager → search "videoclipgenerator", or:

cd ComfyUI/custom_nodes
git clone https://github.com/lazniak/videoclipgenerator
cd videoclipgenerator
pip install -r requirements.txt   # or: python install.py

Restart ComfyUI. The only pack dependency this node pulls in beyond the usual is the anthropic Python package.

Gotchas

The two things that bite people: forgetting the key (paste it in the widget or set ANTHROPIC_API_KEY in your environment) and forgetting you're paying per call - wire this into a batch workflow and watch cost_usd for a while before you trust it. Also, every node in this pack has a buy_me_a_coffee checkbox, and ticking it makes the node open a browser tab to the author's Buy Me a Coffee page. It's opt-in, it just surprises people. And the standard API-node warning applies: this is custom Python holding a credential and phoning home by design, so know what you installed - the LLMVISION incident should keep you honest about which packs you trust with a key.

CategoryAI/Claude

Inputs (14)

NameTypeDefaultDescription
api_keySTRINGYour Anthropic API key. Can be set as ANTHROPIC_API_KEY environment variable.
modelCOMBOclaude-3-5-sonnet-latestSelect Claude model. Each has different capabilities and costs.
promptSTRINGHello, Claude!The message to send to Claude
system_promptSTRINGYou are a helpful AI assistant in ComfyUI environment. Provide clear, accurate, and concise responses. When discussing code or technical concepts, use specific examples where helpful. If you're not sure about something, say so.System prompt to set context and behavior for Claude
max_tokensINT10241–8192Maximum number of tokens in response
temperatureFLOAT0.700–1Controls randomness (0 = deterministic, 1 = creative)
new_sessionBOOLEANfalseStart a new conversation session
clear_historyCOMBOnoClear history options: no: Keep history yes: Clear current session all: Clear all saved conversations
summarizeBOOLEANtrueAutomatically summarize conversation history when approaching token limits
show_model_infoBOOLEANfalseDisplay detailed information about the selected model
buy_me_a_coffeeBOOLEANfalseSupport the development! ☕
imageoptIMAGEOptional image to analyze. Only supported by Claude 3 models (except Haiku).
image_promptoptSTRINGWhat can you see in this image?Specific question about the image. Used only when image is provided.
conversation_idoptSTRINGOptional conversation ID to continue specific conversation

Outputs (8)

NameTypeDescription
response_textSTRING
usage_infoSTRING
input_tokensINT
stop_reasonSTRING
conversation_idSTRING
history_messagesINT
cost_usdFLOAT
model_infoSTRING