Nodes/ComfyUI-IF_AI_tools/IF Chat Prompt👨‍💻
ComfyUI Node

IF Chat Prompt👨‍💻

Chat with an LLM from inside a ComfyUI graph — local or cloud, no API key required

By if-ai·Created 2 years ago·Updated 11 months ago· 701
IF Chat Prompt👨‍💻
  • images
  • tool_input
  • Question
  • Response
  • Negative
  • Tool_Output
  • Retrieved_Image
  • Mask
â—„promptâ–ş
â—„llm_providerollamaâ–ş
â—„llm_modelâ–ľâ–ş
â—„base_iplocalhostâ–ş
â—„port11434â–ş
â—„precisionbf16â–ş
â—„attentionsdpaâ–ş
â—„assistantNoneâ–ş
â—„toolNoneâ–ş
â—„temperature1.0â–ş
â—„max_tokens2048â–ş
â—„top_k40â–ş
â—„top_p0.9â–ş
â—„repeat_penalty1.2â–ş
â—„stop_stringâ–ľâ–ş
â—„seed94687328150â–ş
â—„randomfalseâ–ş
â—„history_steps10â–ş
â—„clear_historyfalseâ–ş
â—„keep_alivefalseâ–ş
â—„text_cleanuptrueâ–ş
â—„modefalseâ–ş
â—„embellish_promptâ–ľâ–ş
â—„style_promptâ–ľâ–ş
â—„neg_promptâ–ľâ–ş
â—„fill_maskfalseâ–ş
â—„output_mask_selectâ–ş
â—„taskNoneâ–ş
â—„embedding_providersentence_transformersâ–ş
â—„embedding_modelâ–ľâ–ş
◄prime_directives—►
â—„external_api_keyâ–ş
â—„top_k_search3â–ş
â—„aspect_ratio16:9â–ş
â—„enable_RAGfalseâ–ş
â—„query_typeglobalâ–ş
â—„presetDefaultâ–ş

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 - ollama is 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 list shows what you have).
  • base_ip / port - localhost:11434 for 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.

CategoryImpactFrames💥🎞️/IF_tools

Inputs (39)

NameTypeDefaultDescription
promptSTRINGThe main text input for the chat or query.
llm_providerCOMBOollamaThe provider of the language model to be used.
llm_modelCOMBOThe specific language model to be used for processing.
base_ipSTRINGlocalhostIP address of the LLM server.
portSTRING11434Port number for the LLM server connection.
imagesoptIMAGEInput image(s) for visual processing or context.
precisionoptCOMBObf16Select preccision on Transformer models.
attentionoptCOMBOsdpaSelect attention mechanism on Transformer models.
assistantoptCOMBONoneThe pre-defined assistant personality to use for responses.
tooloptCOMBONoneSelects a specific tool or agent for task execution.
temperatureoptFLOAT1.00–2Controls randomness in output generation. Higher values increase creativity but may reduce coherence.
max_tokensoptINT20480–18446744073709550000Maximum number of tokens to generate in the response.
top_koptINT400–100Limits the next token selection to the K most likely tokens.
top_poptFLOAT0.90–1Cumulative probability cutoff for token selection.
repeat_penaltyoptFLOAT1.20–10Penalizes repetition in generated text.
stop_stringoptCOMBOSpecifies a string at which text generation should stop.
seedoptINT946873281500–18446744073709550000Random seed for reproducible outputs.
randomoptBOOLEANfalseToggles between using a fixed seed or temperature-based randomness.
history_stepsoptINT100–18446744073709550000Number of previous conversation turns to consider for context.
clear_historyoptBOOLEANfalseOption to clear or retain conversation history.
keep_aliveoptBOOLEANfalseDetermines whether to keep the model loaded in memory between calls.
text_cleanupoptBOOLEANtrueApplies text cleaning to the generated output.
modeoptBOOLEANfalseSwitches between Stable Diffusion prompt generation and standard chat mode.
embellish_promptoptCOMBOAdds pre-defined embellishments to the prompt.
style_promptoptCOMBOApplies a pre-defined style to the prompt.
neg_promptoptCOMBOAdds a negative prompt to guide what should be avoided in generation.
fill_maskoptBOOLEANfalseOption to fill masks for Florence tasks.
output_mask_selectoptSTRING—
taskoptCOMBONoneSelect a Florence task.
embedding_provideroptCOMBOsentence_transformersProvider for text embedding model.
embedding_modeloptCOMBOSpecific embedding model to use.
tool_inputoptOMNIAdditional input for the selected tool.
prime_directivesoptSTRINGSystem message or prime directive for the AI assistant.
external_api_keyoptSTRINGIf 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_searchoptINT31–10Find top scored image(s) from RAG.
aspect_ratiooptCOMBO16:9Select the aspect ratio for the image.
enable_RAGoptBOOLEANfalseEnables Retrieval-Augmented Generation for enhanced context.
query_typeoptCOMBOglobalSelects the type of query strategy for RAG.
presetoptCOMBODefault7 options: Default, Detailed, Quick, Bullet, Comprehensive, High-Level, +1

Outputs (6)

NameTypeDescription
QuestionSTRINGThe original input question or prompt.
ResponseSTRINGThe generated response from the language model.
NegativeSTRINGThe negative prompt used (if applicable) for guiding image generation.
Tool_OutputOMNIOutput from the selected tool, which can be code or any other data type.
Retrieved_ImageIMAGEAn image retrieved by the RAG system, if applicable.
MaskMASKMask image generated by Florence tasks.