ComfyUI Node
⬡ Polyhedron Token Counter
Counts the prompt against the text encoder's hard token limit and says how close it is. Over the limit, the native path truncates in silence: no crash, the end of the prompt simply never reaches the model. It also distrusts its own trigger_words input - if that socket is handed a serialised config instead of triggers, it says so on the number itself rather than printing a count it does not believe.
⬡ Polyhedron Token Counter
- report
- positive_tokens
- negative_tokens
- over_limit
- trigger_tokens
◄model_limit512►
◄warn_threshold0.90►
◄positive_prompt►
◄negative_prompt►
◄trigger_words►
CategoryPolyhedron/Utils
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| model_limit | INT | 51264–8192 | Max tokens supported by the target model's text encoder. WAN 2.1 / WAN 2.2 = 512 (UMT5-XXL hard limit). FLUX = 512 (T5-XXL). SDXL = 75 per CLIP chunk. Leave at 512 for WAN. |
| warn_threshold | FLOAT | 0.900.5–1 | Fraction of the limit at which to warn. 0.90 means warn at ≥460 of 512 tokens. |
| positive_promptopt | STRING | Positive prompt to count. | |
| negative_promptopt | STRING | Negative prompt to count. | |
| trigger_wordsopt | STRING | Optional: wire the Stack's trigger_words output here to see how much of the budget the auto-collected triggers alone consume. Diagnostic only — these are normally already part of the positive prompt, so they are NOT added to over_limit. |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| report | STRING | — |
| positive_tokens | INT | — |
| negative_tokens | INT | — |
| over_limit | BOOLEAN | — |
| trigger_tokens | INT | — |