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

Convert Novel AI V4 to ComfyUI

Decode NovelAI's numeric scopes into ComfyUI weights

By raspie10032·Created about a year ago·Updated a day ago· 7
Convert Novel AI V4 to ComfyUI
    • comfyui_prompt
    novelai_promptqw, a, 1.05::b c::, d, e(f: g h), black bikini top, -1.5::negative example::, shorts under bikini bottom, 1.2::i j::

    The flip side of the pack's ComfyUI→V4 converter. NovelAI V4 and V5 write weights as 1.2::scoped ranges ::, which is meaningful to NovelAI and meaningless to ComfyUI's (word:1.2) format. NovelAIV4ToComfyUI reads a NovelAI V4 numeric-scope prompt and emits the equivalent ComfyUI weighted prompt, so you can take a prompt that worked in a NAI client and reuse it against your local models.

    It's the same one-in, one-out text-node shape as its siblings: no API calls, no token, no GPU. Paste a NAI prompt in, get a ComfyUI prompt out.

    How it works

    The converter parses V4 scope syntax into the pack's shared (text, weight) tag list, then serializes that list to ComfyUI. The V4 parser follows the rules that make the syntax ambiguous in exactly one direction:

    • 1.3::tag1, tag2 :: opens a numeric scope that applies 1.3 to both tag1 and tag2, and the closing :: ends it after that comma-separated group.
    • An opened scope with no closing :: (1.3::tag1, tag2, tag3) applies forward to everything after it - so watch your commas.
    • A closing :: with nothing opened just resets to the default weight.

    That forward-scope behavior is the thing most likely to surprise you, because it means 1.3::tag1, tag2 (no close) weights more than you might think. The parser is also strict about the number format: a malformed token like 1.2.3 isn't half-parsed, it's rejected.

    On the way out, each tag becomes either plain text (weight 1.0) or (text:weight) - and any literal parentheses in the text get escaped to \( / \) so ComfyUI doesn't read them as weight groups. The artist: prefix is guarded through the whole trip so its colon never gets eaten as a weight marker.

    So 1.05::b, c ::, d, -1.5::negative example :: comes back as:

    (b:1.05), (c:1.05), d, (negative example:-1.5)
    

    The negative weight survives intact - ComfyUI can represent it, which is one of the reasons people move NAI V4 prompts back into local SDXL/Illustrious workflows at all.

    Inputs and output

    • novelai_prompt - the V4 numeric-scope source, multiline.
    • Output: comfyui_prompt - a weighted prompt ready for a ComfyUI CLIP text encode node.

    Install

    With the pack, via ComfyUI Manager (search ComfyUI_RS_NAI_API_Request) 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, works offline.

    Gotchas

    The forward-scope rule, again - if a NAI prompt relies on an unclosed scope bleeding forward over a long list, the converter faithfully reproduces that weight on every following tag. That's correct behavior, but if the output looks over-weighted, an unclosed scope is almost always why. And remember ComfyUI weight ranges: values outside the −5…5 band are clamped to the 1.1 default with a console warning, though real prompts rarely hit that.

    CategoryRS_NovelAI_API/Converters

    Inputs (1)

    NameTypeDefaultDescription
    novelai_promptSTRINGqw, a, 1.05::b c::, d, e(f: g h), black bikini top, -1.5::negative example::, shorts under bikini bottom, 1.2::i j::

    Outputs (1)

    NameTypeDescription
    comfyui_promptSTRING