Nodes/ComfyUI-mnemic-nodes/βœ¨πŸ’¬ Groq LLM API
ComfyUI Node

βœ¨πŸ’¬ Groq LLM API

A free LLM sitting in your graph, rewriting your prompts

By MNeMoNiCuZΒ·Created 3 years agoΒ·Updated a day agoΒ· 105
βœ¨πŸ’¬ Groq LLM API
    • api_response
    • success
    • status_code
    β—„modelβ–Ύβ–Ί
    β—„presetβ–Ύβ–Ί
    β—„system_messageβ–Ί
    β—„user_inputβ–Ί
    β—„temperature0.85β–Ί
    β—„max_tokens1024β–Ί
    β—„top_p1.00β–Ί
    β—„seed42β–Ί
    β—„max_retries2β–Ί
    β—„stopβ–Ί
    β—„json_modefalseβ–Ί

    βœ¨πŸ’¬ Groq LLM API sends a prompt to Groq's hosted language models and drops the reply back into your graph as a string. You could alt-tab to a chat window and copy-paste - everyone has - but the moment you want it in the pipeline (rewrite this rough idea into a prompt, then encode and sample in one queue, with wildcards feeding the rough idea) a node earns its place. This is the prompt-enhancer pattern, and it's the most common non-diffusion job in a modern workflow.

    Setup is one file. Copy .env.example to .env in the pack root and paste your key from console.groq.com/keys:

    cd ComfyUI/custom_nodes/ComfyUI-mnemic-nodes
    cp .env.example .env
    # edit .env -> GROQ_API_KEY=gsk_...
    

    The node loads it with python-dotenv and raises a clear error if the key is missing or still the placeholder. Groq's free tier is genuinely usable - that's the whole reason these nodes exist.

    The preset system is the real interface

    This is what makes the node nicer than a raw API wrapper. preset is a dropdown of canned instruction sets, and the important one is "Use [system_message] and [user_input]" - that gives you both fields as free text, system message for standing instructions, user input for the specific ask, and the system message can refer to the user input. Tick that preset and you're driving the model directly.

    The other presets are pre-written jobs: Generate a prompt about [user_input], Create a negative prompt for [user_input], List 10 ideas about [user_input], and Return a JSON prompt about [user_input]. With the prompt-generating one, leaving user_input empty gets you a random Stable-Diffusion-flavoured prompt; giving it a short sentence gets you a prompt about that.

    You can add your own. Defaults live in nodes/groq/DefaultPrompts.json, but the author's advice is to copy them into nodes/groq/UserPrompts.json and edit there, so a pack update doesn't eat your presets.

    Inputs that matter

    model is a dropdown of Groq's hosted LLMs, and it's a hardcoded list - the README says it "needs to be manually updated when they add additional models". It also doesn't track what Groq retires, and providers retire models routinely. So if a model errors out with something about it being decommissioned, the dropdown is the problem: check the current list at console.groq.com/docs/models and either pick a live one or edit the list in nodes/groq_api_llm.py.

    Then temperature (default 0.85 - high; drop it toward 0.2-0.4 when you want the same prompt every time), max_tokens, top_p, seed, max_retries, and two that behave differently:

    • stop - a sequence that ends generation, not returned in the output.
    • json_mode - asks for structured output. It requires the literal word JSON to appear in your prompt, and it's incompatible with stop. Set both and you'll get an error, not a guess.

    Outputs

    api_response is the text - wire it into a CLIP Text Encode, a string cleaner, a wildcard processor. success (BOOLEAN) and status_code (STRING) exist so you can catch a failed call before an error message becomes your prompt. Without them, a rate-limit response sails straight into your conditioning and you get a brown image and a headache.

    Honest tradeoffs

    Hosted models filter. Groq's endpoints run their providers' content policies, so anything that gets refused comes back as a refusal string you can't patch - there are no weights to abliterate. If uncensored is the requirement, that's what local GGUF LLMs and node packs that unload/reload them are for. If you just want a rough idea turned into a cleaner prompt, the free API is the better deal by a mile.

    Your text leaves the machine. Same as any API node, with a credential in a .env file that now lives inside your ComfyUI install. Keep it out of screenshots and out of shared workflow files.

    Don't reach for a reasoning model for this job. The work is short, format-following rewriting, and a model that thinks out loud is more likely to leak its scratch-work - "Here is your enhanced prompt:" and all - into tokens that go straight into your conditioning.

    Install

    ComfyUI Manager β†’ ComfyUI-mnemic-nodes, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/MNeMoNiCuZ/ComfyUI-mnemic-nodes
    

    The groq and python-dotenv packages come with the pack's requirements. Nothing else to download - the model runs on their hardware, which is exactly the point.

    Category⚑ MNeMiC Nodes

    Inputs (11)

    NameTypeDefaultDescription
    modelCOMBOSelect the Large Language Model (LLM) to use.
    presetCOMBOSelect a preset or custom prompt for guiding the LLM.
    system_messageSTRINGOptional system message to guide the LLM's behavior.
    user_inputSTRINGUser input or prompt to generate a response from the LLM.
    temperatureFLOAT0.850.1–2Controls randomness in responses. A higher temperature makes the model take more risks, leading to more creative or varied answers. A lower temperature (closer to 0.1) makes the model more focused and predictable.
    max_tokensINT10241–131072Maximum number of tokens to generate in the response.
    top_pFLOAT1.000.1–1Limits the pool of words the model can choose from based on their combined probability. Set it closer to 1 to allow more variety in output. Lowering this (e.g., 0.9) will restrict the output to the most likely words, making responses more focused.
    seedINT420–4294967295Seed for random number generation, ensuring reproducibility.
    max_retriesINT21–10Maximum number of retries in case of request failure.
    stopSTRINGStop generation when the specified sequence is encountered.
    json_modeBOOLEANfalseEnable JSON mode for structured output. IMPORTANT: Requires you to use the word 'JSON' in the prompt.

    Outputs (3)

    NameTypeDescription
    api_responseSTRINGThe API response. This is the text generated by the model
    successBOOLEANWhether the request was successful
    status_codeSTRINGThe status code of the request