Nodes/ComfyUI_RS_NAI_API_Request/Convert Old NAI to Novel AI V4
ComfyUI Node

Convert Old NAI to Novel AI V4

Modernize your braces into NovelAI V4 scopes

By raspie10032·Created about a year ago·Updated 2 days ago· 7
Convert Old NAI to Novel AI V4
    • novelai_v4_prompt
    novelai_old_prompt{tag1}, [tag2], {{tag3}}, [[tag4]], tag5, {{{important tag}}}, {{misty, golden hour}}

    Here's the migration path a lot of NovelAI veterans need: you've got years of {tag} / [tag] prompts tuned on V3, and now you want to run them against V4 or V5, which read weights as 1.05::scoped ranges :: instead. OldNAIToNovelAIV4 upgrades old brace syntax into the numeric-scope format, so your legacy prompt library isn't stranded on the old models.

    Pure text node - one input, one output, no token, no network. The whole pack's converters share a skeleton, and this one is the nostalgia-to-modern leg of it.

    How it works

    It parses old NAI's brace/bracket syntax into the shared (text, weight) tag list, then serializes to V4 numeric scopes. The old-format parser handles the character-level rules faithfully:

    • { / [ open forward 1.05× / 0.95× scopes to the matching close.
    • An unmatched closing } / ] multiplies all previously parsed tags - that backward behavior is preserved, not guessed around.
    • Mixed nesting like {[tag]} multiplies the factors, landing at roughly neutral.

    The interesting part is the rounding. The old syntax's weights are powers of 1.05 and 0.95, and the parser rounds them to two decimals at parse time - so {{tag}} (1.05² = 1.1025) is recorded as 1.10, and {{{tag}}} (1.05³ ≈ 1.1576) as 1.16. That's a deliberate choice: it keeps the V4 output matching what the old syntax actually meant, powers and all.

    On the way out, the serializer writes numeric scopes and merges consecutive same-weight tags into one scope, so {tag1}, {tag2} becomes the more compact 1.05::tag1, tag2 :: instead of two separate scopes.

    So {tag1}, [tag2], {{tag3}} becomes:

    1.05::tag1 ::, 0.95::tag2 ::, 1.1::tag3 ::
    

    Note the advantage of the modern format showing up immediately: V4 scopes can carry negative and zero weights, which the old syntax simply couldn't express - so this direction of conversion loses nothing the source contained.

    Inputs and output

    • novelai_old_prompt - the brace/bracket source, multiline.
    • Output: novelai_v4_prompt - the numeric-scope version, ready for V4/V5.

    Install

    With ComfyUI_RS_NAI_API_Request, via 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

    Two decimal places, on purpose. The 2-decimal rounding is preserved from the old behavior so the V4 output reproduces the historical strings (1.05³ → "1.16", not "1.1576"), and merging means consecutive same-weight tags collapse into a single scope. If you expected an exact bit-for-bit weight, you won't get one - but you'll get the syntax V4 actually wants, which is the whole point.

    CategoryRS_NovelAI_API/Converters

    Inputs (1)

    NameTypeDefaultDescription
    novelai_old_promptSTRING{tag1}, [tag2], {{tag3}}, [[tag4]], tag5, {{{important tag}}}, {{misty, golden hour}}

    Outputs (1)

    NameTypeDescription
    novelai_v4_promptSTRING