Nodes/ComfyUI-APIMaster/APIMaster Config
ComfyUI Node

APIMaster Config

One node holds the key, the other four just borrow it

By apimaster-ai·Created 22 days ago·Updated 18 days ago· 1
APIMaster Config
    • config
    ◄base_urlhttps://apimaster.ai/v1►
    ◄api_key►

    You don't queue this node. It doesn't generate anything, has no pixels in it, and if you paste a key into it the author will scold you in the console. It exists so that the four nodes in this pack that do cost you money all point at the same endpoint with the same credential, without you typing that credential eleven times.

    That's the whole job, and it's the right shape for the job. In ComfyUI this pattern is everywhere - the "context object" that carries a bundle of values down one wire - except here the thing being bundled is a secret and a URL.

    How it works

    APIMaster Config outputs a single config value of type APIMASTER_CONFIG. Internally that's a plain dict: your resolved key plus a normalised base_url (trailing slashes are stripped, so https://apimaster.ai/v1/ and https://apimaster.ai/v1 behave the same). Every other node in the pack takes that dict as a required input and constructs an HTTP client from it.

    Two consequences worth internalising. The type is private to this pack - you can't hand an APIMASTER_CONFIG to some other vendor's nodes. And the node validates: if it can't find a key from any source it raises immediately with "No API key found", before anything else in the graph fails with a vaguer message. Annoying the first time, useful after that.

    The inputs that matter

    base_url is required and defaults to https://apimaster.ai/v1. Keep the /v1; a missing suffix is the single most common HTTP 404 cause in this pack, and the error hint says so out loud.

    api_key is optional and defaults to empty - leave it empty and set an environment variable instead. The node prints a warning if you fill it in, and the reason is stated bluntly in the code: widget values live inside the workflow JSON, and workflow JSON gets posted in issues, uploaded next to generated images and shared on model sites. A key typed into a node field is a key you have published. This is the same default-disclosure trap as ComfyUI embedding your whole prompt in every PNG you save - the sharing feature is the leak.

    Install

    ComfyUI Manager: search APIMaster, install, restart. Or by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/apimaster-ai/ComfyUI-APIMaster
    # nothing to pip install
    

    That's not marketing - requirements.txt in the repo is deliberately empty and the HTTP layer is Python's own urllib. Compared with the usual custom-node experience of two packs fighting over transformers versions, a pack that resolves to zero packages is the least invasive thing you can add.

    Then, in the environment ComfyUI actually runs in:

    export APIMASTER_API_KEY=sk-...
    # Windows PowerShell
    $env:APIMASTER_API_KEY = "sk-..."
    

    Set it before launching ComfyUI, and if you launch from a shortcut or a service, check that the variable is visible to that process - a key set in a terminal you didn't start ComfyUI from might as well not exist.

    Where the key actually comes from

    The README documents the environment variable and the ~/.apimaster/config.json fallback. The source adds one more step you should know about, in this order: the node's own field, then APIMASTER_API_KEY, then OPENAI_API_KEY, then the config file. That third one bites people. If you already export an OpenAI key for other tooling, this node will silently pick it up and send it to whatever base_url you set - which is how you get a 401 you can't explain, or, worse, your OpenAI credential arriving at a third-party gateway. Check your environment before you blame the node.

    Using it with another provider

    Point base_url at any OpenAI-compatible endpoint and use each generator node's model_override to type an id that isn't in the dropdown. Fair warning: "OpenAI-compatible" here means more than /images/generations. The async image path calls /images/generations/async and polls /tasks/{id}, and video calls /videos/generations and polls /videos/{id}. A gateway that only implements the vanilla image endpoint will work in sync mode and fail everywhere else.

    Common issues

    HTTP 401 is almost always stray whitespace or quotes around the key - the code strips both, but a copied KEY="sk-..." pasted with the variable name still fails, and a Notepad-pasted key can carry an invisible character. HTTP 404 is the /v1 suffix. HTTP 402 means you're out of balance, which is a billing problem, not a config one.

    And the honest caveat: as of writing, this pack has essentially no community footprint - the pack name appears in zero threads across the r/StableDiffusion, r/comfyui and r/civitai corpora. Nobody has vouched for it. That matters more here than for most packs, because an API node is supposed to hold a credential and call the network, which is exactly the shape of the one custom node in this ecosystem that shipped credential-stealing malware. The good news: it's roughly 600 lines of readable Python with a stdlib-only client. Read apimaster/client.py and apimaster/nodes.py before you hand it a key you care about, and see where your prompt and images are going.

    CategoryAPIMaster

    Inputs (2)

    NameTypeDefaultDescription
    base_urlSTRINGhttps://apimaster.ai/v1—
    api_keyoptSTRING—

    Outputs (1)

    NameTypeDescription
    configAPIMASTER_CONFIG—