ComfyUI Node

πŸ€– Leon LLM Chat API

A vision-capable LLM call inside ComfyUI β€” with GPT-4o, Claude, Gemini and more

By l3ony2kΒ·Created about a year agoΒ·Updated 2 months agoΒ· 3
πŸ€– Leon LLM Chat API
  • input_image
  • image_array
  • response
β—„modelgemini-flash-latestβ–Ί
β—„user_messageHello! How can you help me today?β–Ί
β—„api_urlhttps://api.hyprlab.io/v1/chat/completionsβ–Ί
β—„api_keyYOUR_HYPRLAB_API_KEYβ–Ί
β—„system_messageβ–Ί
β—„max_tokens128000β–Ί
β—„temperature0.7β–Ί
β—„top_p1.0β–Ί
β—„image_urlβ–Ί

Leon LLM Chat API is the pack's text brain: a chat-completion node that points at a standard OpenAI-style /v1/chat/completions endpoint (default https://api.hyprlab.io/v1/chat/completions) and returns the model's reply as a string. Wire a Model Selector into model, type a question into user_message, and the answer pops out as a response STRING you can route to a ShowText node, feed into a prompt builder, or use to drive the next step of a workflow.

What makes it more than a bare chat call is the vision support. There are three image inputs - input_image (a single IMAGE tensor), image_url (a hosted URL), and image_array (an IMAGE_ARRAY from the pack's Array Builder) - and the node assembles them into OpenAI-style content blocks so any vision-capable model you point it at can actually see what's in your graph. That's the workflow the pack's README highlights: LoadImage β†’ LLM Chat API β†’ Text Output, for captioning, "analyze this image", or critique loops on your own generations.

How it works

The node builds a messages array - optional system_message first, then a user message that may contain image content - and POSTs it with a Bearer token, reusing a shared LLM base class with the pack's 5-attempt exponential-backoff retry. The model name is a free-form string (default gemini-flash-latest), because the endpoint accepts a long list: the pack's own docs mention GPT-4o, Claude, Gemini and more.

The inputs that matter:

  • model - any model string the endpoint serves. This is where the Model Selector node plugs in.
  • user_message and system_message - the conversation. The system message sets behavior; leave it empty and the assistant has no special instructions.
  • temperature (default 0.7), top_p (default 1.0), max_tokens (default 128000) - standard sampling controls.
  • The three image inputs for vision.

Single output: response (STRING).

Installing it

Pack-wide install:

cd ComfyUI/custom_nodes
git clone https://github.com/l3ony2k/comfyui-leon-nodes
pip install -r requirements.txt

Restart ComfyUI, or install "ComfyUI Leon Nodes" via ComfyUI Manager. Light dependencies, no local models - the model runs wherever your endpoint serves it.

Where people get burned

Three things. First, the endpoint and key matter: the default is HyprLab's OpenAI-compatible endpoint, so YOUR_HYPRLAB_API_KEY is a placeholder - but because api_url is exposed, you can repoint this node at any OpenAI-compatible API (OpenAI, OpenRouter, a local vLLM, whatever). A bad key fails slowly thanks to the retry backoff, so check the console. Second, keep image inputs to one path at a time: mixing an image_url with an input_image socket can produce a payload the model refuses. Third, max_tokens defaults to 128000 which is enormous - most replies don't need it, and some endpoints cap it lower. For text-in/image-out workflows that want an LLM to judge their own output, this is the pack's hub.

CategoryLeon_API

Inputs (11)

NameTypeDefaultDescription
modelSTRINGgemini-flash-latestModel name to use for chat completion
user_messageSTRINGHello! How can you help me today?User message to send to the model
api_urlSTRINGhttps://api.hyprlab.io/v1/chat/completionsAPI URL for chat completions
api_keySTRINGYOUR_HYPRLAB_API_KEYYour HyprLab API key
system_messageoptSTRINGSystem message to set the assistant's behavior
max_tokensoptINT1280001–1048576Maximum number of tokens to generate
temperatureoptFLOAT0.70–2Sampling temperature (0.0 to 2.0)
top_poptFLOAT1.00–1Nucleus sampling parameter
input_imageoptIMAGEOptional single image input for vision-capable models
image_urloptSTRINGOptional image URL for vision-capable models
image_arrayoptIMAGE_ARRAYOptional array of images (base64 or URLs) for vision-capable models

Outputs (1)

NameTypeDescription
responseSTRINGβ€”