Nodes/ComfyUI_Mira/Local AI Prompt Generator (llama.cpp)
ComfyUI Node

Local AI Prompt Generator (llama.cpp)

Expand prompts on your own GPU

By mirabarukaso·Created 2 years ago·Updated 6 days ago· 206
Local AI Prompt Generator (llama.cpp)
    • ai_prompt
    serverhttp://127.0.0.1:8080/chat/completions
    temperature0.50
    n_predict256
    prompt
    random_action_seed1024
    timeout30
    optional_system_prompt

    This node takes a short idea and asks a language model running on your own machine to blow it up into a full prompt - no OpenAI key, no cloud round-trip, no per-token bill. The one thing to get straight before anything else: it does not run the LLM for you. It's a thin HTTP client that POSTs to a llama.cpp server you're already running. If that server isn't up, the node does nothing but time out.

    That distinction is the whole story. llama.cpp is the ubiquitous local-inference runtime (it comes up constantly in community setups), and its bundled llama-server exposes an OpenAI-style /chat/completions endpoint. This node just talks to it. So the mental model is: you keep a small instruct model loaded in llama-server, and this node is the button in your ComfyUI graph that says "rewrite my three words into a proper prompt."

    How it works

    You type a seed idea into prompt, the node wraps it (optionally with your optional_system_prompt) and fires a completion request at the server URL. Whatever the model writes comes back on the single ai_prompt output, which you wire into your CLIP Text Encode like any other string. That's it - the intelligence lives in whatever model you've got loaded on the other end, and the node is deliberately dumb glue.

    Why bother instead of just typing? Two honest reasons. One, it's genuinely useful for variety - feed it "cyberpunk street" and let it invent the lighting, camera, and mood tags you'd never bother writing. Two, it's the local, private, free version of the paid prompt-expander services. On anime checkpoints there's a wrinkle worth knowing: these models want Danbooru tags, not flowery prose, so a general-purpose LLM's verbose English sentences can actually prompt worse than tight tags. Point it at a tagging-tuned model, or keep the temperature down, if you're generating for WAI/Illustrious.

    The inputs that matter

    • server - defaults to http://127.0.0.1:8080/chat/completions. This must match wherever your llama-server is listening. Get this wrong and every other setting is moot.
    • prompt - your seed idea. Short is fine; that's the point.
    • temperature - 0.1 to 1.0, default 0.5. Low keeps it faithful and terse; high makes it wander and invent. For prompt expansion, moderate.
    • n_predict - max tokens to generate (128–4096, default 256). Bump it if outputs get cut off mid-thought.
    • optional_system_prompt - where you tell the model how to write: "output only Danbooru tags, comma-separated, no sentences" earns its keep here.
    • timeout - seconds to wait (default 30). A big model on a busy GPU can blow past 30s on the first call; raise it before you blame the node.

    Output is ai_prompt, a plain string.

    Install

    ComfyUI Manager → Custom Nodes Manager → search ComfyUI_Mira → Install → restart. Or clone it: cd ComfyUI/custom_nodes && git clone https://github.com/mirabarukaso/ComfyUI_Mira.git and restart. If the pack errors on load, run pip install -r requirements.txt in its folder.

    The real dependency isn't Python - it's the server. You need llama.cpp built with llama-server running and a GGUF model loaded, reachable at the server URL. That's a separate setup outside ComfyUI.

    Common issues

    Nearly every problem here is "the server side." A connection-refused or empty output almost always means llama-server isn't running, or it's on a different port than the server field expects - check the URL character for character. Timeouts on the first generation are usually just model load; raise timeout. And if the content is bad - rambling, off-format, ignoring your style - that's the LLM you loaded, not this node. Fix it with optional_system_prompt and a lower temperature, or swap in a model actually tuned for image prompts.

    One naming note so you don't go hunting: the pack also has a remote AI prompt generator that needs an API key added to custom_nodes/ComfyUI_Mira/json/settings.json. This node is the local one - it needs no key at all, just your own server.

    CategoryMira/WAI_Character_Select

    Inputs (7)

    NameTypeDefaultDescription
    serverSTRINGhttp://127.0.0.1:8080/chat/completions
    temperatureFLOAT0.500.1–1
    n_predictINT256128–4096
    promptSTRING
    random_action_seedINT10240–18446744073709550000
    timeoutINT301–300
    optional_system_promptoptSTRING

    Outputs (1)

    NameTypeDescription
    ai_promptSTRING