Nodes/SP-Nodes/SP_KoboldCpp
ComfyUI Node

SP_KoboldCpp

Talk to a local LLM from inside your ComfyUI graph

By bananasss00·Created 2 years ago·Updated 10 days ago· 20
SP_KoboldCpp
  • override_cfg
  • banned_tokens
  • images
  • text
  • payload
api_urlhttp://localhost:5001/api/v1
system_promptAnswer in English. I give you a topic and you write a short description on that topic. The descriptions should be a few sentences long. I give you a theme, and you write a short description of the photo in a surrealistic style on that theme. Descriptions should be a few sentences long
prompt
llm_mode
preset
max_length0
seed0

KoboldCpp is a local LLM server - a llama.cpp fork built for chat and roleplay models, with its own API - and this node is just the client for it. Point it at a running KoboldCpp instance and you can have a local language model write, rewrite, or riff on prompts without leaving the ComfyUI graph. The pack's own example calls it a "koboldcpp llm prompt generator," which is exactly the use case: instead of hand-typing every prompt variation, you describe a topic once and let the LLM do the elaboration.

How it works

You need KoboldCpp itself running separately - this node doesn't ship a model, it just calls whatever server is listening at api_url (default http://localhost:5001/api/v1, which is KoboldCpp's own default port). The node sends your system_prompt (the persona/instructions - the default is a decent surrealist-photo-description prompt to get you started) and prompt (your actual input) to that server and gets text back.

The tricky part is llm_mode. Different model families expect different chat templates - ChatML, Alpaca, Llama2Chat, Llama3Chat, Llama4Chat, DeepSeek25, Gemma23, GLM4, CommandR, Metharme, and more (19 choices total) - and if the template doesn't match the model you loaded in KoboldCpp, you get rambling or ignored instructions instead of a clean response. There's a KoboldCppAuto option that lets Kobold pick for you, which is the sane default until you know exactly what your model wants.

preset picks one of KoboldCpp's built-in sampler presets - simple_logical, default, simple_balanced, simple_creative, silly_tavern, coherent_creativity, godlike, liminal_drift - which trade coherence for wildness. godlike and liminal_drift are for when you want something genuinely strange out of it; simple_logical if you want it to actually follow instructions.

The inputs and outputs that matter

  • api_url, system_prompt, prompt - the three you'll actually type into.
  • llm_mode and preset - get the template right first, then pick a preset to taste.
  • max_length (0–8192) and seed for reproducibility.
  • images (optional) - feed it an image for vision tasks, but only if the model you loaded actually supports vision. The node's own tooltip is blunt about this: "make sure that the selected model supports vision, otherwise it may hallucinate the response." Good advice - a text-only model asked to "describe this image" will confidently make something up.
  • override_cfg and banned_tokens (optional) are custom types meant to be wired from other nodes in the pack for finer sampler control - you can ignore them until you need them.
  • Outputs: text (the generated string - feed straight into a CLIP Text Encode) and payload (the raw response, useful for debugging or pulling out other fields).

How to install it

Through ComfyUI Manager: search "SP-Nodes," install, restart. Or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/bananasss00/ComfyUI-SP-Nodes

Then restart ComfyUI. You'll also need KoboldCpp itself - download the binary, load a GGUF model in it, and it exposes the API this node talks to.

Common issues

If the node errors out or hangs, check that KoboldCpp is actually running and that api_url matches its real address and port - a wrong port is the single most common cause of a connection failure here, and it's an easy thing to get out of sync if you're running Kobold on a different machine or through a tunnel. Beyond that, if your output reads like gibberish or the model ignores your system prompt entirely, that's almost always a mismatched llm_mode - swap it to match the model's actual training format, or fall back to KoboldCppAuto and let Kobold sort it out.

CategorySP-Nodes

Inputs (10)

NameTypeDefaultDescription
api_urlSTRINGhttp://localhost:5001/api/v1
system_promptSTRINGAnswer in English. I give you a topic and you write a short description on that topic. The descriptions should be a few sentences long. I give you a theme, and you write a short description of the photo in a surrealistic style on that theme. Descriptions should be a few sentences long
promptSTRING
llm_modeCOMBO19 options: KoboldCppAuto, Chat, Alpaca, ChatML, CommandR, DeepSeek25, +13
presetCOMBO8 options: simple_logical, default, simple_balanced, simple_creative, silly_tavern, coherent_creativity, +2
max_lengthINT00–8192
seedINT00–18446744073709550000
override_cfgoptOVERRIDE_CFG
banned_tokensoptBANNED_TOKENS
imagesoptIMAGEProvide an image or a batch of images for vision tasks. Make sure that the selected model supports vision, otherwise it may hallucinate the response.

Outputs (2)

NameTypeDescription
textSTRING
payloadSTRING