MiniCPM-o image
Turn one picture into a prompt that reproduces it
- model
- tokenizer
- image
- response
You know those images you'd love to have as a prompt - the exact wording that would reproduce them? This is the node for that. Feed it one image and a MiniCPM-o model, and it writes you a full natural-language prompt designed to recreate that image. It's image-to-text prompt inversion, which is the one genuinely common reason people run a vision model inside ComfyUI at all: you've got a reference shot and you want the text that would get a diffusion model back there.
That's the same job people use Qwen-VL, Florence-2, or a ChatGPT node for, but MiniCPM-o 2.6 does it fully local and - importantly for this pack - it's tuned for prompt generation rather than generic captioning. The author framed it from day one as "prompt reverse inference" for image generation, and even demonstrated pairing it with ControlNet to transfer style and detail.
How it works
Under the hood it's a single chat call to MiniCPM-o. The node takes your image tensor, grabs the first image in the batch (image[0] - batches don't fly here), converts it to a PIL image, builds a chat message of [image, prompt], and calls model.chat(). The prompt is the interesting part.
Default mode uses a built-in system preset (TEMPLATE_PROMPT in the source): a long, specific template demanding a scene overview, main elements, layout, light and color, style, and details - all in one continuous paragraph, no markdown, "based on visible information in the image, avoiding speculation." That template is why the output reads like a proper generation prompt instead of a one-line caption. Flip prompt_mode to "Use Custom Input" and your own text in the prompt box replaces it entirely.
Inputs that matter
Only a few to care about:
model/tokenizer- wire these from the Load MiniCPM-o Model node.image- the reference image, from any Load Image.prompt_mode-Use System Preset(default) orUse Custom Input. If you pick custom,promptis the multiline box that takes over.max_new_tokens- the output length cap (default 512). Long detailed prompts eat tokens; bump it if the response feels truncated.
The sampling knobs - seed, temperature (0.7), top_p (0.9) - work as you'd expect; the single output is response, a STRING you can wire into a text box, a save node, or straight into a prompt input on whatever you're generating next.
Installing
Same pack as the rest of MiniCPM-o: search "MiniCPM-o" in ComfyUI Manager, or git clone https://github.com/CY-CHENYUE/ComfyUI-MiniCPM-o into custom_nodes, install requirements.txt with ComfyUI's python, and - the step everyone forgets - download openbmb/MiniCPM-o-2_6 from Hugging Face into models/MiniCPM/MiniCPM-o-2_6/ before the Load node will work.
The gotcha that will bite you
The node caches on seed: IS_CHANGED returns the seed value, so the node only re-runs when the seed changes. Swap the input image and hit queue, and nothing happens - it serves you the previous answer until you nudge the seed (or force the queue). That trips up almost everyone the first time. A second gotcha: each call is a full 8B model inference, so this is not a snappy node. Expect a few seconds to a few tens of seconds per image, depending on your card, and budget VRAM accordingly - no quantization here, so a 24 GB card is the comfortable zone.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| tokenizer | TOKENIZER | — | |
| image | IMAGE | — | |
| prompt_mode | COMBO | Use System Preset | 2 options: Use System Preset, Use Custom Input |
| prompt | STRING | — | |
| seed | INT | 6666666666666660–18446744073709550000 | — |
| temperature | FLOAT | 0.700.1–2 | — |
| top_p | FLOAT | 0.900.1–1 | — |
| max_new_tokens | INT | 5121–2048 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| response | STRING | — |