Token Counter
Find out if your prompt is getting silently truncated
- clip
- text
- count
Stop guessing whether your prompt survived the 77-token cut
SD 1.5, SDXL, Illustrious, Pony - the CLIP-family encoders these checkpoints use cap your prompt at roughly 77 tokens and silently chop the rest. No error, no warning, your carefully placed keywords just... don't exist. Token Counter (ETTokenCountNode) tells you how many tokens your prompt actually is before you burn a generation discovering the important part got cut. It's the pack's flagship node, and the one you'll actually keep around.
What it does
It's a passthrough text node. You wire it between your prompt source and a CLIP Text Encode node: it counts the tokens the CLIP encoder would see, shows the count right on the node, and hands the original text through untouched. Nothing gets re-encoded, nothing gets modified.
Inputs that matter:
text- your prompt (accepts input from another node)clip- any CLIP object, typically from a Checkpoint Loader or DualCLIPLoader. Use the same CLIP you'll actually encode with, because tokenization is model-specific.tokens- ignore this. It's the widget where the count appears; it gets overwritten every run.
Outputs:
text- the passthrough prompt, wired on to CLIP Text Encodecount- the token count as an INT (the average, if you fed it a list)
How the counting works
The node calls clip.tokenize(text) and counts the real tokens in the model's g token stream, filtering out token id 0 (padding). Two details worth knowing because they bite people:
- Feed it a list and you get an average. If your prompt source emits multiple strings (Dynamic Prompts, batch prompts), it counts each one, shows something like
~34 (28-41)on the node, and returns the average ascount. The README says it only counts one string - that's stale; the shipped code counts all of them. But the average is exactly the trap the README warns about: one wildly long prompt drags the average up even if the rest are fine. - It's a CLIP-era tool. It only knows how to read the
gtoken stream. Feed it a T5/LLM-class encoder (Flux, Qwen-Image and friends) and the count comes back as 0 - it has no idea what to do with that tokenizer. For modern LLM-encoded models, just skip this node; the ~75-100 effective-token attention cap lives in a different place anyway.
How to install it
Ships in Info Utils (exectails/comfyui-et_infoutils). No dependencies, no model downloads. Install via ComfyUI Manager (search "Info Utils") or:
cd ComfyUI/custom_nodes
git clone https://github.com/exectails/comfyui-et_infoutils
Restart ComfyUI and look under exectails/Info.
Troubleshooting
- Count is stuck at 0. You're feeding it a T5-class encoder, or your CLIP isn't wired in. Check the
clipinput. - The number doesn't appear on the node. The pack uses a small frontend extension to fill the widget. If the widget stays empty but the
countoutput still has a value, your install is missing the extension - reinstall/restart, and make sure you didn't copy only thenodes/folder. - The count looks too low. You're probably measuring with a different CLIP than the one doing the encode, or the string went in as one list element. Wire the exact CLIP you encode with.
The honest verdict: for SD 1.5/SDXL-family workflows it's a genuinely useful debugging tool, the kind that turns "why is my prompt doing nothing?" into a one-glance answer.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — | |
| clip | CLIP | — | |
| tokens | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |
| count | INT | — |