ComfyUI Node
Fens Token Counter
Count typed prompt tokens and show the active tokenizer context window usage.
Fens Token Counter
- clip
- Total Tokens
- Context Limit Tokens
- Chunk Count
- Details
- Prompt Echo
◄count_strategymax_stream►
◄show_token_breakdownfalse►
◄text—►
CategoryFens_Simple_Nodes/Utility
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| clip | CLIP | ComfyUI CLIP object (text encoder stack) from the current workflow. | |
| count_strategy | COMBO | max_stream | How to aggregate counts across tokenizer branches (e.g. l/g/t5xxl): max_stream = largest branch count, sum_streams = sum of all branches. |
| show_token_breakdown | BOOLEAN | false | Append a per-token breakdown (id, decoded text, weight, word id) for each stream to the Details output. |
| textopt | STRING | The text to be encoded or counted. |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| Total Tokens | INT | Typed token count (excluding padding and most special tokens). |
| Context Limit Tokens | INT | Total padded slots in the active context window/floor (e.g. 77/154/231 for CLIP-style encoders). For unbounded encoders like T5XXL/Qwen3-family, this is just their minimum padding floor, not a hard ceiling. |
| Chunk Count | INT | Number of tokenizer chunks/windows used for this prompt. |
| Details | STRING | Human-readable summary of typed tokens and context usage. Includes a per-token breakdown when Show Token Breakdown is enabled. |
| Prompt Echo | STRING | The input prompt (multiline string). |