Nodes/ComfyUI_RS_NAI_API_Request/Convert ComfyUI to Old NAI
ComfyUI Node

Convert ComfyUI to Old NAI

Take a ComfyUI prompt back to braces-and-brackets NovelAI

By raspie10032·Created about a year ago·Updated 2 days ago· 7
Convert ComfyUI to Old NAI
    • novelai_old_prompt
    comfyui_promptqw, a, (b c:1.05), d, e\(f: g h\), black bikini top, denim shorts, shorts under bikini bottom, (i j:1.2)

    Long before NovelAI moved to 1.2::weighted scopes, its models used the brace-and-bracket convention: {tag} to push a tag up about 1.05×, [tag] to push it down about 0.95×. Old habits die hard, and old prompts die harder - there are still libraries of {masterpiece}, best quality, [monochrome]-style prompts floating around, and V3-era NovelAI users who never left. If you have a weighted ComfyUI prompt you want to run against one of those older models, ComfyUIToOldNAI is the converter that speaks their language.

    It's a pure text node: one input, one output, no API call, no token. You feed it a ComfyUI prompt with (word:1.1) weights, and it hands back the nearest old-NovelAI equivalent built from { and [ stacking.

    How it works

    Same shared machinery as the pack's other converters - parse ComfyUI into a list of (text, weight) pairs (commas are tag separators, (...) levels multiply by 1.1, explicit (...:w) by w, escaped \( / \) stay literal), then serialize to the old syntax.

    The serialization is where the honest limitations live. Old NovelAI weights are powers of 1.05 (up) and 0.95 (down), so the converter finds the nearest integer exponent for each weight: (tag:1.1) becomes {tag}, (tag:1.21) becomes {{tag}}, and (tag:0.9) becomes [tag]. Two things follow:

    • Merging. Consecutive tags with the same bracketing collapse into one scope, so {tag1}, {tag2} comes out as {tag1, tag2} - the same compaction the V4 converter does, just in braces.
    • The hard limits. Old NAI cannot represent negative weights, zero weights, or arbitrary decimals exactly. Negative or zero weight falls back to [text] (the 0.95 default decrease) with a warning printed to the console. It's the best the format can do, and it's why the pack ships a separate V4 converter for prompts that need the precision.

    Inputs and output

    • comfyui_prompt - your weighted source prompt, multiline.
    • Output: novelai_old_prompt - the brace/bracket version, ready to paste into an old-NovelAI prompt box.

    Install

    Part of ComfyUI_RS_NAI_API_Request. Easiest through ComfyUI Manager (search the pack title) or:

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

    Restart after installing. No token needed.

    Gotchas

    Don't expect a perfect round trip. ComfyUI can express (tag:1.33), old NAI can only say "about 1.30" (1.05^6 ≈ 1.34 → {×6... close), and anything negative gets flattened to a plain 0.95. If you're targeting V4 or V5, use the V4 converter instead and keep this one for the V3/Furry-V3 models, where the brace syntax is actually what the model understands.

    CategoryRS_NovelAI_API/Converters

    Inputs (1)

    NameTypeDefaultDescription
    comfyui_promptSTRINGqw, a, (b c:1.05), d, e\(f: g h\), black bikini top, denim shorts, shorts under bikini bottom, (i j:1.2)

    Outputs (1)

    NameTypeDescription
    novelai_old_promptSTRING