Extensions/Comfyui_LLM-
ComfyUI Extension

Comfyui_LLM-

A custom ComfyUI node that generates ready-to-use image prompts with cloud or local multimodal language models.

By abzaloff·Created 2 months ago·Updated 22 days ago· 2
abzaloff/Comfyui_LLM-
Nodes
On cloudLocal install
Stars2
Updated22 days ago
Readme

ComfyUI LLM++

A custom ComfyUI node that generates ready-to-use image prompts with cloud or local multimodal language models.

The node accepts text and an optional image, sends them to the selected model, and returns the generated prompt as a STRING. The output can be connected to CLIP Text Encode, prompt processors, translation nodes, or any other node that accepts text.

Supported Models

  • Mistral: mistral-large-2512
  • Gemini: gemini-3.6-flash, gemini-3.5-flash, gemini-3.5-flash-lite, gemini-3.1-flash-lite, gemini-2.5-pro, gemini-2.5-flash, and gemini-2.5-flash-lite
  • Groq: qwen/qwen3.6-27b
  • Local LM Studio models through its OpenAI-compatible API

Image support in LM Studio depends on the selected model. A text-only model may reject requests containing images.

Installation

Place the project directory inside:

ComfyUI/custom_nodes/Comfyui_LLM++

Restart ComfyUI completely and refresh the browser page.

Required Python packages:

  • requests
  • Pillow
  • numpy

These packages are usually already available in ComfyUI. If they are missing, install requirements.txt using the same Python or UV environment that runs ComfyUI.

API Settings

Open:

Settings -> LLM++ -> API and image settings

Mistral

  1. Create an API key in your Mistral account.
  2. Enter it in Mistral API key.
  3. Select mistral: mistral-large-2512 in the node.

Gemini

The same Gemini API key is used for all listed Gemini models.

  1. Create a Gemini API key in Google AI Studio.
  2. Enter it in Gemini API key.
  3. Select a model with the gemini: prefix.

Groq

  1. Create an API key in GroqCloud.
  2. Enter it in Groq API key.
  3. Select groq: qwen/qwen3.6-27b.

Groq requests use non-thinking mode and support up to three images per request.

LM Studio

  1. Start LM Studio.
  2. Load a model.
  3. Enable the Local Server.
  4. Check the server address. The default value is:
http://127.0.0.1:1234/v1
  1. Enter the address in LM Studio API base.
  2. Set LM Studio API key only if the server requires authentication.
  3. Click Refresh LM Studio models on the node.
  4. Select a model with the lmstudio: prefix.

Refresh the model list after starting LM Studio, changing its server address, or loading another model.

Image Settings

The LLM++ settings section includes:

  • Image maximum side (px) — maximum length of the image's longest side. Default: 768.
  • Image maximum JPEG size (KB) — target maximum JPEG size. Default: 400.

Before an image is sent to an API, it is automatically:

  1. converted to RGB;
  2. resized while preserving its aspect ratio;
  3. compressed as JPEG;
  4. encoded for the API request.

The node supports ComfyUI image batches containing up to 30 images.

Using the Node

Add:

LLM++ -> LLM++ Prompt

A basic workflow can be connected as:

Load Image -> LLM++ Prompt -> CLIP Text Encode

The image input is optional. The node can also improve or expand a text prompt without an image.

Prompt Presets

The LLM++ Prompt node includes a Preset dropdown above the prompt field. Selecting a preset copies its text into the normal prompt input, so workflows save the exact instruction text and do not depend on the preset file later.

Use Edit presets on the node to manage reusable instructions:

  • New clears the editor so a new preset can be created.
  • Save updates the current preset or creates a new one when the name is new.
  • Duplicate copies the current preset under a new editable name.
  • Delete removes the selected preset after confirmation.

Presets are loaded lazily by the browser UI. ComfyUI startup only registers the API routes; preset text is read when a preset is selected or edited.

For advanced users, presets are stored as UTF-8 .txt files in:

presets/

The folder is local user data and is ignored by git. If the folder does not exist yet, the extension creates the default presets on first use.

Inputs

prompt

The instruction sent to the model.

Examples:

Describe the image as a detailed English image generation prompt.
Rewrite this idea into a detailed cinematic image prompt.
Describe the image using comma-separated SDXL tags.

image

An optional ComfyUI IMAGE input. Image batches are supported.

model

The provider and model used for prompt generation.

temperature

Controls response variation. Lower values are usually more consistent, while higher values produce more varied results.

max_tokens

The maximum number of output tokens generated by the model.

top_p

Controls nucleus sampling.

Prompt to Improve

Optional source prompt sent to the model together with the prompt instruction. Use this when you want the model to rewrite, improve, adapt, or expand an existing prompt.

auto_unload_lmstudio

Unloads the selected LM Studio model after receiving the response.

Every run

Controls when the node sends a new API request.

Enabled

Generates a new prompt every time the workflow is queued or run.

This is the default. Use it when you want a different prompt variation on every workflow execution.

Disabled

Generates the prompt once and lets ComfyUI cache the result. A new API request is sent only when an input of the LLM++ Prompt node changes, including:

  • prompt text;
  • prompt to improve;
  • input image;
  • selected model;
  • temperature, max_tokens, or top_p;
  • other node parameters.

Changing a seed or a parameter in a downstream image-generation node does not regenerate the prompt. This makes it possible to generate multiple images from the same prompt without repeating API requests.

Disabling Every run also preserves the most recently generated prompt, as long as the other inputs of the node have not changed. If no prompt has been generated for those inputs yet, the node sends one API request and then caches the result.

Output

  • prompt — the generated prompt as a ComfyUI STRING.

Connect it to any node that accepts text.

Example Workflow

  1. Configure an API key or start LM Studio.
  2. Add the LLM++ Prompt node.
  3. Optionally connect an image.
  4. Enter an instruction in prompt.
  5. Select a model.
  6. Configure temperature, max_tokens, and top_p.
  7. Leave Every run enabled for a new prompt on each execution, or disable it to reuse the generated prompt until an input changes.
  8. Connect the prompt output to the required text input.
  9. Queue the workflow.

Local Configuration

Settings are stored locally in:

llm_prompt_config.json

This file is excluded by .gitignore because it may contain API keys. Do not commit, publish, or share it.

Troubleshooting

API key is not set

Open Settings -> LLM++ and configure the API key for the selected provider.

LM Studio models are not displayed

Check that:

  • LM Studio is running;
  • the Local Server is enabled;
  • LM Studio API base contains the correct address;
  • Refresh LM Studio models was clicked after starting the server.

An LM Studio model does not accept images

The selected model is probably text-only. Use a multimodal vision model or disconnect the image input.

The prompt is regenerated on every workflow run

Disable Every run and make sure the inputs of the LLM++ Prompt node remain unchanged.

A new prompt is required on every workflow run

Enable Every run.