LLM Xml Prompt Formatter
Say it in a sentence, get NewBie's XML prompt back
- image
- xml_out
- text_out
NewBie isn't a normal checkpoint. It's a 3.5B ACG-native DiT that reads prompts as structured XML - <character_1>, <appearance>, <general_tags>, the works. That structure is why it's so good at multi-character anime scenes, and it's also why hand-writing prompts for it is miserable. This node is the escape hatch: type a sentence (or paste a Danbooru tag string, or drop in an image) and it calls an LLM API to hand back the XML NewBie actually wants. There's a plain-text mode for Anima models too.
It's the flagship node in this pack, and the one you'll actually keep in your workflow. It doesn't run any local model - no weights, no VRAM, just a thin client for any OpenAI-compatible chat API (DeepSeek, OpenRouter, Gemini, whatever). The name is a small lie: "LLM" here means you bring the API key.
How it works. All config lives in LPF_config.json inside the pack folder: your api_key, api_url, model_list, and the system prompts that teach the LLM the XML schema. The node reads that file when it's created - which is why, before you set it up, every field defaults to a "读取API失败" (failed to read API) placeholder. Get the config right and the dropdown populates with your models.
The flow is straightforward. Your user_text, plus the optional image (base64-encoded for multimodal models - this is prompt reverse-engineering, not img2img), goes to the API. In NewBie mode the node extracts the XML code block, validates it with lxml and auto-repairs formatting slips, then prepends the gemma_prompt header. Anima mode parses the ## Prompt and ## 中文解释 sections instead. Network blips trigger up to three retries, and identical inputs are cached, so re-running the same text costs zero tokens.
The agent_effort dropdown is the genuinely interesting part. At Medium or High, the LLM gets to call a live Danbooru tag-search service, verifying and supplementing tags instead of hallucinating them from memory. Daily use: Medium. Already pasted a full tag string? Close (or Low, which auto-detects and does one quick round) - the agent trusts tags you provide and skips the searching.
The inputs that matter:
user_text- your sentence or tag list.mode- NewBie (XML) or Anima (plain text). Match it to the model downstream.agent_effort- Close / Low / Medium / High.thinking- the deep-thinking toggle; the author recommendsfalse, and Agent mode forces it off anyway.force_full_agent_run- flip totruewhen iterative edits feel stuck on stale cache.image(optional) - feed a picture for multimodal captioning.
Outputs: xml_out is the finished prompt - wire it into NewBie's text encoder. text_out carries the extra notes (or the 中文解释 in Anima mode).
Install. Either comfy node install NewBie-LLM-Formatter, or find it in ComfyUI Manager and clone:
cd ComfyUI/custom_nodes
git clone https://github.com/SuzumiyaAkizuki/ComfyUI-LLM_Prompt_XML_Formatter
Then the step that trips everyone: rename LPF_config.json.example to LPF_config.json and fill in api_key, api_url, and model_list. Dependencies are light - openai, lxml, numpy, Pillow, httpx.
Where people get burned: the API key. Put it in the config file, never in the node UI - keys typed into widgets get saved into the workflow and leak into the PNG when you share it. The node's own default text warns about exactly this. And if you still see the "读取API失败" placeholders, your config file isn't being read: the rename didn't happen, or you created the node before editing. F5, then recreate the node. One more thing: agent runs are multiple LLM calls each, so keep thinking off and don't leave High on for every throwaway test.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| api_key | STRING | 读取API失败,请在此填写api key | — |
| api_url | STRING | 读取API失败,请在此填写api url | — |
| model_name | STRING | 读取模型列表失败,请在此填写模型名称 | — |
| user_text | STRING | 1girl, holding a sword [警告]:读取API失败,请检查配置文件。你可以在节点输入相关信息。请注意,你的API会在原图中保存,分享原图可能会导致API泄露。强烈建议使用配置文件,完成配置后按F5刷新页面并重新创建此节点。 | — |
| thinking | BOOLEAN | false | — |
| mode | COMBO | 2 options: NewBie, Anima | |
| agent_effort | COMBO | 4 options: Close, Low, Medium, High | |
| force_full_agent_run | BOOLEAN | false | — |
| imageopt | IMAGE | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| xml_out | STRING | — |
| text_out | STRING | — |