Nodes/ComfyUI-YALLM-node/LLM Provider (API)
ComfyUI Node

LLM Provider (API)

Let the API tell you which models exist, instead of hardcoding them

By asaddi·Created 2 years ago·Updated 14 days ago· 7
LLM Provider (API)
    • llm_model
    provider
    model

    LLM Provider (API) is the low-friction sibling of the pack's LLM Model node. Same job - hand a usable LLM connection to the LLM Chat node - but instead of you hardcoding a model id in a YAML file, it goes and asks the server what models it actually has. Pick a provider, hit "fetch models," and the second dropdown fills itself with real model ids straight from the API. It's the node you reach for when you're running local llama.cpp and swapping GGUF files around, or when the hosted provider keeps adding and retiring models and you're tired of editing config by hand.

    How it works

    The provider dropdown is populated from providers.yaml, which works exactly like models.yaml - name, base_url, api_key, with the same os.environ/ env-var trick for keys. But the model dropdown is a different beast: it starts empty except for a placeholder, and you have to fill it.

    Under the hood there's a small frontend extension (shipped in the pack's js/ folder). When you click the fetch models button, or switch providers, it calls the pack's /llm_models backend route, which spins up an OpenAI client against the selected provider and hits its GET /v1/models endpoint. The returned ids populate the model widget, and it picks the first one automatically. The model widget stays disabled until that fetch succeeds.

    Here's the part that trips people: the node intentionally errors until you've fetched successfully at least once. The validation message - "fetch models and make a selection first" - isn't a bug. ComfyUI may execute the node before the async fetch finishes, or you may have a stale workflow where the model list was never fetched. Click the button, wait for the dropdown to populate, and it settles down.

    The inputs and output that matter

    Two inputs, one output. provider is the dropdown of your providers.yaml entries. model is the fetched list (or the placeholder "fetch.models.first" that tells you you haven't fetched yet). Output is llm_model, type LLMMODEL - identical to what LLM Model produces, which is the whole point. The two nodes are drop-in interchangeable: swap one for the other in a workflow and the downstream LLM Chat node doesn't care.

    Where people get burned

    The most common complaint on r/comfyui with this pack: "I updated and restarted and it still only shows [LOCAL] llama.cpp." Nine times out of ten it's not a caching problem - it's that providers.yaml only ships with the three local entries and a commented-out OpenRouter example. Remote providers do not appear unless you add them to the file yourself, same as the model node. There's also a subtle catch if you point it at a provider where the model list is huge (some hosts return hundreds of ids) - fine for a dropdown, mildly tedious to scroll, but harmless.

    Use LLM Provider when the model inventory changes under you; use LLM Model when you want a stable, hand-picked list with no fetch ceremony. Both are just thin wrappers around the OpenAI client this pack ships - pip install openai pydantic is the entire dependency story - so neither is going to eat your VRAM or download a single weight.

    CategoryYALLM

    Inputs (2)

    NameTypeDefaultDescription
    providerCOMBO3 options: [LOCAL] llama.cpp, [LOCAL] LM Studio, [LOCAL] Ollama
    modelCOMBO1 options: fetch.models.first

    Outputs (1)

    NameTypeDescription
    llm_modelLLMMODEL