ComfyUI Node

Prompt Converter

Converting Tags Between NAI, Pony, and Illustrious

By vkff5833·Created 2 years ago·Updated 2 years ago· 3
Prompt Converter
    • novelai3
    • ponyxl
    • animagine3.1
    • illustrious
    • animagine4.0
    text
    ratingsafe
    uniquetrue
    auto_quality_tagstrue
    remove_weightsfalse

    Every booru-tag model speaks its own dialect, and the dialects don't travel. Pony wants its incantation opener - score_9, score_8_up, score_7_up - and a rating_questionable at the end. Illustrious and Animagine want masterpiece, best_quality. NovelAI writes weights as {curly} and [square] nesting while everyone else expects (tag:1.2). Copy a prompt between them and you get mush, because a score tag is inert on an Illustrious model just as masterpiece carries almost no weight on Pony. That's the exact problem this node exists to kill: paste your tag list in once, get five model-ready strings out.

    What it does

    Prompt Converter is a pure-Python tag rewriter. Give it any comma-separated booru-style tag prompt and it returns five STRING outputs - novelai3, ponyxl, animagine3.1, illustrious, animagine4.0 - each reformatted, sorted, and quality-tagged for that specific model. No API, no key, no model downloads. It's a local dictionary transform, and the dictionary is the whole show: a ~21 MB tag_dict.json with about 147,000 Danbooru tags and 136,000 e621 tags ships with the pack.

    The mechanism is straightforward once you look. It splits on commas, parses three weight syntaxes ({tag} nesting = 1.05^n, [tag] = 0.95^n, (tag:1.2)), then re-emits each tag's weight in the syntax its target wants - NovelAI keeps brace/bracket nesting, the others get (tag:weight). Every tag gets looked up in the dictionary so it can be sorted into each model's preferred order (person → character → genre → style → …), and Pony gets its tags converted through the e621 side of the dictionary. Then it stamps on model-appropriate quality tags: the Pony output opens with score_9, score_8_up, score_7_up, best quality, source_anime, the anime outputs get masterpiece, best_quality, very_aesthetic, absurdres, and NovelAI gets none - NAI has no quality-prefix ritual, and the author knew it.

    The inputs that matter

    There are only five, and you'll touch three of them:

    • text - your tag list, comma-separated, in any supported dialect. This is a tag tool, not a sentence tool; it splits on commas and glues spaces into underscores, so natural-language prose will come out scrambled.
    • rating - safe / sensitive / questionable / explicit. It maps to each model's own rating vocabulary: Pony gets rating_safe / rating_questionable / rating_explicit, the anime models get general / sensitive / nsfw / explicit.
    • unique - dedupes duplicate tags (on by default; leave it on).
    • auto_quality_tags - on by default. Flip it off if you'd rather own your quality tags than inherit the per-model defaults.
    • remove_weights - strips all weight syntax for a clean flat prompt.

    Wire whichever output matches your checkpoint into a CLIPTextEncode - positive or negative both work. The node is marked as an output node, so it also prints its results in a preview widget if you forget to wire anything.

    Installing it

    ComfyUI Manager (search "ComfyUI-PromptConverter"), or the manual way:

    cd ComfyUI/custom_nodes
    git clone https://github.com/vkff5833/ComfyUI-PromptConverter
    

    Then restart ComfyUI. No model files to fetch, and no heavy dependencies - the whole node is standard-library Python.

    One real gotcha, straight from the repo: the README tells you to run pip install -r requirements.txt, but there is no requirements.txt in the repo, so that command just errors. You can skip it entirely. What you will pay for is the data: the clone is roughly 25 MB, almost all of it tag_dict.json and a bundled Danbooru wiki file for the UI's tag-alias feature.

    Where people get burned

    • The related-tag search stops working. The UI search (Alt + - or the search button) calls Danbooru's public API at danbooru.donmai.us, which needs internet and can rate-limit you. A dead search doesn't mean the node is broken - conversion itself is fully offline.
    • Weird backslashes. Tags containing parentheses come out escaped, like \(vampire\), on the non-NAI outputs. That's the correct Danbooru/e621 syntax for literal parens, not corruption.
    • It runs even when unwired. The node is set to always execute, so it churns on every queue run. Harmless, but worth knowing on a huge workflow.
    Categorysd

    Inputs (5)

    NameTypeDefaultDescription
    textSTRING
    ratingCOMBOsafe4 options: safe, sensitive, questionable, explicit
    uniqueBOOLEANtrue
    auto_quality_tagsBOOLEANtrue
    remove_weightsBOOLEANfalse

    Outputs (5)

    NameTypeDescription
    novelai3STRING
    ponyxlSTRING
    animagine3.1STRING
    illustriousSTRING
    animagine4.0STRING