Nodes/ComfyUI-nkxx/💬 GRSAI LLM (纯文本对话)
ComfyUI Node

💬 GRSAI LLM (纯文本对话)

A Gemini chat node with a fixed/random mode that actually means something

By nkxx188·Created 11 months ago·Updated 6 months ago· 14
💬 GRSAI LLM (纯文本对话)
    • response_text
    • error_msg
    modelgemini-2.5-flash
    promptHello! You are a helpful assistant.
    random_mode固定
    api_key

    A plain text-chat node: you type a prompt, it calls a Gemini model over the Grsai channel, and you get the reply as a STRING. In the ComfyUI graph that's not as trivial as it sounds - a string in, string out LLM node is exactly the building block the LLM-in-the-graph pattern is made of: prompt enhancement, caption drafting, seed text for a batch CSV, any place a model writes text another node consumes.

    It's the pure-text member of the pack's LLM/VLM pair (GRSAIVLMNode is the vision one). Both sit on the Grsai channel, which resells Gemini 2.5/3.x through an OpenAI-compatible /v1/chat/completions endpoint - so if you've used an OpenAI-style chat node, this will feel familiar under the hood.

    The inputs that matter

    • model - gemini-2.5-flash (default), gemini-2.5-flash-lite, gemini-3-flash, gemini-3-pro, gemini-3.1-pro. Flash is the cheap default; pro is the quality tier.
    • prompt (multiline) - your instruction. This is a chat prompt, so "Rewrite this: …" works better than one-word asks.
    • random_mode - 固定 (fixed, default) or 随机 (random). And this one is a real mechanism, not decoration: in random mode the node appends a zero-width character to the prompt so the API's response cache can't collapse repeat calls into one identical answer. Fixed mode is for reproducible runs; random mode is for variation-hunting.
    • api_key (optional) - Grsai key fallback.

    Outputs: response_text (STRING) and error_msg (STRING) - the answer and, when something fails, the error side-by-side. Wiring both to a text display is the standard setup.

    How it works

    Readable source. It resolves the key, builds a single user message, POSTs to https://grsai.dakka.com.cn/v1/chat/completions with stream: false, and returns choices[0].message.content. Timeouts and HTTP errors land in error_msg rather than crashing the graph - useful for scripting retries. The random_mode zero-width-char trick is the same cache-busting idiom the pack uses across its async image tasks.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/jieg9341-lab/ComfyUI-nkxx
    

    restart (or ComfyUI Manager, "ComfyUI-nkxx"). Auto-installs requests, pandas, openpyxl, yt-dlp, opencv-python, aiohttp. Grsai key from nkxx.grsai.ai.

    Common issues

    • error_msg is populated: check network/credits first. The node surfaces HTTP codes and timeouts in that output rather than throwing, so an empty response_text with a filled error_msg is the diagnostic moment.
    • Repeated identical answers in "fixed" mode: that's the feature - flip to 随机 for variety.
    • It's metered per call: Gemini flash is cheap but not free; a loop that re-runs this node thousands of times is a real bill. Keep prompt enhancement passes short.
    • Security posture: this is an API-wrapper pack that sends your prompts to a reseller - a single author's channel, Wujiai-side code shipped obfuscated. Nothing sensitive belongs in the prompt you send.
    CategoryNkxx/Grsai/语言模型

    Inputs (4)

    NameTypeDefaultDescription
    modelCOMBOgemini-2.5-flash5 options: gemini-3.1-pro, gemini-3-flash, gemini-3-pro, gemini-2.5-flash, gemini-2.5-flash-lite
    promptSTRINGHello! You are a helpful assistant.
    random_modeCOMBO固定2 options: 固定, 随机
    api_keyoptSTRING

    Outputs (2)

    NameTypeDescription
    response_textSTRING
    error_msgSTRING