Prompt Cycler: run a list of prompts in ComfyUI, one per image

My free custom node turns every line of a text box into its own prompt and moves to the next one on each run. How to install it, connect it, show the current prompt, and add a fixed subject to every line with a Concatenate node.

Anton TenitskyOctober 13, 20264 min readVideo version below
The Prompt Cycler node in ComfyUI with a list of prompts, cycle mode set to sequential, next to a generated image of desert rock formations at sunset

Cycling through a list of prompts used to be surprisingly awkward in ComfyUI, so I built my own node. In the Prompt Cycler, each line of text is its own prompt. Run the workflow and you get the next one. Queue a few hundred runs and you get a few hundred different images.

It works with any model, because all it does is output text. I usually run it with Flux; here I demo it with plain Stable Diffusion 1.5, which is a very basic model, so the pictures aren’t great.

In short

  • Get it: tenitsky/tenitsky-prompt-cycler-simple on GitHub, free. Unzip or clone into ComfyUI/custom_nodes, restart.
  • Use it: one prompt per line; its prompt output goes into CLIP Text Encode.
  • Modes: sequential or random; reset_cycle starts again from the first line.
  • Extras: rgthree’s Display Any shows the current prompt; a Concatenate node adds a fixed subject to every line.

Install

The node isn’t in the ComfyUI Manager yet. Install it from GitHub, either way:

  • ZIP: click Code → Download ZIP, and unzip it into your ComfyUI/custom_nodes folder.
  • git:
    cd ComfyUI/custom_nodes
    git clone https://github.com/tenitsky/tenitsky-prompt-cycler-simple.git

If your ComfyUI is up to date, you don’t need to run pip install -r requirements.txt. Restart ComfyUI.

The GitHub repository page with the Code menu open and Download ZIP highlighted
Code → Download ZIP, then unzip into custom_nodes.

New to ComfyUI? Start with ComfyUI node basics and text-to-image.

Connect it

  1. Double-click the canvas and search for Prompt Cycler (listed as Tenitsky Prompt Cycler Simple). It comes with example prompts preloaded.
  2. Connect its prompt output to the text input of a CLIP Text Encode node, and that to your KSampler’s positive input as usual.
  3. Run. Each run takes the next line.

Its settings:

Setting What it does
seed / control after generate Leave it on increment so each run moves on
cycle_mode sequential goes through the list in order; random picks a line at random
reset_cycle Starts again from the first line
Text box Your prompts, one per line, as many as you like

The node also outputs cycle_index, the number of the current line.

See the current prompt

I like to add Display Any from rgthree and connect the prompt to it, so I can see which line is running.

A Display Any (rgthree) node showing the text: cat posing in front a space station orbiting a distant planet
Display Any shows the prompt being used. Here the missing space is the delimiter problem described below.

Add the same subject to every prompt

To put a particular character in every scene, add a Concatenate node:

  1. Type the subject in it, for example cat posing in front.
  2. Connect the cycler’s prompt as string_b.
  3. Connect the STRING output to the text encoder and to Display Any.
  4. Set the delimiter to a space. I forgot at first and got “in fronta space station”.
A Concatenate node with cat posing in front as the first string, the cycler connected as string_b and an empty delimiter field
Concatenate puts the fixed subject in front of each line. Set the delimiter to a space.

Now the cat appears in every image, whatever the scene.

An SD 1.5 image of a black and white cat sitting on a rock in front of a mountain lake, with the prompt list on the left
"Cat posing in front" plus the next line from the list: a cat at a mountain lake. Plain SD 1.5, so the quality is basic.

Combine concatenation with a long list and you can run thousands of prompts.

Why I built it

This has been a lifesaver for me. Before, I used a whole chain of nodes to do the same job: text files, prompt lists, a separate concatenate node with several inputs, and a preview. At the time I didn’t know how to compress and simplify it.

An older SDXL batch workflow with Text Concatenate, string nodes, an Inspire pack Bind node and notes
What I used before: many nodes for what one node does now.

For a cheap way to run large prompt lists, see thousands of AI images for under $0.001 each. For the earlier, multi-node approach applied to 3D renders, see prompt lists: one 3D render in many art styles.

If you have ideas for other nodes, leave them in the comments on the video. If they’d be useful, I may build them and share them.

Watch the video version (3:17)

Everything above is in the video too, if you'd rather follow along on screen.

FAQ

How do I run a different prompt for each image in ComfyUI?

Put one prompt per line in the Prompt Cycler node and connect its prompt output to a CLIP Text Encode node. Each run uses the next line; queue as many runs as you have lines.

Can I add the same subject to every prompt in the list?

Yes. Put the subject in a Concatenate node, connect the cycler’s prompt as the other string, set a space as the delimiter, and send the result to the text encoder.

Is the Prompt Cycler in the ComfyUI Manager?

Not yet. Install it from GitHub, either by downloading the ZIP into custom_nodes or with git clone.

Does it work with Flux or SDXL?

It works with any model, because it only outputs text. I usually run it with Flux; the demo uses SD 1.5.

Anton Tenitsky is a 3D artist with 15+ years in computer graphics, working with Nickelodeon, Gameloft, Marvel Rivals and many other clients. More about me

Related guides