Nodes/ComfyUI_RS_NAI_API_Request/Convert Old NAI to ComfyUI
ComfyUI Node

Convert Old NAI to ComfyUI

Your old NAI prompt was ComfyUI weights all along

By raspie10032·Created about a year ago·Updated a day ago· 7
Convert Old NAI to ComfyUI
    • comfyui_prompt
    novelai_old_prompt{tag1}, [tag2], {{tag3}}, [[tag4]], tag5, {{{important tag}}}, {{misty, golden hour}}

    Every anime-era Stable Diffusion user has at least one prompt that's nothing but {tag}, [tag], {{tag}}, [[tag]]. That's old NovelAI syntax, and here's the thing nobody tells you: it's not a different language, it's just ComfyUI's (tag:weight) written in disguise. {x} is (x:1.05), [x] is (x:0.95), and stacks multiply. OldNAIToComfyUI makes that translation explicit, so every brace prompt you've hoarded can run through a local Illustrious or Pony checkpoint.

    Text node, one in, one out, no API involved.

    How it works

    The converter parses the brace/bracket syntax into the pack's shared (text, weight) tag list, then serializes it to ComfyUI weights. The parser is character-level and handles the quirks that make the old format confusing:

    • { opens a forward 1.05× scope, [ opens a forward 0.95× scope, applied to the comma-separated tags that follow until the matching close.
    • } and ] with no matching open apply their factor backward - multiplying every tag parsed so far. That's the trick that lets old prompts write tag, tag, {important} and have the weight hit both previous tags.
    • Mixed nesting multiplies: {[tag]} is 1.05 × 0.95, which normalizes to roughly neutral.

    On the way out, each tag becomes plain text at weight 1.0 or (tag:weight), with literal parentheses escaped to \( / \) so ComfyUI doesn't misread them. The artist: prefix is guarded so its colon is never treated as part of a weight.

    So {tag1}, [tag2], {{tag3}}, [[tag4]] becomes something like:

    (tag1:1.05), (tag2:0.95), (tag3:1.1), (tag4:0.9)
    

    (Weights are rounded to 2 decimals at parse time, so stacked braces land on the nearest clean power - 1.05² is 1.10, 1.05³ is 1.16.)

    Inputs and output

    • novelai_old_prompt - the brace/bracket source, multiline.
    • Output: comfyui_prompt - a weighted prompt for ComfyUI's CLIP text encode.

    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 backward-close rule is the one that surprises people. A lone } near the end of a prompt doesn't weight just the tag after it - old NovelAI semantics multiply all previously parsed tags. If the converted output looks heavier than expected, hunt for an unmatched closing brace. And remember the round-trip floor: old NAI only knows 1.05 and 0.95, so a (tag:1.4) you round-tripped through this converter will come back as (tag:1.4) only if 1.4 is a reachable power - otherwise it lands on the nearest one.

    CategoryRS_NovelAI_API/Converters

    Inputs (1)

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

    Outputs (1)

    NameTypeDescription
    comfyui_promptSTRING