Nodes/Leon's Utility and API Integration Nodes/πŸ€– Leon Model Selector
ComfyUI Node

πŸ€– Leon Model Selector

One dropdown for every LLM your endpoint serves β€” the pack's model picker

By l3ony2kΒ·Created about a year agoΒ·Updated 2 months agoΒ· 3
πŸ€– Leon Model Selector
    • model_name
    β—„model_choicegemini-flash-latestβ–Ί
    β—„api_urlhttps://api.hyprlab.io/v1/modelsβ–Ί
    β—„api_keyYOUR_HYPRLAB_API_KEYβ–Ί
    β—„fetch_from_endpointfalseβ–Ί
    β—„custom_modelβ–Ί

    Leon Model Selector is the pack's answer to the "which model am I even talking to?" problem. It's a tiny node with a single output - model_name, a STRING - that you wire into the model input of the pack's LLM Chat and LLM JSON nodes. Instead of typing a model ID into a text box every time (and typo-ing gpt-4o as gpt-4O), you pick from a dropdown populated from a live model list. It's the ComfyUI equivalent of a model picker in an API playground, and it keeps your graphs from breaking when an endpoint's model list changes under you.

    The clever bit is the caching. The dropdown isn't hardcoded - it's loaded from a cached models_config.json the pack ships, and when you flip fetch_from_endpoint to True, the node hits the api_url (default https://api.hyprlab.io/v1/models) with your key, pulls the live model list, saves it to the cache, and refreshes the dropdown. So the node stays useful even when the endpoint is unreachable: it falls back to the cached list instead of failing the whole workflow.

    How it works

    Three inputs you'll touch:

    • model_choice - the dropdown itself. Default gemini-flash-latest. The list it shows is whatever's in the cache (the choices array in the schema is intentionally empty/dynamic - it's built at runtime from the cache).
    • api_url / api_key - used only when fetch_from_endpoint is on. The default endpoint is HyprLab's /v1/models.
    • custom_model - a free-text override that replaces the dropdown selection when filled in. This is the escape hatch: if the model you want isn't in the cached list, type it here.

    Output: model_name (STRING) - wire it into Leon_LLM_Chat_API_Node.model or Leon_LLM_JSON_API_Node.model.

    The node also prints a warning (not an error) if the model you selected isn't in the fetched list - you can still run it, but you've been told.

    Installing it

    Pack-wide install:

    cd ComfyUI/custom_nodes
    git clone https://github.com/l3ony2k/comfyui-leon-nodes
    pip install -r requirements.txt
    

    Restart ComfyUI, or install "ComfyUI Leon Nodes" via ComfyUI Manager.

    Where people get burned

    The cache is a double-edged sword. The dropdown reflects the cached list, which may be stale - a model that exists at the endpoint won't show up until you flip fetch_from_endpoint on and refresh. And since this is a pure model-chooser, it's easy to forget it doesn't validate against anything at runtime; custom_model lets you type nonsense and it'll happily pass it along (the LLM node is where the error finally lands). The HyprLab defaults assume you're using HyprLab's endpoint - point api_url at whatever OpenAI-compatible service you actually use. For keeping model IDs consistent across a graph, it's a small node that removes a whole class of typo bugs.

    CategoryLeon_API

    Inputs (5)

    NameTypeDefaultDescription
    model_choiceCOMBOgemini-flash-latestSelect a model from available options
    api_urlSTRINGhttps://api.hyprlab.io/v1/modelsAPI URL to fetch models list
    api_keySTRINGYOUR_HYPRLAB_API_KEYYour HyprLab API key
    fetch_from_endpointoptBOOLEANfalseFetch fresh model list from API endpoint and save to cache
    custom_modeloptSTRINGEnter custom model name (overrides dropdown selection)

    Outputs (1)

    NameTypeDescription
    model_nameSTRINGβ€”