NAI Inpaint
Inpaint through NovelAI with a plain ComfyUI mask
- image
- mask
- characterPrompts
- IMAGE
Every ComfyUI user knows the inpainting loop: paint a mask over the broken bit, re-render just that region, done. NAIInpaintNode is that same loop pointed at NovelAI's cloud models - you feed it an image and a standard MASK (white = repaint), and it ships the masked image to NAI's inpainting endpoint and returns the result as an IMAGE.
Reach for it when the thing you're fixing would look better with NAI's model doing the repaint than your local checkpoint. The canonical case is exactly the one the masking doc hammers: a face or hand that came out mangled at small size, or an object you want to swap out. It's also what the pack's own Face Detailer leans on internally, so if you've used that, you've already used this.
How it works
The node takes your image and mask, snaps width/height down to multiples of 64, resizes both (the image with Lanczos, the mask with nearest-neighbor so edges stay hard), base64-encodes them, and sends an infill request. The strength input maps to NovelAI's inpaintImg2ImgStrength - the denoise applied inside the mask region. The response is a ZIP-wrapped PNG, autosaved under output/<date>/NAI_autosave/ (prefix NAI_inpaint), and returned as an IMAGE.
The model handling has one genuinely useful quirk. V5 Full uses its native V5 inpainting model, but V5 Curated's inpainting variant isn't released yet, so selecting V5 Curated silently falls back to the V4.5 Curated inpainting model - which is exactly what NovelAI's own client does. So you can pick V5 Curated for generation and still get working inpaint behavior; it's just V4.5 under the hood until NAI ships the real thing.
The inputs
Required: image, mask (white = repaint), prompt, negative_prompt, model, width/height, sampler, steps, cfg_scale, strength, seed. Optional: scheduler, cfg_rescale, prefer_brownian, noise (extra noise before sampling), variety_boost (default on), characterPrompts (a CharacterPromptSelect list, V4/V5 only), and limit_opus_free (default True; flip to False on a paid plan).
The two you'll actually tune are strength and the mask. Start around 0.5; if the repainted patch doesn't blend, drop it toward 0.3–0.4. The noise input is your escape hatch when the model reproduces the masked area too literally.
Output is a single IMAGE.
Install
Part of ComfyUI_RS_NAI_API_Request. ComfyUI Manager (search the pack title) → Install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/raspie10032/ComfyUI_RS_NAI_API_Request.git
pip install -r requirements.txt
Token required before any generation node runs - a .env in the node directory with NAI_ACCESS_TOKEN=... (or NAI_API_TOKEN).
Common issues
- Nothing happens around the mask - mask convention. White = repaint. If you fed it a black-on-white mask from a node that uses the opposite convention, flip it.
- Result is the wrong size - dims snap to 64 and
limit_opus_freecan scale them down further. On a paid account turn the limit off. - Patch edges show - inpainting seam, not a bug. Drop
strength, and feather/pad the mask before it hits this node; the mask is resized nearest-neighbor, so it has no softening of its own. - 429 or rejected request - rate limit (node sleeps 60s and retries once) or Anlas/subscription trouble; the API decides, the console shows the error.
Worth saying plainly: every inpaint call costs Anlas, and your source image goes to NovelAI's servers. For one-off fixes that's a fair price; for batch repair at volume, a local inpainting model is still the cheaper, more private default.
Inputs (19)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| mask | MASK | — | |
| prompt | STRING | prompt here | — |
| negative_prompt | STRING | lowres, bad anatomy | — |
| model | COMBO | NAI Diffusion V5 Curated | 8 options: NAI Diffusion V5 Curated, NAI Diffusion V5 Full, NAI Diffusion V4.5 Curated, NAI Diffusion V4.5 Full, NAI Diffusion V4 Full, NAI Diffusion V4 Curated Preview, +2 |
| width | INT | 83264–4096 | — |
| height | INT | 121664–4096 | — |
| sampler | COMBO | k_euler | 7 options: k_dpmpp_2m, k_dpmpp_sde, k_dpmpp_2m_sde, k_dpmpp_2s_ancestral, k_euler_ancestral, k_euler, +1 |
| steps | INT | 281–50 | — |
| cfg_scale | FLOAT | 6.00–30 | — |
| strength | FLOAT | 0.500–1 | — |
| seed | INT | -1-1–4294967295 | — |
| scheduleropt | COMBO | karras | 4 options: native, karras, exponential, polyexponential |
| cfg_rescaleopt | FLOAT | 0.000–1 | — |
| prefer_brownianopt | BOOLEAN | false | — |
| noiseopt | FLOAT | 0.000–1 | — |
| variety_boostopt | BOOLEAN | true | — |
| characterPromptsopt | LIST | — | |
| limit_opus_freeopt | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |