Nodes/comfyui-llamacpp/Start llama.cpp Router
ComfyUI Node

Start llama.cpp Router

Launches and owns llama-server in multi-model router mode for explicit, terminal model load and unload control.

By Setmaster·Created 7 months ago·Updated about a month ago· 4
Start llama.cpp Router
    • server_url
    • success
    context_size4096
    gpu_layers
    main_gpu0
    models_max4
    port8080
    threads
    batch_size512
    flash_attentionfalse
    models_autoloadtrue
    timeout60
    binary_path
    host127.0.0.1
    tensor_split
    no_mmapfalse
    flash_attention_modelegacy
    sleep_idle_seconds0
    api_key_file
    api_key_envLLAMACPP_API_KEY
    media_path
    fit_modeupstream default
    unload_comfy_models_before_startfalse
    extra_args
    models_directory(auto)
    CategoryLlamaCpp

    Inputs (23)

    NameTypeDefaultDescription
    context_sizeINT40960–1048576Maximum context size for routed models. 0 uses upstream logic.
    gpu_layersSTRINGLayers to offload to GPU. Empty preserves legacy all-layers behavior; auto, all, or a number are also accepted.
    main_gpuINT00–31Primary GPU index used by routed model instances.
    models_maxINT40–128Maximum model instances the router may keep loaded.
    portoptINT80801–65535TCP port for the owned llama-server router.
    threadsoptSTRINGCPU generation threads. Empty lets llama-server choose.
    batch_sizeoptINT5121–65536Logical prompt-processing batch size for routed models.
    flash_attentionoptBOOLEANfalseLegacy flash-attention toggle. Prefer flash_attention_mode for new workflows.
    models_autoloadoptBOOLEANtrueLoad an unloaded router model automatically on first request.
    timeoutoptSTRING60Router startup readiness deadline. Empty has no limit.
    binary_pathoptSTRINGExplicit llama-server executable. Empty uses LLAMA_SERVER_BINARY, then PATH.
    hostoptSTRING127.0.0.1Network interface address to bind. Loopback is safest.
    tensor_splitoptSTRINGPer-GPU model proportions, for example 3,1.
    no_mmapoptBOOLEANfalseDisable memory-mapped model loading.
    flash_attention_modeoptCOMBOlegacyModern flash-attention mode. Legacy preserves the released flash_attention widget behavior.
    sleep_idle_secondsoptINT00–86400Release each model's state after this idle period. 0 disables.
    api_key_fileoptSTRINGPath to a llama-server API key file, one key per line.
    api_key_envoptSTRINGLLAMACPP_API_KEYEnvironment variable containing the matching client key. The secret is not serialized.
    media_pathoptSTRINGDirectory allowed for llama-server file:// media inputs.
    fit_modeoptCOMBOupstream defaultControl whether llama-server adjusts unset arguments to fit device memory.
    unload_comfy_models_before_startoptBOOLEANfalseEvict Comfy-managed models before router startup.
    extra_argsoptSTRINGAdvanced llama-server arguments. No shell is used.
    models_directoryoptCOMBO(auto)Configured GGUF root exposed to the router. Auto selects the root with the most unambiguous models visible to llama-server's one-level directory scan. Each bundle directory must contain one base model and at most one projector.

    Outputs (2)

    NameTypeDescription
    server_urlSTRINGURL of the running owned llama-server router.
    successBOOLEANWhether router startup reached its ready state.