APNext Local random prompt
Pull random prompts from a local file, no API needed
- STRING
Its display name in the menu is "APNext Local random prompt," and that tells you what it's for: pulling random prompt material out of a local file, entirely offline. No LLM, no API key, no per-generation cost. You point it at a text or JSON file, tell it how many entries to grab, and it hands back a string. It's the low-tech cousin of the fancy LLM prompt nodes in dagthomas's pack - and for a lot of batch work it's the one you actually want, because it's free, deterministic on a fixed seed, and doesn't phone anywhere.
Think of it as a wildcard reader with a knob for how much to pull. If you keep a big file of subjects, styles, or scene fragments, this node lets each run draw a different slice, which is a cheap and reliable way to get variety across a batch without touching a model.
How it works
Pure Python. It opens the file at file_path, pulls amount entries from it (randomly, driven by the optional seed), optionally filters or wraps them with custom_tag, and returns the result as one STRING. Because the randomness keys off the seed, a fixed seed gives you a reproducible pull and a randomized seed gives you fresh variety each run - the standard ComfyUI pattern.
The inputs and outputs that matter
file_path- the file to read. It defaults to./custom_nodes/comfyui_dagthomas/concat/output.json, which is a file the pack ships; point it at your own.txtor.jsonof prompt fragments to make it yours.amount(default 10, range 1–100) - how many entries to pull per run. Small numbers for a focused prompt, larger for a dense grab-bag.custom_tag- an optional tag string to attach to what it reads (handy for consistently prepending or labeling the pulled fragments).seed(optional) - fix it for reproducible pulls, randomize it for batch variety.
The single output is STRING, which you wire into a CLIP Text Encode or feed into a string merger to combine with other prompt pieces.
How to install it
ComfyUI Manager: search comfyui_dagthomas, install, restart. Manual:
cd ComfyUI/custom_nodes && git clone https://github.com/dagthomas/comfyui_dagthomas
cd comfyui_dagthomas && pip install -r requirements.txt
then restart. The pack's requirements.txt installs a heavy stack (openai, anthropic, google-generativeai, transformers, decord, scipy) for the LLM and video nodes elsewhere in the repo. This node needs none of it; decord is the dependency most likely to fail a build, and the plain nodes usually load if it does.
Where people get burned
- Path is relative to ComfyUI's working directory. The default
./custom_nodes/...path assumes you launched ComfyUI from its root. If the node can't find the file, that's almost always why - use an absolute path or check where you started ComfyUI from. - File format matters. It's built around the pack's own file layout (that
concat/output.json). A random.txtwith one prompt per line may or may not parse the way you expect - test with a smallamountfirst and look at the output before trusting it in a batch. amounttoo high = prompt soup. Pulling 100 fragments into one prompt gives you an incoherent pile. This is a variety tool, not a "more is better" one - small pulls read better.- Deterministic vs random. If your batch keeps producing the same prompt, your
seedis fixed. Set the node (or an upstream seed) to randomize per run.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| file_path | STRING | ./custom_nodes/comfyui_dagthomas/concat/output.json | — |
| amount | INT | 101–100 | — |
| custom_tag | STRING | — | |
| seedopt | INT | 00–18446744073709550000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |