A ComfyUI extension for generating image via NovelAI API.
git clone https://github.com/bedovyy/ComfyUI_NAIDGenerator
into thecustom_nodes
directory.- or 'Install via Git URL' from Comfyui Manager
Before using the nodes, you should set NAI_ACCESS_TOKEN on ComfyUI/.env
file.
NAI_ACCESS_TOKEN=<ACCESS_TOKEN>
You can get persistent API token by User Settings > Account > Get Persistent API Token on NovelAI webpage.
Otherwise, you can get access token which is valid for 30 days using novelai-api.
The nodes are located at NovelAI
category.
Simply connect GenerateNAID
node and SaveImage
node.
Note that all generated images via GeneratedNAID
node are saved as output/NAI_autosave_12345_.png
for keeping original metadata.
Connect Img2ImgOptionNAID
node to GenerateNAID
node and put original image.
Note that width and height of the source image will be resized to generation size.
Connect InpaintingOptionNAID
node to GenerateNAID
node and put original image and mask image.
Note that both source image and mask will be resized fit to generation size.
(You don't need MaskImageToNAID
node to convert mask image to NAID mask image.)
Connect VibeTransferOptionNAID
node to GenerateNAID
node and put reference image.
You can also relay Img2ImgOption on it.
Note that width and height of the source images will be resized to generation size. This will change aspect ratio of source images.
Just connect multiple VibeTransferOptionNAID
nodes to GenerateNAID
node.
The default model of GenerateNAID
node is nai-diffusion-3
(NAI Diffusion Anime V3).
If you want to change model, put ModelOptionNAID
node to GenerateNAID
node.
You can set timeout or retry option from NetworkOption
node.
Moreover, you can ignore error by ignore_errors
. In that case, the result will be 1x1 size grayscale image.
Without this node, the request never retry and wait response forever, and stop the queue when error occurs
Note that if you set timeout too short, you may not get image but spend Anlas.
ComfyUI use ()
or (word:weight)
for emphasis, but NovelAI use {}
and []
. This node convert ComfyUI's prompt to NovelAI's.
Optionally, you can choose weight per brace. If you set weight_per_brace
to 0.10, (word:1.1)
will convert to {word}
instead of {{word}}
.
You can find director tools like LineArtNAID
or EmotionNAID
on NovelAI > director_tools.
The node now supports NAI's V4 architecture through the nai-diffusion-4-curated-preview model. This is a preview release of V4 with some limitations:
- Important Notes:
- This is a preview version of V4 and some features are limited
- Inpainting will automatically use V3 model (but works with V4-generated images)
- Vibe transfer is not yet supported with V4 preview (will be available with full V4 release)
- Full V4 feature support will come with the official V4 release
NAI Diffusion V4 Curated Preview is now available in the ModelOptionNAID node:
model = "nai-diffusion-4-curated-preview"
Two new nodes have been added for V4 prompt handling:
A node for handling V4 positive prompts:
V4BasePrompt -----> positive
GenerateNAID
A node for handling V4 negative prompts:
V4NegativePrompt -> negative
GenerateNAID
Here's a basic V4 setup:
V4BasePrompt -----> positive
V4NegativePrompt -> negative GenerateNAID
ModelOption ------> option
The following V4 features are currently in development:
"""
- V4PromptConfig: Advanced prompt configuration
- Coordinate-based prompting
- Order-based prompting
- V4CharacterCaption: Character-specific prompting with positioning
"""
Note: Basic img2img functionality works with V4 preview. For inpainting, the node will automatically use V3 model but can still work on V4-generated images. Vibe transfer will be supported once V4 fully releases.