LitellmCompletionV2
The completion node that can also caption your images
- model
- image
- messages
- Model
- Messages
- Completion
- [Completions]
- Usage
LitellmCompletionV2 is the newer, fatter sibling of LiteLLMCompletion. Same DNA - one model, one prompt, one completion - but it adds two things the original lacks: a task selector and an optional image input. That makes it the multimodal workhorse of the pack, and the underlying engine for AgentNode's loop (the agent literally calls this node's handler under the hood).
If you need plain text in, text out, the original LiteLLMCompletion is fine and a little simpler. Reach for V2 when you want to hand it an image, or when you want the model's behavior pre-flavored by a task label instead of writing all that into your prompt yourself.
What the task selector does
The task input is an enum with seven options: transcription, classification, completion, translation, summarization, image_captioning, and object_detection. It's passed through into the call as a hint the model can use to shape its reply - it's not a magic switch that guarantees a certain output, more a "here's the job" instruction that steers sampling. The default is completion, which is exactly the behavior of the plain node.
The inputs
model-LITELLM_MODELfrom a provider node.prompt(multiline),max_tokens(250),temperature/top_p(0.5),frequency_penalty/presence_penalty(0),reasoning_effort- the standard dials.task- the seven-way enum above.image(optional) - a ComfyUIIMAGEtensor. If you connect one, the node converts it to a base64 JPEG and embeds it as a vision input alongside the prompt. This is how you get a vision model to look at actual pixels from your graph.messages(optional) - conversation continuity.use_cached_response(optional) - reuse a cached result.
The outputs
Model- the model config, passed through.Messages- the conversation including the reply.Completion- the main text answer.[Completions]- aLIST. On a standard run this is the per-call completions the agent-style machinery accumulates; if you're using this node directly it's a single-element list, but the output exists because agent loops feed on it.Usage- token usage.
Installing
Part of ComfyUI_LiteLLM. ComfyUI Manager, search "ComfyUI_LiteLLM", or:
cd ComfyUI/custom_nodes
git clone https://github.com/Hopping-Mad-Games/ComfyUI_LiteLLM
cd ComfyUI_LiteLLM
pip install -r requirements.txt
Restart, set a provider key, and it's under ETK/LLM/LiteLLM. No downloads beyond the pack's own dependencies.
Where people get burned
Vision doesn't come free. Only some models accept image input - the vision-capable ones (gpt-4o, claude-3.5-sonnet, Gemini variants). Feed a picture to a text-only model and you'll get an error or, worse, a confused text answer. Pick the model knowing you're about to send it pixels. Second, the task label is a hint, not a contract - a model given object_detection won't necessarily emit bounding boxes; treat the enum as prompt-flavoring and write an explicit prompt if you need structured output (pair it with AddDataModelToLLLm for that). And note the token math: an image gets base64-encoded at JPEG quality 100, which is a chunky message - vision calls cost more than text calls, and the usage output is where you'll see the difference. V2 is the one to use when the job is bigger than text-in/text-out.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| model | LITELLM_MODEL | anthropic/claude-3-haiku-20240307 | — |
| max_tokens | INT | 2501–10000000000 | — |
| temperature | FLOAT | 0.500–1 | — |
| top_p | FLOAT | 0.500–1 | — |
| frequency_penalty | FLOAT | 0.00 | — |
| presence_penalty | FLOAT | 0.00 | — |
| prompt | STRING | Hello World! | — |
| reasoning_effort | COMBO | low | 3 options: low, medium, high |
| task | COMBO | completion | 7 options: transcription, classification, completion, translation, summarization, image_captioning, +1 |
| imageopt | IMAGE | — | |
| messagesopt | LLLM_MESSAGES | — | |
| use_cached_responseopt | BOOLEAN | false | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| Model | LITELLM_MODEL | — |
| Messages | LLLM_MESSAGES | — |
| Completion | STRING | — |
| [Completions] | LIST | — |
| Usage | STRING | — |