Silver CivitAI Random Image
Free Random Reference Images From CivitAI's Public API — No Key Required
- image
- image_url
- prompt
This node drops a random image from CivitAI's public gallery straight into your graph - no API key, no account, no setup beyond installing the pack. It hits CivitAI's free /api/v1/images endpoint and downloads whatever it lands on. The obvious use is img2img: every queue run gets a different random reference, which is great for stress-testing a style or just generating in a "random moodboard" loop. Because it also hands back the prompt from the image's metadata, you can even use it as a random prompt source for text-to-image.
How it works
The node requests a page of images from CivitAI, figures out the pagination, jumps to a random page, and picks a random item. It then md5-hashes the image URL and checks it against a history file in the pack's history/ folder - no repeat images until you've churned through a thousand of them. The download is just requests + PIL, converted to a ComfyUI IMAGE tensor. CivitAI's metadata usually includes the generation prompt, so that gets pulled out and offered separately.
Inputs worth your time
- nsfw -
none,soft,mature, orx, defaultnone. This maps to CivitAI's content filter. Heads up: CivitAI is, well, CivitAI - "none" filters a lot, but you may still see skin you didn't ask for. Don't run this on a shared screen. - limit - how many images the query considers (default 100, max 1000). Bigger isn't better here; it only widens the search pool.
- seed - set above 0 for reproducible picks. Zero means fully random.
- download - this is the one input the code ignores. The current implementation fetches the image regardless of whether you set
disableorenable. Don't rely on it to save bandwidth. - force_refresh - defaults to
disable, and this is the important one.
The gotcha that will confuse you the first time
The node refuses to load the same image twice. If the random draw hits an image it's already downloaded, it raises an error that skips the entire workflow run - you'll see "Skipping workflow" in the console and your queue just moves on. That's not a crash, it's the dedup working as intended, but it feels broken the first time. Flip force_refresh to enable when you actually want a repeat, or when the history file has made the "fresh" pool thin.
Outputs
- image - the IMAGE tensor, wire it into img2img, ControlNet preprocessors, or whatever wants a reference.
- image_url - the source URL as a string, handy for a Display Text node or if you want to go look at the original page.
- prompt - the generation prompt from the post's metadata. Often present for SD/SDXL images; can be empty for videos or uploads without metadata, so don't build a workflow that requires it.
Install & expectations
ComfyUI Manager → search "ComfyUI Silver Nodes", or:
cd ComfyUI/custom_nodes
git clone https://github.com/SilverAndJade/comfyui-silver-nodes
Then restart. You need working internet to civitai.com and that's about it. One honest caveat: this is a small, low-profile pack and a node that scrapes a public API others rely on. If CivitAI tightens its rate limits tomorrow, this node is exactly the kind of thing that starts failing. Fine for hobby use; don't build your production pipeline on it.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| seed | INT | 00–18446744073709550000 | — |
| nsfw | COMBO | none | 4 options: none, soft, mature, x |
| limit | INT | 1001–1000 | — |
| download | COMBO | disable | 2 options: disable, enable |
| force_refreshopt | COMBO | disable | 2 options: disable, enable |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| image_url | STRING | — |
| prompt | STRING | — |