ComfyUI Node

API Chat

A prompt box that actually talks to a real LLM

By power88·Created 10 months ago·Updated 4 months ago· 0
API Chat
  • client_info
  • images
  • extra_parameters
  • response
system_promptYou are a helpful assistant.
user_promptHello world!
temperature1.0
top_p0.9
top_k40
max_tokens1024
unload_model_after_chattrue

API Chat is the workhorse of this pack: a general-purpose chat node that takes a system prompt, a user prompt, and optionally an image, and hands back a plain-text response. If your workflow needs an LLM to rewrite a prompt, explain an image, or fill in a variable before the sampler ever runs, this is the node you string together with the API LLM Loader.

How it works

Wire a client_info cable in from the API LLM Loader, type your prompts, and hit run. The node builds the standard message payload - system prompt, then user content with any images base64-encoded and attached - and calls whichever client the loader configured. It's one chat round-trip per execution; nothing is loaded into local memory, and the LLM runs wherever your API points (OpenAI, Mistral, a local Ollama, and so on). The response comes out as a single STRING output you can plug into anything that takes text - a prompt input, a save-text node, whatever.

The inputs that matter:

  • client_info - from the loader. Nothing happens without it.
  • system_prompt / user_prompt - the system prompt defaults to "You are a helpful assistant."; the user prompt is where the real instruction goes.
  • temperature (0–2, default 1) and top_p (default 0.95) - the usual sampling dials. Turn temperature down if you want the same answer every run.
  • top_k - only honored by Ollama, per the author. On the OpenAI clients it's ignored, so don't chase it.
  • max_tokens (default 1024) - cap on the reply length. Long generation tasks may need this raised.
  • unload_model_after_chat - Ollama only. When on (the default), it sends keep_alive: "0" so the model is unloaded from memory after the call. Handy when you're juggling VRAM between Ollama and ComfyUI; flip it off if you're doing rapid-fire calls and want the model to stay warm.
  • images (optional) - an IMAGE batch. This is what makes it a VLM chat: attach a render and ask questions about it. The source warns that if you pass more than four images, only the first four are used.
  • extra_parameters (optional) - plug in the Extra Parameters node if you want thinking/reasoning toggles.

What it's actually good for

The classic use is LLM-assisted prompting, which by now is a routine part of the workflow, not a gimmick: generate a raw idea, have the model expand it into a detailed positive prompt, and feed the response string into your CLIP text encoder. With a vision model attached you can also do captioning-lite or ask "what's wrong with this render?" and get a text answer to act on. For the more structured jobs - proper captions, bounding boxes - this pack has dedicated nodes that hardcode better prompts than you'd type here, so reach for those instead.

Install and gotchas

Same as the rest of the pack: install ComfyUI-PDiD-LLM-Nodes via ComfyUI Manager (search the pack title) or git clone https://github.com/power88/ComfyUI-PDiD-LLM-Nodes into ComfyUI/custom_nodes, restart, and make sure you're on ComfyUI 0.3.51+ - this pack is built on the new V3 node schema. No models to download; you pay per API call or point the loader at Ollama.

Where people get burned:

  • Text-only model + image input - if the model can't see, it either errors or confidently describes nothing. Use a vision model (gpt-5-class, qwen-vl, etc.).
  • Costs. Every run is an API call, and sloppy default-heavy prompts burn tokens fast. This is a "pay as you go" node, not a local one - unless you pointed the loader at Ollama, in which case it's free and this paragraph is moot.
  • Per-client differences are real. top_k and unload behavior are Ollama-only, and thinking options only apply to specific models. The README is upfront that Anthropic support is untested by the author. When something silently does nothing, check whether your client type actually supports the knob you turned.
CategoryLLM

Inputs (10)

NameTypeDefaultDescription
client_infoCLIENT_INFOThe LLM client info.
system_promptSTRINGYou are a helpful assistant.The system prompt for the LLM model.
user_promptSTRINGHello world!The system prompt for the LLM model.
temperatureFLOAT1.00–2The temperature parameter for the LLM model.
top_pFLOAT0.90–2The top_p parameter for the LLM model.
top_kINT401–99The top_k parameter for the LLM model. Only Ollama is supported.
max_tokensINT10241–1000000The max_tokens for the LLM model.
unload_model_after_chatBOOLEANtrueWhether to unload the LLM model after the chat. Only Ollama is supported.
imagesoptIMAGEThe images for the LLM model.
extra_parametersoptEXTRA_PARAMETERSThe extra parameters for the LLM model.

Outputs (1)

NameTypeDescription
responseSTRING