Nodes/Comfyui_image2prompt/Text to Prompt 🐼
ComfyUI Node

Text to Prompt 🐼

Text to Prompt 🐼 — ComfyUI Node Guide

By zhongpei·Created 3 years ago·Updated about a year ago· 386
Text to Prompt 🐼
  • model
  • STRING
prompt
max_tokens128
temperature0.20
print_outputdisable
cachedNO
prefixmust be in english and describe a picture according to follow the description below within 77 words:
system_promptYou are a helpful assistant.

What it is

A prompt rewriter, not an image describer. Where Image2Text looks at a picture and writes a caption, Text2Prompt takes text you already have - a rough idea, a caption from an upstream node, a fragment - and runs it through a small local LLM with an instruction wrapped around it, to turn it into a fuller, cleaner generation prompt. This is the pack leaning into the "LLM-assisted prompting" pattern that's become genuinely mainstream: dedicated local prompt-writing nodes are common now, and having something local rewrite your rough idea into a properly structured prompt before it hits your checkpoint is no longer a novelty.

It pairs naturally with the captioning nodes: caption an image with Image2Text, then pipe that caption into Text2Prompt to polish or restyle it, rather than using the raw caption as-is.

How it works

It needs a TEXT2PROMPT_MODEL from the Loader Text to Prompt Model node - this node doesn't load anything itself, it just runs generation against whatever's wired in. Your input prompt gets wrapped: a prefix template goes in front of it, a system_prompt sets the model's persona, and the whole thing gets generated with standard temperature/token-length controls.

Inputs and outputs

  • prompt - the raw text you're feeding in.
  • model - the TEXT2PROMPT_MODEL, wired from the loader.
  • max_tokens - default 128. How long the rewritten output can run.
  • temperature - default 0.2, range 0-1. Low by default, which makes sense for a rewriting task where you want a faithful expansion, not a wildly creative reinterpretation. Push it up if you want more variety across runs.
  • print_output - off by default; flip on to see the result in your console.
  • cached - "NO" by default. Set to "YES" to skip re-running generation for identical input, useful while you're iterating on something downstream and don't want to keep re-triggering the LLM.
  • prefix - a long default instruction ("must be in english and describe a picture according to follow the description below within 77 words: ") that gets prepended to your prompt before generation. You can replace it with your own instruction if the default framing doesn't fit what you're doing.
  • system_prompt - five presets: a generic helpful-assistant persona, two translation personas (Chinese-to-English and classical-Chinese-to-English), a painter persona focused on visual detail, and a screenwriter persona for continuous comic-style scripts. Pick whichever matches the kind of rewrite you actually want.

Single STRING output - the rewritten prompt.

Installing it

Ships with the rest of the pack:

cd ComfyUI/custom_nodes
git clone https://github.com/zhongpei/Comfyui_image2prompt

Or install via ComfyUI Manager by searching "Comfyui_image2prompt." (The README's own clone snippet points at a hyphenated URL that 404s - use the underscored one above.) Restart ComfyUI afterward. You'll also need the Loader Text to Prompt Model node wired in, since Text2Prompt has no model of its own to download - see that node's article for the actual model choices and download details.

Common issues

Forgetting the loader. This node is useless on its own - without a TEXT2PROMPT_MODEL wired in from the loader, there's nothing to generate with.

77-word target, but no hard cutoff enforced by max_tokens=128. The default prefix asks the model to stay within 77 words as an instruction, not a hard limit - the LLM might overshoot it. If you need a strict length, check the actual output length rather than trusting the prefix text alone.

The default prefix assumes English output. If you want Chinese, classical-Chinese translation, or another framing entirely, swap both the prefix and system_prompt together - they're designed to work as a pair, and changing one without the other can produce a mismatched result.

Categoryfofo🐼/prompt

Inputs (8)

NameTypeDefaultDescription
promptSTRING
modelTEXT2PROMPT_MODEL
max_tokensINT128
temperatureFLOAT0.200–1
print_outputCOMBOdisable2 options: enable, disable
cachedCOMBONO2 options: YES, NO
prefixSTRINGmust be in english and describe a picture according to follow the description below within 77 words:
system_promptCOMBOYou are a helpful assistant.5 options: You are a helpful assistant., 你擅长翻译中文到英语。, 你擅长文言文翻译为英语。, 你是绘画大师,擅长描绘画面细节。, 你是剧作家,擅长创作连续的漫画脚本。

Outputs (1)

NameTypeDescription
STRINGSTRING