Nodes/ComfyUI_LayerStyle_Advance/LayerUtility: PromptTagger(Advance)
ComfyUI Node Runs on cloud

LayerUtility: PromptTagger(Advance)

Image-to-prompt via Gemini, with a built-in find-and-replace

By chflame163·Created 2 years ago·Updated 4 months ago· 696
LayerUtility: PromptTagger(Advance)
  • image
  • text
api
token_limit80
exclude_word
replace_with_word

PromptTagger looks at an image and hands back a text prompt describing it - the standard image-to-prompt move, except it's built on Google's Gemini vision API and it does one thing most of the pack's other captioning nodes don't: it can swap out a specific word in the output before it ever reaches you. Feed it a picture, get a prompt back, with an unwanted term already replaced.

That word-swap is the actual reason to reach for this over one of the pack's plainer vision nodes (ZhipuGLM4V, for instance, just returns raw text). If you're running this across a batch of images and you know you always want, say, a brand name or a recurring artifact term stripped out of the caption, PromptTagger does that in the same pass instead of needing a separate string-replace node downstream.

The inputs and outputs that matter

  • image - required, the picture to describe.
  • api - gemini-1.5-flash or gemini-pro-vision. Flash is faster and cheaper; pick pro-vision if you need better reasoning about a complex scene.
  • token_limit (default 80, range 2–1024) - caps how long the generated caption can run. 80 is short - bump it up if you're getting truncated descriptions.
  • exclude_word / replace_with_word (both default empty) - the find-and-replace pair. Leave exclude_word blank and this node behaves like a plain captioner; fill it in and any occurrence gets swapped for replace_with_word in the returned text.

Output is a single text string - wire it into whatever consumes a prompt: a CLIP text encode, another LLM node's user_prompt, or straight into a batch-processing pipeline.

Installing it

ComfyUI Manager: search "ComfyUI Layer Style Advance". Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/chflame163/ComfyUI_LayerStyle_Advance.git

Run install_requirements.bat (or the manual pip steps for a portable install) and restart.

The part that actually trips people up isn't the node install - it's the API key. PromptTagger needs a Google AI Studio key (free to generate at makersuite.google.com/app/apikey). The plugin ships a template at api_key.ini.example in its own folder; you have to rename that to api_key.ini, open it in a text editor, and fill in google_api_key= yourself. This is shared across every Gemini-backed node in the pack (Gemini, GeminiV2, ObjectDetectorGemini, and this one) - set it once and they all work.

Common issues

Node runs but does nothing, or errors about a missing key. Almost always the api_key.ini step above. Community reports of this exact confusion - a node "just not working" that turned out to be the .ini.example file never getting renamed - are common enough that it's the first thing to check before assuming anything's actually broken.

Network/proxy errors talking to Google. If you're somewhere Gemini's endpoints aren't reachable, this node has no fallback - it needs live internet access to google_api_key's API surface. There's no local mode here, unlike LoadSmolLM2Model elsewhere in this pack.

Word replacement doesn't seem to apply. The swap works on the literal text Gemini returns, so it's case- and form-sensitive - if the model wrote "car" but you excluded "Car", it won't match. Check the exact casing/wording in a test run first.

Caption gets cut off mid-sentence. Raise token_limit. The 80-token default is tuned for short tags, not full descriptive captions.

Category😺dzNodes/LayerUtility/Prompt

Inputs (5)

NameTypeDefaultDescription
imageIMAGE
apiCOMBO2 options: gemini-1.5-flash, gemini-pro-vision
token_limitINT802–1024
exclude_wordSTRING
replace_with_wordSTRING

Outputs (1)

NameTypeDescription
textSTRING