Nodes/Bjornulf_custom_nodes/โ˜๐ŸŽจ API Image Generator (CivitAI) ๐ŸŽจโ˜
ComfyUI Node

โ˜๐ŸŽจ API Image Generator (CivitAI) ๐ŸŽจโ˜

Generate on Civitai's servers from a token

By justUmenยทCreated 2 years agoยทUpdated about a year agoยท 545
โ˜๐ŸŽจ API Image Generator (CivitAI) ๐ŸŽจโ˜
    • images
    • generation_info
    โ—„api_tokenโ–บ
    โ—„promptRAW photo, face portrait photo of 26 y.o womanโ–บ
    โ—„negative_promptlow quality, blurry, pixelated, distorted, artifactsโ–บ
    โ—„width1024โ–บ
    โ—„height768โ–บ
    โ—„steps20โ–บ
    โ—„cfg_scale7.0โ–บ
    โ—„seed-1โ–บ
    โ—„number_of_images1โ–บ
    โ—„timeout300โ–บ
    โ—„model_urnurn:air:sdxl:checkpoint:civitai:101055@128078โ–บ
    โ—„add_LORAโ–บ
    โ—„DO_NOT_WAITfalseโ–บ
    โ—„links_fileโ–บ
    โ—„LIST_from_style_selectorโ–บ

    Most of this pack runs locally. This node doesn't - it genuinely calls the Civitai cloud API and generates the image on their GPUs, then pulls the result back into your graph. So you can generate with a Civitai-hosted checkpoint (and their LoRAs) without downloading a single model or owning a GPU that can run them. The trade: you need a Civitai API token, and every generation spends Buzz - specifically Yellow Buzz, since Civitai's API calls draw from the crypto-bought currency, not the free Blue kind.

    It's a real option when the model you want lives on Civitai and you don't want the multi-gig download, or your local card can't handle it. Just go in clear-eyed about cost and reliability.

    How it works

    You paste a token, a prompt, and a model reference (Civitai's "AIR" identifier - the urn:air:... string that points at a specific model version), set your usual generation params, and the node fires a request to Civitai. It waits for the job to finish (up to your timeout), then hands back the image plus a text blob describing the generation. Because the work happens server-side, your local VRAM is irrelevant - but so is your local speed; you're at the mercy of Civitai's queue.

    The inputs and outputs that matter

    • api_token (STRING, required) - your Civitai API token, from your Civitai account settings. Nothing works without it.
    • prompt / negative_prompt (STRING) - the usual.
    • model_urn (STRING, optional) - the AIR identifier of the checkpoint to use, e.g. the default urn:air:sdxl:checkpoint:civitai:101055@128078. Swap this to change models; grab the URN from the model's page on Civitai.
    • width / height / steps / cfg_scale / seed / number_of_images - standard generation controls (width/height cap at 1024, up to 10 images).
    • timeout (INT, default 300s) - how long to wait before giving up. Bump it; the API can be slow.
    • add_LORA (STRING, optional) - connect the pack's "Add Lora (API - CivitAI)" node here to stack LoRAs onto the request.
    • DO_NOT_WAIT (boolean) - fire-and-don't-block behaviour. links_file and LIST_from_style_selector feed batch/style workflows.

    Outputs: images (IMAGE, into a save/preview) and generation_info (STRING - pipe it into Show (JSON) to read what actually ran).

    How to install it

    ComfyUI Manager โ†’ Bjornulf_custom_nodes โ†’ install โ†’ restart. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/justUmen/Bjornulf_custom_nodes
    pip install -r Bjornulf_custom_nodes/requirements.txt
    

    then restart. This node needs the civitai-py dependency from the requirements - if the install skipped it, the node will error on use. On Windows portable Python, install into python_embeded (the README has the exact command).

    Common issues & troubleshooting

    It hangs or times out with no image. Per the author's own warning, the Civitai API is not the most reliable - sometimes it's slow, sometimes it just doesn't answer, and some URNs respond worse than others. Raise timeout, retry, and don't run anything expensive through it. For pricey models (Flux Ultra), the advice is to use the website with Blue Buzz instead of burning Yellow Buzz on flaky API calls.

    "Unauthorized" / no output. Bad or missing api_token. Regenerate it in your Civitai account and paste it fresh.

    The model won't load. A malformed or unsupported model_urn. Copy the AIR string straight from the model version's page; a wrong version number after the @ fails.

    It cost Buzz and I didn't expect that. API generation spends Yellow Buzz per image - this isn't free local compute. Budget accordingly, and keep number_of_images low while you're dialing in a prompt.

    civitai-py import error on startup. The dependency didn't install. Run the pack's requirements again in the correct Python environment.

    CategoryCivitai

    Inputs (15)

    NameTypeDefaultDescription
    api_tokenSTRINGโ€”
    promptSTRINGRAW photo, face portrait photo of 26 y.o womanโ€”
    negative_promptSTRINGlow quality, blurry, pixelated, distorted, artifactsโ€”
    widthINT1024128โ€“1024โ€”
    heightINT768128โ€“1024โ€”
    stepsINT201โ€“50โ€”
    cfg_scaleFLOAT7.01โ€“30โ€”
    seedINT-1-1โ€“9223372036854776000โ€”
    number_of_imagesINT11โ€“10โ€”
    timeoutINT30060โ€“1800โ€”
    model_urnoptSTRINGurn:air:sdxl:checkpoint:civitai:101055@128078โ€”
    add_LORAoptSTRINGโ€”
    DO_NOT_WAIToptBOOLEANfalseโ€”
    links_fileoptSTRINGโ€”
    LIST_from_style_selectoroptSTRINGโ€”

    Outputs (2)

    NameTypeDescription
    imagesIMAGEโ€”
    generation_infoSTRINGโ€”