Nodes/BaiduMeux_Comfy Tools/Meux LLM API Call
ComfyUI Node

Meux LLM API Call

An LLM API call you can drop inside a workflow

By fchangjun·Created about a year ago·Updated 5 months ago· 4
Meux LLM API Call
    • response
    • full_json
    • tokens_used
    api_key
    modelQwen/Qwen2.5-72B-Instruct
    user_prompt
    temperature0.7
    max_tokens1024
    system_prompt
    api_urlhttps://api.siliconflow.cn/v1/chat/completions
    top_p0.9
    top_k50
    frequency_penalty0.0
    presence_penalty0.0

    The name is not a lie, unlike a lot of "LLM" nodes: MeuxSimpleLLMNode really does call an LLM API, and yes, you need a key. It's a single-round-trip chat-completions client rendered as a ComfyUI node - you give it a prompt, it POSTs to an OpenAI-compatible endpoint, and it hands back the text. Which means you can do prompt rewriting, captioning, style translation, or just "have the model fix my prompt" inside the graph, before the text hits a CLIP encoder, instead of juggling it in a separate script.

    How it works

    Under the hood it's a requests POST to the endpoint in api_url, with the standard Authorization: Bearer <key> header and a JSON body of {model, messages, temperature, max_tokens, top_p, top_k, frequency_penalty, presence_penalty}. Non-streaming, 120-second timeout. It builds a message list from an optional system_prompt and the required user_prompt, and parses choices[0].message.content out of the response.

    Two behaviors are worth knowing. First, the node forces a fresh API call on every execution - the IS_CHANGED hook returns the current time, so re-running the queue costs you tokens even if nothing upstream changed. That's intentional (you usually want a fresh LLM answer per run) but it means this is not a node to leave in an idle loop. Second, failures don't crash the workflow: timeouts, connection errors, non-200s and bad JSON all come back as error strings in the response output, with details in full_json, so you can inspect the failure downstream instead of losing the whole graph.

    The defaults, and the China question

    The default api_url is https://api.siliconflow.cn/v1/chat/completions and the default model is Qwen/Qwen2.5-72B-Instruct. SiliconFlow is a Chinese cloud platform serving open models, which is a fine endpoint - cheap, fast, no real barrier - but it's worth noticing that the defaults aren't OpenAI. The node works with anything OpenAI-compatible, so swap in https://api.openai.com/v1/chat/completions (or DeepSeek, Groq, a local Ollama endpoint, whatever) and change model to match. The pack was built for the Chinese ecosystem and it shows in the defaults and the placeholder text; that's not a problem, just set it to what you actually use.

    Inputs and outputs

    The essentials:

    • api_key - your key, pasted in. It lives in plaintext inside the workflow JSON, so don't share workflow files carelessly.
    • user_prompt - the actual prompt. This one is force-input, meaning you wire a text value in rather than type it on the node. Connect it from MeuxTextAreaInput (same pack) or any STRING source.
    • model, temperature, max_tokens - the usual dials; defaults of Qwen 72B, 0.7 and 1024 are sane.
    • system_prompt - optional, also force-input.

    Outputs: response (STRING - the answer), full_json (STRING - the entire raw API response, pretty-printed, great for debugging), and tokens_used (INT - from the usage block, handy for cost tracking).

    Installing it

    cd ComfyUI/custom_nodes
    git clone https://github.com/fchangjun/Baidu_Meux_ComfyTools.git
    cd Baidu_Meux_ComfyTools
    pip install -r requirements.txt
    

    Restart ComfyUI, or use ComfyUI Manager and search "Baidu Meux ComfyTools".

    Troubleshooting

    The error strings are in Chinese ("请求超时", "网络连接错误") - if you're not a Chinese speaker, full_json usually carries the underlying HTTP status and body, and the console log has the URL it tried. "网络连接错误" almost always means the endpoint is unreachable from your network (SiliconFlow can be slow or blocked outside China); try a different api_url. And if you get a valid response but the workflow re-calls it every run and your bill climbs, that's the IS_CHANGED behavior, not a bug - it's working as designed.

    CategoryLLM

    Inputs (11)

    NameTypeDefaultDescription
    api_keySTRING
    modelSTRINGQwen/Qwen2.5-72B-Instruct
    user_promptSTRING
    temperatureFLOAT0.70–2
    max_tokensINT10241–4096
    system_promptoptSTRING
    api_urloptSTRINGhttps://api.siliconflow.cn/v1/chat/completions
    top_poptFLOAT0.90–1
    top_koptINT501–100
    frequency_penaltyoptFLOAT0.00–2
    presence_penaltyoptFLOAT0.00–2

    Outputs (3)

    NameTypeDescription
    responseSTRING
    full_jsonSTRING
    tokens_usedINT