ComfyUI Node

Prompt Counter

A Tiny Node That Tells You How Many Prompts You Actually Have

By tusharbhuttΒ·Created 3 years agoΒ·Updated about a year agoΒ· 68
Prompt Counter
    • count
    • preview
    β—„promptsβ€”β–Ί
    β—„print_to_consoletrueβ–Ί

    Prompt Counter is the pack's utility belt: it counts how many prompts are sitting in a text block and reports the number. Sounds almost too boring to install a node for, but it earns its place the moment you build a multi-prompt batch workflow, because it's the missing link between the batch prompt nodes and everything downstream.

    The detail that makes it useful

    The input prompts accepts both newline-separated text and pipe-separated text - and the node is smart enough to tell which it's getting. If the text contains | and no newlines, it splits on the pipes; otherwise it splits on newlines.

    Why does that matter? The pack's batch prompt nodes (SDXL Batch Prompts, Flux Batch, Kontext Batch) emit PROMPT_LIST as a pipe-joined string. Before the June 2025 update, this counter could only handle newlines, which meant you couldn't wire it directly to a batch node - you had to insert a converter in between. That's fixed now. The point of the fix is right there in the changelog: this node can sit immediately after a batch prompt node, or anywhere downstream in a prompt-creation chain, and always count correctly.

    How it works

    A simple split-and-count with a preview. It strips empty lines (so trailing newlines don't inflate the count), tallies the entries, and builds a preview string showing the first five prompts plus a "...and N more" line if there are more. Nothing fancy, and there's genuinely nothing to tune.

    Inputs and outputs

    • prompts (multiline STRING) - the text to count.

    • print_to_console (BOOLEAN, default true) - dumps the count and preview to the ComfyUI console.

    • count (INT) - the number of prompts. This is the output you actually use: wire it into a batch-size input, an image saver's filename logic, or any node that needs to know how many images you're about to get.

    • preview (STRING) - the human-readable listing, for a Show Text node if you want it on screen.

    Where it fits

    The classic combo: batch prompt node β†’ Prompt Counter β†’ image saver, so each generated image gets named after its prompt and you know the count matches the batch. It's also handy as a sanity check when you're generating prompts dynamically with wildcards or dynamic-prompt nodes - the count tells you how many variants actually got produced before you commit a render.

    One honest limitation: it counts lines, not distinct ideas. If a wildcard expands inside a line, that line still counts as one. For the pack's fixed-list batch nodes that's exactly right; for freeform prompt generation it's a count of entries, not permutations.

    Installing

    ComfyUI Manager (search Endless Nodes) or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/tusharbhutt/Endless-Nodes
    

    Restart, find it under Endless 🌊✨ β†’ BatchProcessing. Small, reliable, does one job - about as low-risk as a custom node gets. (Single-author hobby pack, GPL v3, no maintenance promises, but this one is simple enough that the risk is minimal.)

    CategoryEndless 🌊✨/BatchProcessing

    Inputs (2)

    NameTypeDefaultDescription
    promptsSTRINGβ€”
    print_to_consoleBOOLEANtrueβ€”

    Outputs (2)

    NameTypeDescription
    countINTβ€”
    previewSTRINGβ€”