Nodes/HF-Flux-ComfyUI/Hugging Face Text to Image
ComfyUI Node

Hugging Face Text to Image

FLUX without the 24GB — this node rents Hugging Face's GPU for you

By Semper-Sursum·Created about a year ago·Updated about a year ago· 3
Hugging Face Text to Image
    • image
    prompt
    model_idblack-forest-labs/FLUX.1-dev
    api_key

    The name says "HF-Flux," but here's the thing nobody tells you in the install video: this node does not run FLUX.1-dev on your machine. It's a thin wrapper around Hugging Face's hosted Inference API. You type a prompt, the node posts it to HF's servers, a GPU in a datacenter somewhere does the denoising, and an image comes back over the wire. That's the whole trick - and for a specific kind of user, it's genuinely the right tool.

    Reach for this when you have no local GPU to spare (or none at all), when you want to sanity-check a prompt on FLUX.1-dev without committing 24GB of VRAM and a half-hour of GGUF downloading, or when your ComfyUI box is a laptop. It's also a decent way to understand what remote generation feels like before you pay for a dedicated API. What it is not is a replacement for a local Flux workflow: you trade all the control for the convenience.

    How it works

    Mechanically it's dead simple. On every run the node does an HTTP POST to https://router.huggingface.co/hf-inference/models/<model_id> with your API key as a Bearer token and the payload {"inputs": <your prompt>}. That's the entire request - no width, no height, no steps, no seed. The response comes back as image bytes, which get decoded, converted to RGB, normalized to 0–1 floats, and reshaped into a (1, H, W, 3) tensor that ComfyUI accepts as a standard IMAGE. Nothing is downloaded to your models folder; no diffusion happens locally. Check huggingface_node.py if you want proof - it's about ninety lines, and the README's troubleshooting line ("this node requires online access to Hugging Face's API") is the honest one.

    The inputs that matter

    There are exactly three, all required:

    • prompt - multiline text. The only thing that drives the result.
    • model_id - defaults to black-forest-labs/FLUX.1-dev. You can point it at any HF text-to-image model that serves through the inference API, but note FLUX.1-dev is a gated, non-commercial 12B model: you must accept BFL's terms on the model page before the API will serve it, even with a valid token.
    • api_key - your Hugging Face access token. This one is mandatory; the node hard-stops with ValueError if it's empty. Create it under your HF profile → Access Tokens.

    There is no optional block at all, so what you see is what you get. No seed, no dimensions, no control net, no batch. The server's defaults rule.

    Output

    One output: image (IMAGE). Wire it into anything that eats an image - a preview node, Save Image, or further downstream nodes. It's a single image per run, not a batch.

    Install

    The normal way, via ComfyUI Manager (search "HF-Flux-ComfyUI"), or by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Semper-Sursum/HF-Flux-ComfyUI
    cd HF-Flux-ComfyUI
    pip install -r requirements.txt
    

    Then restart ComfyUI. Dependencies are requests, numpy, torch, Pillow - torch is the heavy one, but ComfyUI ships with it already, so in practice you'll likely only pull requests if anything. The kicker: no model download at all. Compare that to local Flux's multi-gigabyte fp8/GGUF downloads and you'll see the appeal instantly.

    Common issues

    The one that bites everyone is the cached-image trap: because the node never sends a seed, identical prompts to the HF API can return the identical cached image - people literally report "same image for every prompt." Local users fix it by sending a random seed in the request, which this node can't do. Workaround: nudge the prompt text slightly (even a trailing space) to bust the cache.

    Beyond that: a missing or wrong token raises a 401 and the node prints the raw HTTP error. And the free serverless tier is rate-limited and queuey, so cold starts can be slow - fine for poking a prompt, a bad foundation for any batch pipeline. If you actually care about seeds, steps, aspect ratio, or reproducibility, run FLUX.1-dev locally with a proper ComfyUI workflow and one of the community quantization stacks; this node is a remote-control, not a workhorse. Just remember the Dev license is non-commercial - if your output is for money, that's on you, not on the node.

    Categoryimage generation

    Inputs (3)

    NameTypeDefaultDescription
    promptSTRING
    model_idSTRINGblack-forest-labs/FLUX.1-dev
    api_keySTRING

    Outputs (1)

    NameTypeDescription
    imageIMAGE