Replicate pharmapsychotic/clip-interrogator
Reverse an image into a prompt
- image
- STRING
CLIP Interrogator does the thing everyone wants at some point: hand it an image, and it hands you back a text prompt that would plausibly produce something like it. It's the original "reverse prompt" tool - pharmapsychotic's project has been a community staple since the early Stable Diffusion days. You point it at a reference image you like, get a starting prompt, and tweak from there instead of staring at a blank text box. This node runs it from ComfyUI via ComfyUI-Replicate.
It runs on Replicate's cloud, so you don't have to install CLIP models or BLIP weights locally - the whole thing happens over the API.
How it works
Under the hood it's two models cooperating. A BLIP captioner writes a literal description of the image ("a woman standing in a field at sunset"). Then CLIP is used to test that image against big lists of artists, mediums, styles, and modifiers, keeping the phrases whose embeddings best match the picture. Stitch the caption and the top-matching modifiers together and you get a Stable-Diffusion-flavored prompt. The node sends your image to Replicate, runs that pipeline, and returns the prompt as a STRING.
Inputs and outputs that matter
Input is an IMAGE (required). Output is a single STRING - the generated prompt. Wire it into a CLIP text-encode, a show-text node, or an LLM node if you want to clean it up further.
mode- the one that actually changes your results:best(default) - most thorough, best prompt, slowest.fast- quicker, rougher.classic- the older phrasing style.negative- builds a negative prompt instead, i.e. terms to push away from.
clip_model_name- which CLIP backbone to match against.ViT-L-14/openai(default) is the one that pairs with SD 1.5-era models; theViT-HandViT-bigGLAION options align with SD 2.x / SDXL text encoders. Match this to the model family you're prompting for and the vocabulary lands better.
force_rerun re-interrogates even when the input image is unchanged.
How to install it
ComfyUI Manager: search ComfyUI-Replicate, install, restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/replicate/comfyui-replicate
cd comfyui-replicate
pip install -r requirements.txt
Restart. Set your Replicate token before launching, or the node errors:
export REPLICATE_API_TOKEN="r8_************"; python main.py
Token: replicate.com/account/api-tokens.
Common issues
This is one of the well-behaved nodes in the pack - it returns a plain string, which is exactly the "simple text output" case the pack's README says it supports, so no audio/multi-output weirdness to worry about here.
The usual gotchas: a missing REPLICATE_API_TOKEN is the first-run failure. Cost - best mode is the slow, thorough one and costs more per run than fast; use fast while you're just fishing for a starting point. And a reality check on the output: CLIP Interrogator gives you a descriptive prompt, not a magic one-liner that recreates the image. It's a strong first draft - often overloaded with redundant "trending on artstation, highly detailed, 8k" filler you'll want to trim. Treat it as a starting point to edit, not a finished prompt.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| clip_model_nameopt | COMBO | ViT-L-14/openai | 3 options: ViT-L-14/openai, ViT-H-14/laion2b_s32b_b79k, ViT-bigG-14/laion2b_s39b_b160k |
| modeopt | COMBO | best | 4 options: best, classic, fast, negative |
| force_rerunopt | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |