LiteLLMMessage
LiteLLMMessage builds the conversation
- messages
- Message(s)
Before you can ask a model anything, you need a conversation to send it. That's what LiteLLMMessage is for: it's the "make a chat message" node in the ComfyUI_LiteLLM pack, and it's usually the first node you drop on the canvas when you're building an LLM workflow.
The pack is a bridge between ComfyUI and LiteLLM, the Python library that normalizes ~100 model providers behind one API. So the messages this node builds are provider-agnostic - the same user/assistant/system structure works whether you're calling Claude, GPT, Gemini, or a local Ollama model.
How it works
A chat message is just a dict with two keys: role and content. That's all this node produces. Give it:
- content - the actual text, a big multiline field (defaults to "Hello World!").
- role - a dropdown with three choices:
user,assistant,system.
Run it and you get one LLLM_MESSAGES object out, which is the pack's typed way of saying "a list of chat messages." That's the important bit: LiteLLMMessage doesn't call any API, doesn't need a key, costs nothing. It's pure data construction.
The trick that makes it useful is the optional messages input. Plug an existing LLLM_MESSAGES chain into it and the node appends its new message to the end of that chain instead of starting fresh. That's how you build a real conversation:
LiteLLMMessage (system, "You are a helpful editor.")
→ LiteLLMMessage (user, "Tighten this paragraph.")
→ LiteLLMMessage (assistant, "Here's my rewrite.")
→ LiteLLMMessage (user, "Now do the same for the rest.")
→ ShowMessages (inspect what you've built)
Each node hands its output to the next one's messages input. One nicety: if content is empty, the node returns the incoming messages unchanged - so you can use it as a passthrough while you sketch the workflow.
Wiring it up
The Message(s) output feeds any node in this pack that accepts LLLM_MESSAGES - the completion nodes are the usual destination, and ShowMessages/ShowLastMessage are handy for checking what you've actually built before you spend tokens on it. If you want the text out as a plain string instead, run it through MessagesToText first. And don't hand the output to a plain STRING input on another pack's node - it's a list of dicts, not text.
Installing
LiteLLMMessage ships in ComfyUI_LiteLLM, so you install the whole pack:
- ComfyUI Manager → Custom Nodes Manager → search "LiteLLM" (repo
Hopping-Mad-Games/ComfyUI_LiteLLM) → Install → Restart. - Or manually:
cd ComfyUI/custom_nodes && git clone https://github.com/Hopping-Mad-Games/ComfyUI_LiteLLM, thenpip install -r requirements.txtand restart.
Heads up: that requirements file is heavy - litellm, boto3, sentence-transformers (which drags in its own torch), plus a LightRAG fork. First install is slow. You don't need API keys for this node, but the moment you connect a completion node you will, and those go in environment variables (OPENAI_API_KEY, ANTHROPIC_API_KEY, …), never pasted into the graph - keys in widgets get embedded in the workflow JSON you share.
Where people trip
The usual mistake is chaining order - if you want system first, put that node at the start of the chain, because every node appends to the end. Also, nothing here validates your roles: you can send assistant as the last message, and the model will happily treat it as a nudge. That's sometimes exactly what you want (pre-filling the model's reply). It's a building block, not a nanny - and that's fine.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| content | STRING | Hello World! | — |
| role | COMBO | user | 3 options: user, assistant, system |
| messagesopt | LLLM_MESSAGES | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| Message(s) | LLLM_MESSAGES | — |