Nodes/ComfyUI-Replicate/Replicate lucataco/sdxl-clip-interrogator
ComfyUI Node

Replicate lucataco/sdxl-clip-interrogator

Reverse-engineer a prompt from an image

By replicate·Created 2 years ago·Updated 2 years ago· 206
Replicate lucataco/sdxl-clip-interrogator
  • image
  • STRING
modebest
force_rerunfalse

Point this at an image and it hands you back a text prompt that describes it - the reverse of normal image generation. It's the classic CLIP Interrogator, tuned for SDXL, wrapped as a Replicate node. You use it to answer "how would I prompt for something like this?" - grab a reference you like, interrogate it, and get a starting prompt with the subject, style, medium, and a few artist/aesthetic tags to riff on.

It's a Replicate node, so the analysis runs in the cloud: your image goes up, the model runs on Replicate's GPU, the string comes back. You need a Replicate account and a REPLICATE_API_TOKEN, you pay per run, and nothing installs locally beyond the wrapper.

How it works

CLIP Interrogator does two things and staples them together. A BLIP captioning pass writes a plain-English description of the image ("a woman standing in a field at sunset"). Then it compares the image's CLIP embedding against big banks of candidate terms - artists, mediums, movements, "trending on" tags - and appends the closest matches. The result reads like a real prompt because it's assembled from the vocabulary prompts are actually made of.

The inputs and outputs that matter

There are only three, which is refreshing:

  • image (required) - the picture to describe.
  • mode - best or fast. best searches the term banks thoroughly and gives a richer prompt but takes noticeably longer; fast is quick and lighter. Start with best for a reference you care about, fast when you're bulk-tagging.
  • force_rerun - bypass Replicate's cache when identical inputs would return the same string.

The output is a single STRING - the prompt - which you wire straight into a text/CLIP encode node, a show-text node to read it, or off to an LLM node to clean up.

How to install it

One install brings every Replicate node.

  • ComfyUI Manager: search ComfyUI-Replicate, install, restart.
  • Manual:
    cd ComfyUI/custom_nodes
    git clone https://github.com/replicate/comfyui-replicate
    cd comfyui-replicate
    pip install -r requirements.txt
    
    then restart.

Nothing downloads to your machine - just the replicate pip package. Set your token before launching ComfyUI: export REPLICATE_API_TOKEN="r8_..." (replicate.com/account/api-tokens).

Common issues & troubleshooting

best mode is slow. That's the mode doing its job - it's searching large term banks. If you don't need the last few artist tags, fast is much quicker and usually good enough for a starting point.

The prompt has weird artist names or "trending on ArtStation" filler. CLIP Interrogator leans on an aesthetic vocabulary from the SD 1.5 / SDXL era, and it isn't gospel - treat the output as a draft. Keep the subject and composition words, trim the tag salad, and rewrite for whatever model you're actually generating with. On a modern model that wants natural-language prompts, those keyword lists transfer poorly.

The caption is generic or slightly wrong. The BLIP half is an older, simple captioner, so it nails the gist but misses fine detail and occasionally guesses. If you want a richer, more accurate description, run the image through a modern vision-language model instead - but for a fast prompt seed, this does the job.

CategoryReplicate

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
modeoptCOMBObest2 options: best, fast
force_rerunoptBOOLEANfalse

Outputs (1)

NameTypeDescription
STRINGSTRING