ComfyUI_NAIDGenerator

ComfyUI_NAIDGenerator
★ 96

图像生成NovelAIComfyUI扩展工作流集成
通过 NovelAI(NAI)在 ComfyUI 内生成图像的扩展节点,提供一键接入、参数控制与工作流程集成,提高生成效率与便捷性。
💡 在 ComfyUI 中调用 NovelAI 接口生成高质量图像。
🍴 20 Forks💻 Python🔄 2025-10-11
📦
网盘下载
复制链接后前往夸克网盘下载
https://pan.quark.cn/s/e00a65475347
📦 requirements.txt
python-dotenv
argon2-cffi
image
generate
image
image
Comfy_workflow
image
preview_vibe_2
image
ModelOption
preview_network
image
image
image
augment_example
📄 README

ComfyUI_NAIDGenerator

A ComfyUI extension for generating images via the NovelAI API.

Installation

  • git clone https://github.com/bedovyy/ComfyUI_NAIDGenerator into the custom_nodes directory.
  • or ‘Install via Git URL’ from Comfyui Manager
  • Setting up NAI account

    Before using the nodes, you should set NAI_ACCESS_TOKEN in a .env file located in your main ComfyUI directory.

    ComfyUI/.env

    NAI_ACCESS_TOKEN=<YOUR_ACCESS_TOKEN>

    You can get a persistent API token by navigating to User Settings > Account > Get Persistent API Token on the NovelAI website.

    Otherwise, you can get an access token which is valid for 30 days using novelai-api.

    Usage

    The nodes are located in the NovelAI category.

    Txt2img

    Simply connect the GenerateNAID node to a SaveImage node.

    Note: All generated images via the GenerateNAID node are automatically saved to output/NAI_autosave/NAI_autosave_#####_.png to preserve their original metadata.

    Img2img

    Connect an Img2ImgOptionNAID node to the option input of the GenerateNAID node and provide a source image.

    Note: The width and height of the source image will be resized to the generation size.

    Inpainting

    Connect an InpaintingOptionNAID node to the GenerateNAID node and provide a source image and a mask.

    Note: Both the source image and mask will be automatically resized to fit the generation size.

    Vibe Transfer

    Connect a VibeTransferOptionNAID node to the GenerateNAID node and provide a reference image to transfer its style and feel.

    You can also chain it with other options, like Img2Img.

    Multiple Vibe Transfer

    Connect multiple VibeTransferOptionNAID nodes to combine their influences.

    Character Reference

    Use the CharacterReferenceOptionNAID node to guide the generation using a single reference image for character identity and/or style.

  • style_aware: If enabled, it attempts to copy both the character’s features and the artistic style.
  • fidelity: Controls how strictly the generation should adhere to the reference image. The developers state that primary_strength is always kept at 1.0, while secondary_strength is calculated as $1.0 – \text{fidelity}$.
  • Note: The reference image will be automatically letterboxed to an accepted NAI canvas size to preserve its aspect ratio.

    ModelOption

    The default model of the GenerateNAID node is nai-diffusion-4-5-full. To change the model, connect a ModelOptionNAID node.

    Available V4+ models include:

  • nai-diffusion-4-curated-preview
  • nai-diffusion-4-full
  • nai-diffusion-4-5-curated
  • nai-diffusion-4-5-full
  • NetworkOption

    You can set timeout and retry options using the NetworkOption node. You can also set ignore_errors to prevent the queue from stopping on an API error; if an error occurs, a blank 1×1 image will be output.

    Note: If you set the timeout too short, you may not receive an image but could still be charged Anlas.

    Anlas Tracker

    This extension now includes Anlas tracking to monitor your usage.

    1. Console Output (Automatic)

    All generation and director tool nodes will automatically print your Anlas balance before and after the operation in the console where you launched ComfyUI.

    [NovelAI] Anlas (pre-gen): 10000
    [NovelAI] Generation cost: 20 Anlas
    [NovelAI] Anlas (post-gen): 9980

    2. Visual Node

    A new node, Anlas Tracker ✒️🅝🅐🅘, is available in the NovelAI/utils category. You can use it to display your current Anlas balance directly in your workflow.

    Connect its anlas_string output to a display node (e.g., “Show Text” from the WAS Node Suite) to see the value. Use the trigger input to control when the balance is checked.

    PromptToNAID

    ComfyUI uses () or (word:weight) for emphasis, while NovelAI uses {} and []. This node, found in NovelAI/utils, converts ComfyUI’s prompt syntax to NovelAI’s.

    Director Tools

    You can find director tools like LineArtNAID, EmotionNAID, and RemoveBGNAID in the NovelAI/director_tools category.

    V4 / V4.5 Support

    The nodes fully support NAI’s V4 and V4.5 model architecture.

    V4 Prompt Handling

    Two new nodes have been added in NovelAI/v4 for V4/V4.5 prompt handling:

  • V4BasePrompt: Handles the positive prompt.
  • V4NegativePrompt: Handles the negative prompt.
  • Example V4 / V4.5 Workflow

    Here’s a basic setup for a V4/V4.5 model:

    V4BasePrompt -----> positive
                               GenerateNAID
    V4NegativePrompt -> negative

    Note: Basic img2img, vibe transfer and inpainting functionality works with V4/V4.5.