Nodes/CrasH Utils/Query Local LLM
ComfyUI Node

Query Local LLM

Call any OpenAI-compatible chat API from inside your workflow

By chrish-slingshot·Created 3 years ago·Updated 29 days ago· 15
Query Local LLM
    • generated_text
    prompt
    system_messageYou are an assistant designed to create more imaginative and beautiful images by expanding on the image prompt a user gives you. Respond only with your expanded prompt text. Here is the user's prompt:
    urlhttp://127.0.0.1:5000/v1/chat/completions
    context_length2048
    seed0

    Every "let an LLM expand my prompt" workflow eventually needs one plumbing node: something that fires a chat request off to a language model and hands the text back into the graph. Query Local LLM is that node - and it's a bit older than you'd guess, since its author originally built it to talk to oobabooga's text-generation-webui back when that was basically the only local LLM API game in town. The defaults still show the family resemblance.

    What it does

    You give it a prompt and a system message, it POSTs an OpenAI-style chat completion request to a URL you control, and it hands the reply back as text you can wire straight into a CLIPTextEncode. That's the whole mechanism - no local inference, no bundled model, it's purely a client for whatever LLM server you already have running. The README lists OpenAI, LM Studio, Ollama, and text-generation-webui as compatible backends, which covers most of what people actually run locally in 2026.

    Inputs and outputs that matter

    • prompt - your input text, multiline. This is what gets expanded/rewritten.
    • system_message - the persona instructions sent alongside your prompt. It ships with a genuinely usable default: "You are an assistant designed to create more imaginative and beautiful images by expanding on the image prompt a user gives you. Respond only with your expanded prompt text." Leave it as-is for prompt expansion, or replace it entirely for a different task (captioning, translation, whatever your endpoint supports).
    • url - the API endpoint. Default is http://127.0.0.1:5000/v1/chat/completions, which is oobabooga's classic default port. This is the field you'll change most often depending on what you're actually running.
    • context_length - 512 to 8192, default 2048. Should match what your local server actually loaded the model with.
    • seed - for reproducibility, though not every backend honors it the same way.

    Output is a single generated_text STRING, ready to plug into a text encoder or a save-text node.

    Installing it

    ComfyUI Manager: search "CrasH Utils" and install. Manual:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/chrish-slingshot/CrasHUtils.git
    

    Restart ComfyUI. No extra Python dependencies - it's a plain HTTP call, nothing to pip install.

    Common issues

    Connection refused / timeout. The single most common failure, and it's almost never the node's fault: your local LLM server isn't actually running, or it's bound to a host/port the node isn't pointed at. Check that whatever you're running (Ollama, LM Studio, oobabooga) is actually up before you queue the workflow.

    Default URL doesn't work with Ollama. The out-of-the-box url targets oobabooga's default port (5000). Ollama's OpenAI-compatible endpoint typically runs on a different port (11434) and needs /v1/chat/completions appended if it isn't already part of your setup - don't assume the default works everywhere, always check your backend's actual address first.

    Running ComfyUI in Docker and can't reach a host-side LLM server. 127.0.0.1 inside a container is the container itself, not your host machine. You'll need to point the url at your host's actual reachable address (or a Docker bridge alias) instead of localhost.

    Garbled or truncated output. Usually a context_length mismatch - if it's set higher than what your local server actually loaded, or your prompt plus system message plus response overflows what the model was launched with, expect truncation or outright errors. Match it to your server's real context window.

    Output doesn't change between runs even with a different seed. Not every OpenAI-compatible backend implements the seed parameter the same way (or at all) - some will happily accept it and ignore it. If determinism actually matters, check your specific backend's docs rather than assuming this node's seed field guarantees it.

    CategoryCrasH Utils/LLM

    Inputs (5)

    NameTypeDefaultDescription
    promptSTRING
    system_messageSTRINGYou are an assistant designed to create more imaginative and beautiful images by expanding on the image prompt a user gives you. Respond only with your expanded prompt text. Here is the user's prompt:
    urlSTRINGhttp://127.0.0.1:5000/v1/chat/completions
    context_lengthINT2048512–8192
    seedINT00–18446744073709550000

    Outputs (1)

    NameTypeDescription
    generated_textSTRING