TK Anima 格式化
The boring node that quietly fixes your Anima prompts
- prompt
Anima's model card has a format contract, and almost nobody follows it. Tags come in a fixed section order - [quality/meta/year/safety] [1girl/1boy] [character] [series] [artist] [general] - official examples are all space-separated rather than underscore-separated, and artist tags must carry a leading @ or, in the card's own words, the effect will be very weak. Meanwhile your WD14 tagger hands you plana_\(blue_archive\), long_hair because its default keeps underscores, and half the prompts floating around have bare (blue archive) in them, which ComfyUI's frontend reads as attention-weight syntax rather than as text.
TK Anima Formatter (AnimaTKAnimaFormatter, shown as TK Anima 格式化) is one string in, one string out, and it repairs all of that. It is the least exciting node in the pack and probably the one that changes your output the most per minute spent.
How it works
The node ships a Danbooru taxonomy built offline from the board's own API - about 693k tags across 20 categories, with official category and post count behind each lookup (data/tag_taxonomy.tsv.gz, 9.4 MB, cached to a pickle on first load). Every comma-separated piece of your input gets looked up, sorted into the Anima section order above, and emitted with a deterministic internal order inside the general block: hair, then eyes, then anatomy, clothing, action, expression, camera, background, props, unclassified. No model runs. No API is called. Same input, same output, always - which is more than you can say for the LLM prompt polishers.
Per tag it does the mechanical part: strip escaping, underscores to spaces, collapse whitespace, lowercase, then re-escape the brackets so (blue archive) survives as literal text instead of becoming a weight. Weights you wrote yourself survive the round trip - (plana (blue archive):1.1) is split, normalised, and repacked. Anima does honour prompt weighting (its card says so, and users report you just have to push the numbers harder than you would on SDXL), so keeping the weight is a feature, not legacy noise.
The other half of the node is the blank line. Everything before the first blank line is treated as tags; everything after is natural language and passes through as paragraphs. That is the same contract the pack's Danbooru Tag Getter emits, so chaining them works, and it is exactly the two-block shape Anima likes - tag block, empty line, prose.
The inputs that matter
prompt is the only required input, and it's a wired input rather than a text box (paste into an upstream text node or wire your tagger). Of the twelve optional toggles, four do the real work:
at_artist(on by default) - prepends@to tags the index files as artist tags.to_spacesandescape_brackets(both on) - leave them. The community rule on Anima is blunt: replace underscores with spaces or you get worse results, and a missing space after a comma is enough to make the model ignore a tag entirely.reorder_sections(on) - the actual value of the node. Turn it off if you're feeding something where you want your own ordering preserved.
Then the length gates: max_tags (不限制 / 20 / 30 / 40 / 60 / 80 / 120) and max_lines (不限制 / 6 / 8 / 10 / 15 / 20). These are worth using rather than ignoring. Anima was trained with random tag dropout and the card's own line is that you don't need every relevant tag; the community version is "do not use overly long sentences, be more precise." A 100-tag dump makes the model worse, not more accurate.
The rest are cases where the defaults are already right: dedupe, force_lowercase, keep_natural_language, trailing_comma, natural_separator (句号转逗号 by default - Anima prompts are comma strings and a stray full stop breaks that consistency), and merge_natural, which folds the prose into the tag string with commas instead of leaving it as a separate block.
The single output is prompt, which goes into the positive side of your text encoding, or into another text node ahead of it.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/Ararararararaki/comfyui-anima-toolkit
Restart ComfyUI afterwards - Python node changes are not picked up live. In ComfyUI Manager, search TK Toolkit (registry id anima-toolkit; the pack was renamed from "Anima Toolkit" in 2026-09, same plugin). The node lives under TK → TK/prompt.
No models to download, nothing heavy to install: the pack's real requirements are aiohttp and requests for its web panel, and this node needs neither. The one thing you do need to keep is the data/ folder - the taxonomy index comes with the repo. Copy across only the .py files and the node still runs, but every tag comes back "unclassified": no section reorder, no @. If the output looks untouched, that's the first thing to check.
Where it bites
max_tags truncates after the reorder, so what gets dropped is the tail of the sorted list (watermark and unclassified tags) rather than the last things you typed. Usually what you want; not what people expect.
The @ only lands on tags the index recognises as artist tags. A brand-new artist, a typo, or a name the board files oddly will slip through with no @ and no warning. Users found the @ trick helps on non-artist style tags too - @anime coloring is reported to hold a style more consistently than the bare tag - and this node won't do that for you; add it by hand.
force_lowercase touches tags only, never your natural-language paragraph. That matches the model card's guidance (capitalise character and series names in prose, don't capitalise booru tags), but it does mean the two halves of your prompt follow different rules.
And the blank line matters: if you paste a descriptive sentence in the same paragraph as your tags, it's treated as one more tag and gets lowercased, deduped and reclassified like one.
Last thing: the documentation is Chinese-first and there is essentially no English-language discussion of this pack anywhere, so the README and the source are your manual. For an Anima-side fix, though, the two rules it enforces are the two with the loudest community evidence behind them.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | 任意来源的标签串(WD14 / 过滤后的标签 / 手写) | |
| to_spacesopt | BOOLEAN | true | — |
| escape_bracketsopt | BOOLEAN | true | — |
| at_artistopt | BOOLEAN | true | — |
| reorder_sectionsopt | BOOLEAN | true | — |
| dedupeopt | BOOLEAN | true | — |
| max_tagsopt | COMBO | 不限制 | 8 options: , 不限制, 20, 30, 40, 60, +2 |
| max_linesopt | COMBO | 不限制 | 7 options: , 不限制, 6, 8, 10, 15, +1 |
| keep_natural_languageopt | BOOLEAN | true | — |
| trailing_commaopt | BOOLEAN | false | — |
| force_lowercaseopt | BOOLEAN | true | — |
| natural_separatoropt | COMBO | 句号转逗号 | 自然语言段的标点:Anima 提示词整体走逗号,句号会打断这个一致性 |
| merge_naturalopt | BOOLEAN | false | 开启后自然语言会与标签串合并成一条逗号连接的长提示词(不再用空行分隔) |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| prompt | STRING | — |