Skip to content

Clusters/comfyui-llama

 
 

Repository files navigation

ComfyUI LLM

Custom ComfyUI Nodes for interacting with any OpenAI-compatible API server (/v1/... endpoints).

Integrate the power of LLMs into ComfyUI workflows easily — text generation, vision tasks, multi-turn conversations, and structured output.

Originally created by Stav Sapir as comfyui-ollama. This fork migrates to OpenAI-compatible API endpoints with broader server support.

Buy Me A Coffee

pic

Supported Servers

Any server that exposes an OpenAI-compatible /v1/... API:

Server Base URL Example Notes
Ollama (built-in /v1 proxy) http://127.0.0.1:11434 No API key needed by default
LM Studio http://127.0.0.1:1234 Local inference
vLLM http://127.0.0.1:8000 High-throughput serving
OpenAI https://api.openai.com Requires API key
LiteLLM proxy http://127.0.0.1:4000 Unified proxy for many providers

Installation

Install the custom nodes

Use ComfyUI's built-in extension manager to install the nodes. Search for comfyui-llama by Clusters.

Or

If you prefer ComfyUI-Manager, search for comfyui-llama and select the one by clusters

pic

Or

  1. git clone into the custom_nodes folder inside your ComfyUI installation or download as zip and unzip the contents to custom_nodes/comfyui-llama.
  2. pip install -r requirements.txt
  3. Start/restart ComfyUI

Nodes

LLM Generate

A node for text generation via OpenAI-compatible /v1/chat/completions. Supports system prompts, vision tasks (images), multi-turn context, and JSON structured output.

Inputs:

  • LLM Connectivity (optional)
  • LLM Options (optional)
  • images (optional) — for vision-capable models
  • context (optional) — context from another LLM Generate node
  • meta (optional) — passes connectivity and options from a previous LLM Generate node

Notes:

  • For this node to be operational, LLM Connectivity or meta must be provided.
  • If images are used in a meta chain, all images need to be passed as well to subsequent nodes.

LLM Chat

A node for conversational interaction using /v1/chat/completions. It manages full conversation history natively and supports chained sequences of chat nodes.

  • Functionality: Designed specifically for multi-turn conversations.
  • Key Features:
    • Conversation history is handled natively within the node instance.
    • Dedicated history outputs for chaining multiple chat nodes.
    • Option to reset the current conversation history on demand.

Inputs:

  • LLM Connectivity (optional)
  • LLM Options (optional)
  • images (optional) — for vision-capable models
  • meta (optional) — passes connectivity and options from another LLM Chat node
  • history (optional) — passes history ID from another LLM Chat node

Outputs:

  • result: The generated text
  • thinking: Extracted thinking/reasoning text (if model outputs <think> tags)
  • meta: Metadata to pass to the next LLM Chat node
  • history: History ID to pass to the next LLM Chat node

LLM Connectivity

Configures the connection to your API server.

Field Description
url Base URL of the OpenAI-compatible API server (e.g., http://127.0.0.1:11434)
api_key Bearer token for authentication. Leave empty if no auth is required.
model Model name/ID available on the server
keep_alive How long to keep the model loaded in memory (-1 = forever, 0 = unload immediately)

LLM Options

Advanced inference parameters mapped to OpenAI-compatible API names:

Node Option Mapped To Description
temperature temperature Creativity of output
top_p top_p Nucleus sampling threshold
top_k top_k Top-k sampling
seed seed Reproducibility seed
stop stop Stop sequences
repeat_penalty presence_penalty Repetition penalty
num_predict max_tokens Max tokens to generate

Note: Each option has an enable/disable toggle. Only enabled options are sent in the API request. The debug flag enables CLI debug output (not part of the API).

Deprecated nodes

Old V1 nodes are still available, please replace them with the above ones. Here's the documentation of V1 nodes.

Usage Example

Please see the example_workflows folder or use ComfyUI's template browser.

The custom Text Nodes in the examples can be found here: https://github.com/pythongosssss/ComfyUI-Custom-Scripts

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 91.8%
  • JavaScript 8.2%