Nodes/SDXL Auto Prompter/APNext MiniCPM Image
ComfyUI Node

APNext MiniCPM Image

Strong local image captioning with MiniCPM-V 4.5

By dagthomas·Created 3 years ago·Updated 17 days ago· 285
APNext MiniCPM Image
  • images
  • response
  • conversation_history
questionDescribe this image in detail.
model_nameopenbmb/MiniCPM-V-4_5
precisionbfloat16
enable_thinkingfalse
streamfalse
devicecuda
unload_after_inferencefalse
conversation_history

Want cloud-VLM-quality image captions without the cloud? MiniCPMImageNode (APNext MiniCPM Image) loads OpenBMB's MiniCPM-V onto your GPU and answers questions about an image - describe it, list what's in it, write a prompt from it. It's the local heavyweight of this pack's vision nodes: unlike LLaVA-through-Ollama it runs the model directly in ComfyUI, and MiniCPM-V 4.5 is genuinely good for its size, punching well above its ~8B weight class on captioning and OCR.

Why you'd reach for it: captioning a LoRA dataset, or generating a prompt from a reference, where you want quality but don't want to pay per image or ship your pictures to OpenAI. On a modern LLM-encoded image model, a detailed local caption is a ready-to-use prompt.

How it works

The node pulls the model from HuggingFace on first run and loads it onto your device (cuda), then answers your question about the images. It's all local - your VRAM does the work, so the first run is slow (a multi-gigabyte download) and later runs are fast.

The inputs that matter:

  • images + question (default "Describe this image in detail.") - swap the question for whatever you actually want: "Write a Stable Diffusion prompt for this image, focusing on lighting and composition."
  • model_name - openbmb/MiniCPM-V-4_5 (the strong default) or openbmb/MiniCPM-o-2_6 (the omni-modal sibling).
  • enable_thinking - turns on a slower deep-reasoning mode. Leave it off for plain captioning; flip it on for genuinely complex "reason about what's happening here" questions.
  • precision (bfloat16 / float16) - bfloat16 is the safe default on modern GPUs; use float16 on older cards that don't do bf16 well.
  • unload_after_inference - frees the model from VRAM when it's done. Turn this on if you're tight on memory or need the GPU back for the actual image generation; leave it off to keep the model warm across a batch.

Optional conversation_history lets you carry context across calls for multi-turn questioning. Outputs are response (the answer STRING, wire into your text encode) and conversation_history (feed it back in for the next turn).

Installing it

ComfyUI Manager: search comfyui_dagthomas, install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/dagthomas/comfyui_dagthomas
cd comfyui_dagthomas
pip install -r requirements.txt

This node leans on transformers and huggingface_hub from that requirements file, so the heavy install actually earns its keep here. No API key needed - but the model weights download from HuggingFace on first use, several gigabytes, so the first caption takes a while.

Common issues

First run stalls / "downloading." That's the model pulling from HuggingFace. Let it finish once and it's cached; don't cancel halfway or you'll re-download.

Out of memory. MiniCPM-V isn't tiny, and if the image checkpoint is already on the GPU you can OOM. Turn unload_after_inference on so the VLM releases VRAM before your sampler runs, and prefer bfloat16.

bfloat16 errors on an older GPU. Cards before Ampere don't handle bf16 well - switch precision to float16.

Thinking mode is slow. enable_thinking trades speed for reasoning depth and you rarely need it for captioning. If runs feel sluggish, that switch is the first thing to turn off.

Categorycomfyui_dagthomas

Inputs (9)

NameTypeDefaultDescription
imagesIMAGE
questionSTRINGDescribe this image in detail.
model_nameCOMBOopenbmb/MiniCPM-V-4_52 options: openbmb/MiniCPM-V-4_5, openbmb/MiniCPM-o-2_6
precisionCOMBObfloat16float16 uses slightly less memory. bfloat16 is more stable.
enable_thinkingBOOLEANfalse
streamBOOLEANfalse
deviceCOMBOcuda2 options: cuda, cpu
unload_after_inferenceBOOLEANfalse
conversation_historyoptSTRING

Outputs (2)

NameTypeDescription
responseSTRING
conversation_historySTRING