Nodes/ComfyUI_MieNodes/Set OpenAI LLM Service Connector ๐Ÿ‘
ComfyUI Node

Set OpenAI LLM Service Connector ๐Ÿ‘

The connector you wire when the local 8B isn't cutting it

By MieMieeeeeยทCreated 2 years agoยทUpdated 3 days agoยท 273
Set OpenAI LLM Service Connector ๐Ÿ‘
    • llm_service_connector
    โ—„api_tokenโ–บ
    โ—„model_selectgpt-6-astraโ–บ
    โ—„custom_modelโ–บ
    โ—„config_filemie_llm_keys.jsonโ–บ
    โ—„config_keyopenaiโ–บ
    โ—„prefer_local_configtrueโ–บ

    What it is

    MieNodes ships about two dozen near-identical connector nodes - one per LLM provider - and they all do the same thing: hand you a single llm_service_connector socket that any of the pack's call nodes can consume. This one points at api.openai.com.

    Whether you want it at all is the more interesting question. An LLM in a ComfyUI graph is usually doing a small, structured rewrite job: turn a rough idea into a prompt, or an image into a caption. For that job, the community's honest answer is that a local 8B abliterated model on your own card is good enough, and it buys the two things an API can't - it's uncensored and it's free per call. You reach for OpenAI when you want genuinely better English, don't care about NSFW, and are fine paying per call. It filters, so don't build an NSFW pipeline on it.

    One thing to get straight before you wire anything: this LLM is not the text encoder inside your checkpoint. The encoder runs every generation and you can't swap it. This node is a tool you bolt onto the graph, upstream of the sampler.

    How it works

    The node doesn't call anything when ComfyUI loads. It builds a connector object holding your model id and key; the actual HTTP request happens later, inside whichever call node you wire it into. The retry policy is 3 attempts, 5 seconds apart, which covers timeouts, connection errors and 5xx - a 4xx from a bad key fails fast, as it should.

    The payload this connector sends is deliberately thin, and the difference matters. It uses max_completion_tokens, not max_tokens, because the gpt-5+ and o-series models reject the legacy spelling server-side. It also omits sampling parameters entirely and lets the server apply per-model defaults - the right call, since the reasoning-tier models pin temperature anyway and will 400 you for arguing.

    The inputs that matter

    Three of them, honestly.

    api_token - your sk-... key. Leave it blank if you're using the config file (see below), which you should.

    model_select - defaults to gpt-6-astra. The dropdown also carries gpt-6-astra-pro, gpt-6-luna, gpt-6-luna-pro, gpt-5.5, gpt-5.5-pro, gpt-5.2-chat, gpt-5.1, and Custom. These are stable family names; when you need a specific snapshot, switch to Custom and paste the exact id from the platform.

    custom_model - the id used when model_select is Custom.

    config_file, config_key (default openai), prefer_local_config are the plumbing for the JSON key file. Output: llm_service_connector, one socket, wire it into CallLLMService, Translator, PromptGenerator, the Bernini or Qwen-Image-2.1 generators - anything with a connector input. To sanity-check the whole chain, wire it into the pack's CheckLLMServiceConnectivity node first; it fires one request and prints the HTTP status plus the head of the reply, so you find a wrong key in two seconds instead of after a full run.

    Installing and keying it

    cd ComfyUI/custom_nodes
    git clone https://github.com/MieMieeeee/ComfyUI-MieNodes
    cd ComfyUI-MieNodes && python -m pip install -r requirements.txt
    

    The dependency list is light - requests, pillow, pyyaml, opencv-python, soundfile, imagehash, toml, deepdiff, huggingface_hub - and nothing in this pack needs a model download or a torch reinstall. (ComfyUI Manager: search ComfyUI_MieNodes.) Restart, then:

    cd ComfyUI/custom_nodes/ComfyUI-MieNodes
    cp mie_llm_keys.json.example mie_llm_keys.json
    # then edit the "openai" entry
    

    The trap worth internalizing: prefer_local_config defaults to True, which means the JSON file wins over whatever you type into api_token. If you paste a fresh key into the node and keep getting a 401, the file is almost always why - look there first, not at the node.

    Common issues

    401, "invalid API key." The bare sk- prefix is shared by OpenAI, Bailian, MiniMax, MiMo, DeepSeek, Kimi and SiliconFlow, so the key format tells you nothing. Make sure your OpenAI key is in the openai slot and not a sibling's, and that no stale value sits in that slot.

    "Model not found." Dropdown ids are family names and OpenAI rotates snapshots. Paste the exact id into custom_model.

    Timeouts on the pro/reasoning tiers. Long deliberations can outrun the connector's 30-second per-request timeout, and there's no timeout knob on this node - the base class just retries three times and gives up. Shorten the job (smaller token budget downstream) or pick a non-reasoning sibling.

    Category๐Ÿ‘ MieNodes/๐Ÿ‘ LLM Service Config

    Inputs (6)

    NameTypeDefaultDescription
    api_tokenSTRINGโ€”
    model_selectCOMBOgpt-6-astra9 options: gpt-6-astra, gpt-6-astra-pro, gpt-6-luna, gpt-6-luna-pro, gpt-5.5, gpt-5.5-pro, +3
    custom_modeloptSTRINGโ€”
    config_fileoptSTRINGmie_llm_keys.jsonโ€”
    config_keyoptSTRINGopenaiโ€”
    prefer_local_configoptBOOLEANtrueโ€”

    Outputs (1)

    NameTypeDescription
    llm_service_connectorLLMServiceConnectorโ€”