IF Chat Prompt👨‍💻
Chat with an LLM from inside a ComfyUI graph — local or cloud, no API key required
- images
- tool_input
- Question
- Response
- Negative
- Tool_Output
- Retrieved_Image
- Mask
IF Chat Prompt is the marquee node of the IF_AI_tools pack, and the one that made the pack famous. It takes a text prompt, sends it to an LLM - local or in the cloud - and hands you back the response as a plain string you can wire anywhere in the graph. Feed that into a CLIP Text Encode, a Save Text node, or a second IF Chat Prompt for multi-turn chat. It's the easiest way to get an actual language model running inside ComfyUI, because the default provider, Ollama, needs zero API keys and zero config beyond a running ollama serve.
The name is not a lie: this node really doesn't call any API and needs no key when you use a local provider. Point it at Ollama, Llama.cpp, LM Studio, Kobold or TextGen and it just talks to your localhost server.
How it works
Under the hood, every provider routes through one send_request() dispatcher in send_request.py. Pick llm_provider and it hands off to the matching module - ollama_api.py posts to http://<base_ip>:<port>/api/chat with your model name, openai_api.py hits the OpenAI-compatible endpoint, and so on. The transformers provider is the odd one: instead of talking to a server it loads the model in-process via a TransformersModelManager, which is why you get the precision (bf16 by default) and attention (sdpa) inputs on that provider.
The node is genuinely multi-modal. Feed images in and vision-capable models (like llama3.2-vision via Ollama, or the API vision models) will describe them. It also pulls in the pack's RAG machinery (enable_RAG, query_type with graph-based and ColPali/ColQwen OCR options) and Florence vision tasks for object detection and segmentation. That's a lot of surface area, but you can ignore all of it on day one.
The inputs that actually matter
You only need to touch a handful:
prompt- your message. This is the whole job.llm_provider-ollamais the sane default; the other 11 choices are there when you outgrow it.llm_model- populate it to match what's in your server (ollama listshows what you have).base_ip/port-localhost:11434for Ollama. These are also how you reach an LLM running on another machine on your LAN.
The ones you'll tune later: assistant (27 personality presets like IF_Cortana or the prompt-maker personas), prime_directives (your own system prompt), temperature, max_tokens, and history_steps/clear_history for actual back-and-forth conversation. mode flips the node between standard chat and Stable Diffusion prompt generation.
The outputs that matter are Question (echoes your input) and Response (the model's answer - wire this into a Text Encode or Save Text). Negative carries a negative prompt when a negative preset is active; Tool_Output (an OMNI type) is the payload when you enable the omost_tool; Retrieved_Image and Mask come from RAG and Florence respectively.
Installation
Install via ComfyUI Manager - search "IF_AI_tools" - or clone it:
cd ComfyUI/custom_nodes
git clone https://github.com/if-ai/ComfyUI-IF_AI_tools.git
Then install the pack's requirements, which are heavy. pip install -r requirements.txt pulls in sentence-transformers, byaldi, nano-graphrag, timm, opencv-python and more - most of that is only for the RAG side, so it's slow but only occasionally necessary. For local models, install Ollama and run ollama run llama3.2 for text or ollama run llama3.2-vision for images. For API providers, set OPENAI_API_KEY (or ANTHROPIC_API_KEY, GROQ_API_KEY, etc.) as an environment variable or in a .env file.
Gotchas
Three things bite people. First: this repo is archived. The author, Impact Frames, has moved development to comfy-deploy/comfyui-llm-toolkit, and the prompt-generation side has split out into ComfyUI-IF_AI_PromptImaGen - the README warns you to disable this repo before installing that one. Second, if a provider errors, it's almost always a model-name mismatch or a port issue, not a bug - check ollama list against the llm_model dropdown. Third, it's a genuinely large install; if you only want chat, the successor LLM toolkit is lighter. Security note, since you're about to put API keys into a custom node pack: only install node packs you trust, in the spirit of the ecosystem's own scar tissue around malicious LLM nodes.
Inputs (39)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | The main text input for the chat or query. | |
| llm_provider | COMBO | ollama | The provider of the language model to be used. |
| llm_model | COMBO | The specific language model to be used for processing. | |
| base_ip | STRING | localhost | IP address of the LLM server. |
| port | STRING | 11434 | Port number for the LLM server connection. |
| imagesopt | IMAGE | Input image(s) for visual processing or context. | |
| precisionopt | COMBO | bf16 | Select preccision on Transformer models. |
| attentionopt | COMBO | sdpa | Select attention mechanism on Transformer models. |
| assistantopt | COMBO | None | The pre-defined assistant personality to use for responses. |
| toolopt | COMBO | None | Selects a specific tool or agent for task execution. |
| temperatureopt | FLOAT | 1.00–2 | Controls randomness in output generation. Higher values increase creativity but may reduce coherence. |
| max_tokensopt | INT | 20480–18446744073709550000 | Maximum number of tokens to generate in the response. |
| top_kopt | INT | 400–100 | Limits the next token selection to the K most likely tokens. |
| top_popt | FLOAT | 0.90–1 | Cumulative probability cutoff for token selection. |
| repeat_penaltyopt | FLOAT | 1.20–10 | Penalizes repetition in generated text. |
| stop_stringopt | COMBO | Specifies a string at which text generation should stop. | |
| seedopt | INT | 946873281500–18446744073709550000 | Random seed for reproducible outputs. |
| randomopt | BOOLEAN | false | Toggles between using a fixed seed or temperature-based randomness. |
| history_stepsopt | INT | 100–18446744073709550000 | Number of previous conversation turns to consider for context. |
| clear_historyopt | BOOLEAN | false | Option to clear or retain conversation history. |
| keep_aliveopt | BOOLEAN | false | Determines whether to keep the model loaded in memory between calls. |
| text_cleanupopt | BOOLEAN | true | Applies text cleaning to the generated output. |
| modeopt | BOOLEAN | false | Switches between Stable Diffusion prompt generation and standard chat mode. |
| embellish_promptopt | COMBO | Adds pre-defined embellishments to the prompt. | |
| style_promptopt | COMBO | Applies a pre-defined style to the prompt. | |
| neg_promptopt | COMBO | Adds a negative prompt to guide what should be avoided in generation. | |
| fill_maskopt | BOOLEAN | false | Option to fill masks for Florence tasks. |
| output_mask_selectopt | STRING | — | |
| taskopt | COMBO | None | Select a Florence task. |
| embedding_provideropt | COMBO | sentence_transformers | Provider for text embedding model. |
| embedding_modelopt | COMBO | Specific embedding model to use. | |
| tool_inputopt | OMNI | Additional input for the selected tool. | |
| prime_directivesopt | STRING | System message or prime directive for the AI assistant. | |
| external_api_keyopt | STRING | If this is not empty, it will be used instead of the API key from the .env file. Make sure it is empty to use the .env file. | |
| top_k_searchopt | INT | 31–10 | Find top scored image(s) from RAG. |
| aspect_ratioopt | COMBO | 16:9 | Select the aspect ratio for the image. |
| enable_RAGopt | BOOLEAN | false | Enables Retrieval-Augmented Generation for enhanced context. |
| query_typeopt | COMBO | global | Selects the type of query strategy for RAG. |
| presetopt | COMBO | Default | 7 options: Default, Detailed, Quick, Bullet, Comprehensive, High-Level, +1 |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| Question | STRING | The original input question or prompt. |
| Response | STRING | The generated response from the language model. |
| Negative | STRING | The negative prompt used (if applicable) for guiding image generation. |
| Tool_Output | OMNI | Output from the selected tool, which can be code or any other data type. |
| Retrieved_Image | IMAGE | An image retrieved by the RAG system, if applicable. |
| Mask | MASK | Mask image generated by Florence tasks. |