Nodes/Music Production Toolkit/LLM settings · central (one place for every call)
ComfyUI Node

LLM settings · central (one place for every call)

Set Your Language Model Once, Not Three Times

By jplenio·Created 23 days ago·Updated 4 days ago· 64
LLM settings · central (one place for every call)
    • llm_config_json
    modelQwen_Qwen3.5-9B-Q4_K_M.gguf
    max_tokens24576
    temperature0.70
    top_p0.80
    n_gpu_layers-1
    n_ctx37376
    auto_downloadtrue
    chat_formatauto
    thinkingoff
    top_k40
    min_p0.00
    repeat_penalty1.10
    presence_penalty0.00
    frequency_penalty0.00
    seed-1
    split_modenone
    tensor_split
    main_gpu0
    tensor_parallelfalse
    backendIn ComfyUI (GGUF)
    local_providerLM Studio
    cloud_providerOpenAI
    server_url
    remote_model
    api_key_env
    credential_id
    remote_max_tokens4096
    request_timeout120
    permanent_keyfalse

    The problem this node exists to kill

    A run makes up to three LLM calls - the song request, the Cover Studio plan, the rewrite of its score - and each chat node used to carry its own copy of the same ~28 settings. Changing your provider meant editing it three times, and two copies disagreeing failed in ways that were hard to spot in the log.

    LLM settings · central holds them once and hands them out as one JSON string. Wire its single output into the llm_config_json input of every chat node and you edit the model in one place.

    Where it sits in the wider picture

    The toolkit runs its text layer inside ComfyUI - a GGUF on your own card, or LM Studio, Ollama, llama.cpp, vLLM or a cloud provider if you'd rather not spend the VRAM. That's the in-graph-GGUF side of a long-standing split with the external-Ollama-server pattern: one process instead of two, with a chat model and a song model sharing memory. And the job isn't chat - ~11.6k tokens of prompt in, four sections out - so small and obedient beats large and clever.

    How the handoff actually works

    The node derives its widget list from the chat node rather than copying it, so the two can never offer different models. It packs what you set into a tagged payload, and the receiving chat node merges it field by field: its own widget value first, then whatever the config carries on top. Anything the config omits keeps the local value, so an older graph keeps working. An unreadable payload - an empty socket, text from an older release - is ignored with a log line instead of stopping the run.

    One surprise: ComfyUI checks widgets before executing, when a linked input doesn't exist yet, so the chat node treats a connection as the decision - a stale model name in its own dropdown no longer refuses the queue. Disconnect it and it validates its own value again.

    The inputs that matter

    model - the GGUF. The dropdown lists files already in ComfyUI/models/llm plus catalog entries you don't have yet, each with a size and a 1–5 star rating; the stored value stays the plain file name, so a saved workflow keeps loading after the download. Default: Qwen_Qwen3.5-9B-Q4_K_M.gguf (6.2 GiB).

    n_ctx (37376) and max_tokens (24576) are a pair, not two knobs. The context holds prompt, answer and any thinking, so a response cap larger than n_ctx minus the prompt gets cut by the runtime, silently.

    backend picks the mode - In ComfyUI (GGUF), Local app / server, Cloud service - and fields belonging to the other modes hide themselves. Cloud adds cloud_provider, server_url, remote_model, remote_max_tokens (4096) and request_timeout (120 s). Keys arrive through the node's own Set API key button: credential_id is a session reference only, and permanent_key decides whether the key is stored on this machine, bound to that exact API address. It never enters the workflow either way.

    thinking defaults to off: reasoning is skipped where the backend supports it, and any <think> block is stripped off the answer, logged separately - the parsed sections only ever see clean text. Leave it off; a reasoner leaking scratch-work into a structured prompt wrecks the output.

    Then n_gpu_layers (-1 offloads as much as possible), split_mode / tensor_split / main_gpu for multi-GPU, chat_format (auto picks a template per model family) and auto_download.

    Output is a single STRING, llm_config_json.

    Install

    ComfyUI Manager (registry name comfyui-minimax-music-production-toolkit, searched as "Music Production Toolkit"), or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/jplenio/ComfyUI-MiniMax-Music-Production-Toolkit
    cd ComfyUI-MiniMax-Music-Production-Toolkit
    python -m pip install -r requirements.txt
    

    Use the Python environment that runs ComfyUI, then restart. The GGUF path additionally needs python -m pip install llama-cpp-python - not in requirements.txt, because no single wheel fits every CUDA, ROCm and CPU setup; the server and cloud modes need none of it. A selected GGUF fetches itself into ComfyUI/models/llm while auto_download is on.

    Where people get burned

    Changing n_ctx or n_gpu_layers reloads the model. Both are part of its cache identity, so tweaking them mid-session costs a full reload.

    Architecture support, not VRAM, is usually the blocker. The Qwen 3.5/3.8 GGUFs use Gated DeltaNet and need a recent llama-cpp-python; older builds refuse them. Llama-3.1 and Mistral-Nemo are plain llama and load anywhere; Gemma 4 needs gemma4, LFM2.5 needs lfm2/lfm2moe.

    "External LLM model is missing" means the example filename isn't a bundled dependency. Put a GGUF in ComfyUI/models/llm or configure a URL in models_config.json - the model-check node only reports, it never starts these downloads.

    An answer that stops mid-sentence is the max_tokens/n_ctx pair, not a crash. Raise both by the same amount.

    The honest take

    With a single chat node you'd never touch, this earns nothing - the connection is optional everywhere. It pays off when three calls share one provider, one key and one model, or when a cloud key should live in one place. Nothing glamorous; it just deletes a class of "why did two calls use different models?" bugs.

    CategoryMusic Production Toolkit/llm

    Inputs (29)

    NameTypeDefaultDescription
    modelCOMBOQwen_Qwen3.5-9B-Q4_K_M.ggufllama.cpp-compatible GGUF from models/llm. The example workflow references the same example model as before; provide the file or configure a download URL in models_config.json.
    max_tokensINT245761–131072Maximum number of tokens the LLM may generate. The example workflow uses 16384 so complete Caption/Lyrics/Title/Image Prompt sections fit.
    temperatureFLOAT0.700–2Sampling temperature. Lower values are more deterministic; the example uses 0.7.
    top_pFLOAT0.800–1Nucleus sampling threshold (the example uses 0.8). Lower values restrict sampling to more likely tokens.
    n_gpu_layersINT-1-1–512Number of model layers offloaded to the GPU. -1 offloads as many as possible. The model is reloaded when this or n_ctx changes.
    n_ctxINT37376512–262144Context window size in tokens. It holds the production system prompt, the response and any thinking, and is sized so that even a maximum-length answer fits; the example uses 37376.
    auto_downloadBOOLEANtrueWhen enabled and a download URL is configured in models_config.json, a missing GGUF is downloaded automatically. Missing models without a configured URL always produce a clear error.
    chat_formatCOMBOautoChat template applied to the conversation. auto picks the verified template for the model family (chatml for Qwen-style models with clean <think> handling, the model's own embedded template for Gemma); none uses the GGUF's own template; chatml/qwen/gemma/llama-3 pass the named template through. Models verified with auto: Qwen3.8-27B and Gemma 4.
    thinkingCOMBOoffReasoning/thinking output handling. off asks the backend to disable reasoning where supported and always splits any <think> blocks off the answer (they are logged and recorded separately); on/auto keep them. The parsed Caption/Lyrics/Title/Image_Prompt only ever see the clean answer.
    top_kINT401–1000Top-K sampling limit (LM Studio default 40). Restricts sampling to the K most likely tokens per step.
    min_pFLOAT0.000–1Minimum probability (Min-P) sampling; tokens below min_p times the top probability are excluded. 0 disables it (default).
    repeat_penaltyFLOAT1.100–3Penalty applied to tokens that already appeared in the text (1.0 = off, 1.1 is the common default).
    presence_penaltyFLOAT0.00-2–2Per-token penalty for any token that appeared at least once; discourages reuse (0 = off).
    frequency_penaltyFLOAT0.00-2–2Per-token penalty proportional to how often a token appeared; discourages repetition (0 = off).
    seedINT-1-1–2147483647Random seed for sampling; -1 uses a random seed for every run.
    split_modeCOMBOnoneMulti-GPU distribution mode (default: none = no splitting). layer distributes whole layers sequentially across GPUs; row (a.k.a. split parallel) splits layer tensors row-wise across GPUs and can help with large contexts. Only relevant when more than one GPU is present.
    tensor_splitSTRINGVRAM distribution across GPUs. Empty = llama.cpp auto-distributes. 'even' = split evenly across all detected GPUs. Or give comma-separated fractions/weights (e.g. 2,3 or 0.4,0.6); weights are normalized to sum to 1. The resolved split is logged.
    main_gpuINT00–16GPU index used for the intermediate results buffer when splitting across GPUs (normally 0).
    tensor_parallelBOOLEANfalseRequest true tensor parallelism across GPUs when the installed llama-cpp-python build supports it (0.3.48 does not; upgrade llama-cpp-python to use it). If unsupported, the node logs a warning and falls back to split_mode/tensor_split.
    backendCOMBOIn ComfyUI (GGUF)Where the language model runs: inside ComfyUI, in another local app, or at a cloud provider.
    local_providerCOMBOLM StudioStart the app's API server and load a text chat model there.
    cloud_providerCOMBOOpenAICloud sends your user and system prompts to this provider and may incur API charges.
    server_urlSTRINGAPI base address including /v1. Leave empty for the selected provider's default. Qwen: paste your regional workspace API base.
    remote_modelSTRINGExact server model ID. Use Find models to select one, or copy it from the provider/app.
    api_key_envSTRINGOptional environment variable NAME containing the key. Leave empty to use the provider's standard variable or Set API key.
    credential_idSTRINGInternal reference to a session key entered via Set API key. Contains no provider secret. Expires when ComfyUI restarts.
    remote_max_tokensINT40961–131072Output token budget, including reasoning where the provider counts it. Increase if output is truncated; model-specific limits apply.
    request_timeoutINT1205–600Network timeout in seconds. Slow local models may need more time. Failed requests are never retried automatically.
    permanent_keyBOOLEANfalseOff: the key entered with Set API key lives in ComfyUI's memory for this session only, so a restart asks for it again. On: it is additionally stored on this computer, bound to this exact API address, and reused after a restart. Clear session key deletes the stored key as well. The key never enters the workflow either way.

    Outputs (1)

    NameTypeDescription
    llm_config_jsonSTRING