Nodes/LF Nodes/LLM <-> Character
ComfyUI Node

LLM <-> Character

Role-play with a local LLM from inside your workflow — no API key required

By lucafoscili·Created 2 years ago·Updated 2 years ago· 50
LLM <-> Character
  • image
  • ui_widget
  • request_json
  • response_json
  • answer
temperature0.7
max_tokens500
prompt
seed42
character_bio
urlhttp://localhost:5001/v1/chat/completions

Every ComfyUI power user eventually wants an LLM in the graph - to write prompts, describe an image, or riff on a character - and the friction is always the same: API keys, cloud accounts, privacy. LF_CharacterImpersonator is the LF Nodes answer, and its name is a small lie in the best way: it doesn't call any commercial API and needs no key. It talks to a local endpoint - by default http://localhost:5001/v1/chat/completions - the standard address served by Koboldcpp, which the pack's README explicitly names as its intended backend.

You give it a character_bio (a biography that shapes tone and content) and a prompt, plus temperature and max_tokens to control the reply, and it streams back a response as if the character wrote it. The author's own framing calls it a tool for "creative writing, role-playing scenarios, or generating dynamic content based on character traits" - so, LLM-driven character dialogue inside a generation workflow.

The inputs and outputs that matter

  • character_bio - the character's backstory, personality, speech patterns. The more you put here, the more the output stays in voice. This is the input that makes the node what it is.
  • prompt - what you ask the character. Single or multi-line.
  • temperature - 0.1 to ~1.9, default 0.7. Higher = more chaotic text.
  • max_tokens - cap on reply length, default 500.
  • seed - reproducibility of the generation.
  • url - defaults to the local Koboldcpp endpoint. Change it if you run something else compatible with the OpenAI chat-completions shape.
  • image (optional) - an image that "can influence the output based on visual cues." This is how you get vision: point the node at a portrait and have the character react to it. Note this needs a multimodal backend (the README's sample stack is Llama-3-Instruct-8B with the LLaVA-Llama-3-8B projector) - a text-only model will ignore or choke on it.

Outputs are answer (the reply, ready for a display or prompt node), plus request_json and response_json if you want to inspect or forward the raw payloads.

The honest setup cost

The node itself installs trivially, but the backend is the real dependency: you need Koboldcpp (or an OpenAI-compatible local server) running on port 5001, with a model loaded that suits the task. That's a one-time setup - download Koboldcpp, drop in a GGUF, start it - and from then on the node just works. If you don't already run a local LLM, budget an afternoon; if you do, this is a five-minute hookup.

Installing it

The node comes from the LF Nodes pack:

cd ComfyUI/custom_nodes
git clone https://github.com/lucafoscili/comfyui-lf

or ComfyUI Manager → LF Nodes → install → restart. No Python deps beyond the pack's own. The pack is the frozen legacy repo (migrated to lf-nodes in early 2025), so the LLM nodes here are as they were last shipped.

Where people get burned

  • Nothing running on localhost:5001 → connection refused, and the error can read like the node is broken when it's actually just that Koboldcpp isn't up. Start the server first.
  • A text-only model with an image attached will misbehave or error. Match the image input to a vision-capable stack.
  • This is the LLM node with the most character, but if you want a conversation rather than a one-shot impersonation, the pack's LLMChat node is the chat UI. Don't confuse the two.

For local, private, no-key LLM text inside ComfyUI, this is the friendliest on-ramp in the pack.

Category✨ LF Nodes/LLM

Inputs (8)

NameTypeDefaultDescription
temperatureFLOAT0.70.1–1.901Controls the randomness of the generated text. Higher values make the output more random.
max_tokensINT50020–8000Limits the length of the generated text. Adjusting this value can help control the verbosity of the output.
promptSTRINGThe initial input or question that guides the generation process. Can be a single line or multiple lines of text.
seedINT420–18446744073709550000Determines the starting point for generating random numbers. Setting a specific seed ensures reproducibility of results.
character_bioSTRINGBiographical details of the character to be impersonated. Helps in shaping the tone and content of the generated text.
urlSTRINGhttp://localhost:5001/v1/chat/completionsURL of the local endpoint where the request is sent.
imageoptIMAGEAn optional image that can be included in the generation process to influence the output based on visual cues.
ui_widgetoptKUL_CODE

Outputs (3)

NameTypeDescription
request_jsonJSON
response_jsonJSON
answerSTRING