Nodes/Comfyui_saveimage_imgbb/LLM Prompt Generator openrouter
ComfyUI Node

LLM Prompt Generator openrouter

A bare OpenRouter chat box that calls itself a prompt generator

By revirevy·Created 2 years ago·Updated about a year ago· 3
LLM Prompt Generator openrouter
    • STRING
    LLM_API
    user_prompt
    model_namemeta-llama/llama-3.2-11b-vision-instruct:free
    custom_model
    max_tokens250
    temperature1.0
    top_p1.0
    top_k0
    frequency_penalty0.0
    presence_penalty0.0
    repetition_penalty2.0

    The most popular way to get a good prompt is to copy-paste whatever ChatGPT or Gemini wrote into the positive-prompt box. This node is the "do that inside ComfyUI" version: it makes one OpenRouter API call and hands the text back as a string you can wire straight into your CLIP Text Encode. No VRAM cost, no local model, nothing to download - the "model" lives in OpenRouter's cloud and your GPU never touches it.

    But call it what it is. This is a thin wrapper around a single chat completion. There's no system prompt, no image input, no prompt-engineering intelligence baked in. The default model name is meta-llama/llama-3.2-11b-vision-instruct:free, which sounds clever, except there's no image socket anywhere on this node - the "vision" half of that default is dead weight. The "generate the prompt" part has to come from you, inside user_prompt. Type "a cat" and you get "a cat" back. Write it as an instruction and it actually behaves:

    Write a detailed Stable Diffusion prompt for a cyberpunk street scene at night.
    List the subject, setting, lighting, camera, and style. Comma-separated, no preamble.
    

    That instruction is the whole game. People have been asking r/comfyui for in-graph prompt generation for a while, and the pattern everyone lands on is the same: write one strong instruction, keep it saved, and let the node vary the subject on every run.

    How it works

    It POSTs to https://openrouter.ai/api/v1/chat/completions with your key as a Bearer token and your user_prompt as the only message, then passes through a full set of sampling knobs: max_tokens (default 250), temperature (1.0), top_p, top_k, frequency_penalty, presence_penalty, and repetition_penalty (default 2.0 - a strong setting; drop it toward 1 if you see looping text). The single STRING output is the model's reply, ready for a text encoder or a Save Text node.

    The inputs that matter

    LLM_API is your OpenRouter API key. model_name is a dropdown of about 30 models - mostly OpenRouter's :free tier, which is exactly why you can test this without paying a cent. And custom_model is the one that saves you later: the dropdown list is frozen in the source, while OpenRouter's free models rotate. Several entries there (shap-e, a bunch of old gemini-exp IDs) are long gone. When the list stops matching reality, type a current model ID into custom_model and it overrides the dropdown. One more: 250 max_tokens is short for a detailed prompt. Bump it to 500+ if the replies keep getting cut off.

    Where it breaks

    OpenRouter's free tier is rate-limited and flaky, so you'll see the cheerful Error: No response from API when you've been throttled. There's no retry - it's a "run the queue again" prompt, not a crash. And this runs inside your graph, which means your key is a plain string in the workflow JSON, and workflows get embedded in your output PNGs. The ecosystem has a genuine scar from a custom node exfiltrating exactly this kind of credential, so don't share workflows or images that carry your key. Use a key you're comfortable rotating.

    Install

    It ships in the same pack as the ImgBB uploader, so if you have one you have the other. Search "Comfyui_saveimage_imgbb" in ComfyUI Manager, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/revirevy/Comfyui_saveimage_imgbb
    

    then restart. Only requests really matters for this node, though the pack's requirements also drag in pillow, pyuploadcare, and an unused opencv-python.

    Bottom line

    As an in-graph LLM it's minimal, and that's not a bad thing - it's the one knob most people actually need, and the free-tier defaults mean you can test it for nothing. Just don't expect magic from the "generator" in the name. The magic is your instruction.

    Categoryadvanced/model

    Inputs (11)

    NameTypeDefaultDescription
    LLM_APISTRING
    user_promptSTRING
    model_nameCOMBOmeta-llama/llama-3.2-11b-vision-instruct:free30 options: qwen/qwen-2-7b-instruct:free, google/gemma-2-9b-it:free, mistralai/mistral-7b-instruct:free, microsoft/phi-3-mini-128k-instruct:free, microsoft/phi-3-medium-128k-instruct:free, meta-llama/llama-3-8b-instruct:free, +24
    custom_modelSTRING
    max_tokensINT2501–4096
    temperatureFLOAT1.00–2
    top_pFLOAT1.00–1
    top_kINT0
    frequency_penaltyFLOAT0.0-2–2
    presence_penaltyFLOAT0.0-2–2
    repetition_penaltyFLOAT2.00–2

    Outputs (1)

    NameTypeDescription
    STRINGSTRING