ComfyUI Node

Groq LLM

An LLM in your graph that never touches your GPU

By Apache0ne·Created 2 years ago·Updated 2 years ago· 0
Groq LLM
    • api_response
    • success
    • status_code
    • conversation_id
    • chat_history
    model
    preset
    system_message
    user_input
    temperature0.85
    max_tokens1024
    top_p1.00
    seed42
    max_retries2
    stop
    json_modefalse
    conversation_id

    Let's get the important part out of the way: Groq LLM runs nothing on your machine. It's one of three API-call nodes in Apache0ne's apachellmpack (the others wrap Cerebras and SambaNova), and its whole job is to send your text to Groq's hosted chat-completions endpoint and drop the reply back into the graph as a plain string. No GGUF, no Ollama server, no VRAM budget fight with your diffusion model - which is exactly why you'd reach for it.

    The LLM-in-the-graph pattern is mainstream now: you type a rough idea, a language model rewrites it into a structured prompt, and that prompt feeds your CLIP encoder. The community default leans local and abliterated, but the API path has one big card Groq specifically plays: a genuinely free tier with fast inference. If you want a prompt enhancer for zero cost and don't care that your text leaves the machine, this is one of the least painful hosted options around.

    How it works

    Under the hood it's a thin HTTP client wearing a node costume. On load it reads your API key from nodes/groq/GroqConfig.ini (the [API] key = gsk_... line), then calls Groq's models endpoint to populate the model dropdown dynamically. It builds a message list - a system message, your user_input - POSTs it to https://api.groq.com/openai/v1/chat/completions with temperature, max_tokens, top_p, and a seed, and retries on failure up to max_retries (default 2).

    Two details in the code are worth knowing. First, the preset replaces your system message, it doesn't add to it. Pick anything other than the default "Use [system_message] and [user_input]" and your typed system message is ignored in favor of the preset's instructions. Second, conversation state is real: each empty conversation_id mints a UUID and the whole chat is persisted to nodes/groq/GROQ_CONTEXT.json, so reusing an id keeps multi-turn context across runs.

    The inputs and outputs that matter

    • model - auto-filled from your key at load. If it shows no_models_available, the key didn't load; see below.
    • preset - the bundled SD-flavored presets: generate a positive prompt, build a negative prompt, list 10 ideas, or return JSON. All tuned for comma-separated prompt style.
    • user_input - your rough idea.
    • conversation_id - leave empty for a fresh conversation; reuse one to keep chatting.
    • temperature (default 0.85) and max_tokens (default 1024) are the ones you'll actually tweak.

    Outputs: api_response (STRING) is the text the model wrote - wire it into a CLIP Text Encode or a text-concat node. success (BOOLEAN) and status_code (STRING) tell you if the call worked. conversation_id and chat_history let you pass context along.

    Installing it

    ComfyUI Manager is the recommended path - search "apachellmpack" and install. Manual is two steps:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Apache0ne/apachellmpack.git
    
    # Windows portable: from the ComfyUI folder
    pip install groq
    # Matrix / venv users: activate venv\Scripts first
    

    That's the entire dependency: the groq pip package. There are no model downloads, just an API key from console.groq.com/keys pasted into nodes/groq/GroqConfig.ini. Restart ComfyUI after adding it.

    Where people get burned

    • The model dropdown says no_models_available. Models are fetched once at load time. If your key is missing, malformed, or the request failed when ComfyUI started, you get the placeholder. Fix the config, restart.
    • json_mode does nothing. It's in the inputs, but the code never sends Groq's response_format parameter - a real gap in the current source, not user error. If you need JSON output, use the "Return JSON prompt" preset or ask for JSON in the prompt itself.
    • Context quietly accumulates. Reusing a conversation_id keeps appending to GROQ_CONTEXT.json until the window fills. Blank it for a clean slate.
    • Streaming doesn't work in Comfy - the author says so in the README, so don't expect token-by-token output.

    One honest warning, because this shape of node demands it: it holds a plaintext API key and phones home by design, the exact category that's already shipped malware once in this ecosystem. Read it (it's open and small), use a Groq key with a low spend cap, and don't paste anything you'd regret into user_input - it's going to a server.

    Categoryapachellmpack

    Inputs (12)

    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.
    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.
    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.
    conversation_idSTRINGUnique identifier for the conversation. Leave empty for a new conversation.

    Outputs (5)

    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
    conversation_idSTRINGThe unique identifier for the conversation
    chat_historySTRINGThe complete chat history