Nodes/RS NAI API Request Editable/NAI Metadata Prompt Loader
ComfyUI Node

NAI Metadata Prompt Loader

Your NovelAI image is a save file — this node reopens it

By omoitukahen·Created 23 days ago·Updated 22 days ago· 1
NAI Metadata Prompt Loader
    • prompt
    • negative_prompt
    • characterPrompts
    • character_prompts_json
    • generationSettings
    image
    prompt_edit
    negative_prompt_edit
    character_prompts_edit_json{"use_coords":true,"use_order":true,"characters":[]}
    metadata_source_image
    metadata_source_sha256

    If you've ever stared at an old NovelAI generation and thought "that prompt was so close, I just want to nudge it and rerun" - this is the node for you. NAI Metadata Prompt Loader (from the ComfyUI_RS_NAI_API_Request_Editable pack) reads the generation settings NovelAI bakes into its PNGs and WebPs, hands them back to the pack's generator, and lets you edit them before regenerating. And unlike most of this pack, it doesn't touch the API at all: parsing is offline and read-only. No token, no Anlas, nothing.

    NovelAI images are unusual in that they carry the whole generation as a payload inside the file - prompt, negative prompt, per-character prompts with coordinates, seed, sampler, CFG, resolution, scheduler. In A1111 you'd hit PNG Info and be done. The catch is NovelAI's format is deliberately exotic: PNGs use a hidden stealth_pngcomp chunk (with plain PNG text as fallback), and WebPs keep their data in the EXIF UserComment. Generic metadata parsers choke on it, and ComfyUI's own drag-in only understands its own workflow graphs. This loader is effectively NovelAI's missing PNG Info tab.

    How it works

    You drop a NovelAI PNG or WebP into ComfyUI's input folder, pick it in the image upload field, and the node does its thing: reads the metadata, fills the editable prompt fields, and reconstructs the character list - including those spatial multi-character prompts V4/V5 use, where each character gets x/y coordinates on a 0–10 grid. That part matters more than it sounds. NAI's coordinate-based multi-character prompting is its own flavor of regional prompting, and it's basically impossible to recreate by hand; the loader recovers it intact.

    The node is deliberately picky about what it reads. JPEG, A1111 parameters blocks, Stable Diffusion metadata, and ComfyUI prompt graphs are all rejected outright - only genuine NovelAI PNG/WebP passes.

    Two inputs do the subtle work here:

    • prompt_edit and negative_prompt_edit - the editable global prompts, kept byte-for-byte (no "normalization" mangling your tags).
    • character_prompts_edit_json - the JSON editor for characters, defaulting to {"use_coords":true,"use_order":true,"characters":[]}.

    The loader tracks whether your edits are still "current" by hashing the source file. Swap the image and it re-imports; keep it and your edits win. A "Reload metadata" action discards edits and restores the file's values.

    What comes out the other side

    Five outputs, but you'll mostly use three:

    • prompt and negative_prompt - wire straight into NAI Image Generator.prompt / .negative_prompt.
    • characterPrompts (LIST) - connect to NovelAIGenerator.characterPrompts.
    • generationSettings - an NAI_GENERATION_SETTINGS bundle (width, height, seed, sampler, steps, CFG, scheduler, coordinate flags, model when it can be determined). Feed it into the generator's metadataSettings input; connected values override the corresponding widgets. character_prompts_json is just the inspection dump.

    Installing it

    Install the whole pack - the loader ships with it:

    cd ComfyUI/custom_nodes
    git clone https://github.com/omoitukahen/ComfyUI_RS_NAI_API_Request_Editable.git
    cd ComfyUI_RS_NAI_API_Request_Editable
    python -m pip install -r requirements.txt
    

    Then restart ComfyUI. Or, if you use ComfyUI Manager, search "RS NAI API Request Editable" and hit install. The pack's other nodes need a NovelAI API token in a .env (NAI_ACCESS_TOKEN=...), and the Face Detailer pulls in heavy deps (SAM, Impact-Pack) - none of that applies to this loader. It's the one node in the pack you can use with zero configuration.

    Gotchas

    • The image has to live in ComfyUI's input folder - drag or upload it there before selecting it.
    • Re-encoded images lose the data. Screenshots, JPEG re-saves, and files bounced through Discord or Reddit have had their metadata stripped or converted, and the loader will either reject them or come up empty. Treat your PNGs like source code, because they are.
    • V5 Full vs. Curated isn't always distinguishable from the file, so the generator keeps whatever model you currently have selected and shows a warning. Check it before you hit generate.
    • It reads NovelAI metadata, not a ComfyUI workflow. If the image was generated in ComfyUI, this node won't rebuild that graph - that's a different loader's job.
    CategoryRS_NovelAI_API/Metadata

    Inputs (6)

    NameTypeDefaultDescription
    imageCOMBO1 options: example.png
    prompt_editoptSTRING
    negative_prompt_editoptSTRING
    character_prompts_edit_jsonoptSTRING{"use_coords":true,"use_order":true,"characters":[]}
    metadata_source_imageoptSTRING
    metadata_source_sha256optSTRING

    Outputs (5)

    NameTypeDescription
    promptSTRING
    negative_promptSTRING
    characterPromptsLIST
    character_prompts_jsonSTRING
    generationSettingsNAI_GENERATION_SETTINGS