Google AI - Trigger Word Extractor
Stop guessing which token makes your LoRA work
- trigger_words
Every trained LoRA has a trigger word baked into it - the token you're supposed to include in your prompt to actually activate the thing. Download enough LoRAs and you'll regularly find one whose README forgot to say what it is. GoogleAI_TriggerWordExtractor solves that: it reads the ss_tag_frequency metadata out of the LoRA file and asks Gemini to extract and format the trigger words for you. If a LoRA "does nothing," this is the fastest way to check whether you're missing the secret handshake.
What it's for
The exact failure mode where a LoRA loads fine but has zero visible effect - the #1 cause is a missing trigger word. Instead of manually opening the file or hunting through a download page, run this, read the trigger_words output, and put the token in your prompt. It's also genuinely useful for organizing a LoRA library: generate the trigger list for each file and keep it in a text log next to your models.
How it works
The node opens the LoRA with safetensors.safe_open, pulls the metadata dict, and looks for ss_tag_frequency - the key that training scripts like kohya write to record how often each tag appeared in the training set. That data is JSON describing the tags and their counts; the node sends it to Gemini with an instruction to extract the actual trigger tokens (usually the rare-token captions or the classic (charactername) style tags) and return them cleanly. If ss_tag_frequency is missing, it searches for any metadata key containing "tag" or "trigger" as a fallback, and if there's truly nothing, it tells you so rather than inventing an answer.
Inputs and outputs that matter
- lora_path (STRING) - path to the
.safetensorsLoRA file. The node checks the file exists before doing anything. - model (COMBO, default
gemini-2.5-flash) - flash is the right default here; this is a cheap extraction task, no need for a pro model. - api_key - resolves from
GEMINI_API_KEYor.env. - trigger_words (STRING) - the extracted tokens, ready to paste into your prompt.
Installing it
Ships with COMFYUI_PROMPTMODELS (PromptModels Studio in Manager):
cd ComfyUI/custom_nodes
git clone https://github.com/cdanielp/COMFYUI_PROMPTMODELS
Put GEMINI_API_KEY=AI... in the pack's .env, restart. Needs ComfyUI 0.26.0+.
Common issues
The realistic ones are metadata-shaped. Not every LoRA carries ss_tag_frequency - LoRAs trained with different tools or stripped of metadata will fall through to the fallback keys or return the "not found" warning, and in that case the trigger word genuinely isn't in the file to extract. Also remember the source caveat: ss_tag_frequency records what was tagged, and the trigger word is what the trainer chose to use for activation - for a well-made LoRA they're the same, for a sloppy one the report may list frequent tags rather than a clean trigger. And this calls Gemini, so it's a metered API call - nothing, in this pack, is actually free.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| lora_path | STRING | — | |
| api_keyopt | STRING | — | |
| modelopt | COMBO | gemini-2.5-flash | 4 options: gemini-3.1-pro-preview, gemini-3-flash-preview, gemini-2.5-flash, gemini-2.5-pro |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| trigger_words | STRING | — |