Nodes/ComfyUI-clip-interrogator/↩ Clip Interrogator
ComfyUI Node

↩ Clip Interrogator

The node that turns any image back into a prompt

By prodogape·Created 3 years ago·Updated 2 years ago· 67
↩ Clip Interrogator
  • image
  • prompt
mode
model_name

You see an image and think "I want that vibe," but you don't have the prompt. ComfyUI already ships the reverse direction - WD14 taggers will list what's in the frame, BLIP will describe it in a sentence - but this node does something else: it runs CLIP's own math backward and hands you a prompt that a CLIP-conditioned model would consider a good match for the image. That's the classic "CLIP Interrogator" trick from the pharmapsychotic project, wrapped into a single ↩ Clip Interrogator node. Feed it an image, get a prompt string out, wire that into a CLIP Text Encode, and you've got a reverse-engineering loop that works entirely on your machine - no API calls, no keys, nothing leaves your box.

How it works

Under the hood it's a thin wrapper around the clip-interrogator Python package (pinned to 0.6.0), which pairs an OpenCLIP vision model with a similarity search over a baked-in bank of caption fragments. In the slowest mode it first asks a BLIP captioner what the scene is, then scores thousands of candidate fragments against the image's CLIP embedding and stitches the best matches into a prompt. That's why the output reads like a prompt instead of a caption: it's literally assembled from prompt-shaped pieces the similarity search likes.

There are 196 model_name choices because the dropdown is generated from every model OpenCLIP knows about, written out at startup to model_config.yaml. The defaults you'll actually want are the familiar ones - ViT-L-14 was the SD 1.5-era workhorse, ViT-H-14 and EVA02-L-14 are the better picks for SDXL-era models. Each model's weights download to ComfyUI/models/clip/ on first use, so the first run on a fresh model is slow and needs internet; after that it's cached and fast.

The inputs that matter

The node has exactly three inputs and one output, and only the first two really change behavior:

  • mode - best runs the full BLIP caption + similarity pipeline and gives the longest, most descriptive result. classic skips BLIP and is faster but blunter. fast is a quick-and-dirty pass. negative is the sleeper: it returns a negative prompt - a list of what to steer away from - instead of a positive one.
  • model_name - the OpenCLIP model. Defaults work fine; pick ViT-L-14 for old SD 1.5 checkpoints or an EVA02/ViT-H variant for SDXL.
  • image - feed it a single image (see the gotcha below).

Output: one STRING named prompt. Right-click the positive prompt box on a CLIP Text Encode, choose "Convert widget to input," and wire the string straight in. The same trick works for the negative box if you ran negative mode.

Installing it

ComfyUI Manager works - search "ComfyUI-clip-interrogator." Or do it by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/prodogape/ComfyUI-clip-interrogator

then restart ComfyUI. Two things to know going in. First, there's no requirements.txt: the pack shells out to pip install clip-interrogator==0.6.0 itself when it imports, so the first startup after install needs internet and a working pip in whatever Python ComfyUI uses. Second, the README still tells you to clone unanan/ComfyUI-clip-interrogator - that's the original repo this one forked from, and the instructions (install pythongosssss/ComfyUI-Custom-Scripts first, set HF_ENDPOINT if you can't reach Hugging Face) apply just the same here.

Where people get burned

The big one: errors are swallowed. If the model download fails or something else goes wrong, the node silently returns an empty string and only prints the exception to the ComfyUI console. So "I got nothing back" usually means "check the console," and in most cases that means the OpenCLIP weights couldn't download - the HF_ENDPOINT tip from the Chinese README exists for exactly this. Also feed it one image at a time; the node does a bare squeeze() on the tensor, so a batch of images isn't really handled. And don't expect magic on anime art: this is CLIP similarity, not a Danbooru tagger, so you'll get style-y natural-language fragments rather than 1girl, long hair tag lists. For tag recipes, you want WD14; for "what prompt made this," you want this node.

Categoryimage

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
modeCOMBO4 options: best, classic, fast, negative
model_nameCOMBO196 options: EVA01-g-14-plus/merged2b_s11b_b114k, EVA01-g-14/laion400m_s11b_b41k, EVA02-B-16/merged2b_s8b_b131k, EVA02-E-14-plus/laion2b_s9b_b144k, EVA02-E-14/laion2b_s4b_b115k, EVA02-L-14-336/merged2b_s6b_b61k, +190

Outputs (1)

NameTypeDescription
promptSTRING