Nodes/Fens-Simple-Nodes/Fens Token Counter
ComfyUI Node

Fens Token Counter

Count typed prompt tokens and show the active tokenizer context window usage.

By Taithrah·Created about a year ago·Updated about a month ago· 6
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)

NameTypeDefaultDescription
clipCLIPComfyUI CLIP object (text encoder stack) from the current workflow.
count_strategyCOMBOmax_streamHow to aggregate counts across tokenizer branches (e.g. l/g/t5xxl): max_stream = largest branch count, sum_streams = sum of all branches.
show_token_breakdownBOOLEANfalseAppend a per-token breakdown (id, decoded text, weight, word id) for each stream to the Details output.
textoptSTRINGThe text to be encoded or counted.

Outputs (5)

NameTypeDescription
Total TokensINTTyped token count (excluding padding and most special tokens).
Context Limit TokensINTTotal 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 CountINTNumber of tokenizer chunks/windows used for this prompt.
DetailsSTRINGHuman-readable summary of typed tokens and context usage. Includes a per-token breakdown when Show Token Breakdown is enabled.
Prompt EchoSTRINGThe input prompt (multiline string).