NAI Img2Img
Re-roll a local image with NovelAI's closed models
- image
- characterPrompts
- IMAGE
Same cloud-model idea as the pack's NovelAIGenerator, but with an image on the input. NAIImg2ImgNode takes an existing image, resizes it to your chosen dimensions, and sends it to NovelAI's API to be re-rendered under your prompt at a set strength. It's how you take a draft you made locally - or in another ComfyUI model - and give it a pass through NAI's V5 or V4.5.
The use cases are the familiar img2img ones, just pointed at a closed model: restyle an image you like, nudge a composition into place, or chain a local generation into NAI's tag-following for the final look. It costs Anlas per call and your source image leaves the machine, same as every node in this pack.
How it works
The node takes your IMAGE, resizes it with Lanczos to exactly your width × height, base64-encodes it, and stuffs it into the img2img request along with strength and an optional noise value. The API runs a full denoising pass over that image at the given strength and returns a ZIP-wrapped PNG, which the node unpacks, autosaves under output/<date>/NAI_autosave/ (prefixed NAI_i2i), and returns as an IMAGE.
Two details matter. First, the resize happens before the request - if you feed it a 1024×1536 image but set width/height to 832×1216, you get a 832×1216 result, not a crop and not a surprise. The defaults are the usual portrait anime dims; anything must be a multiple of 64. Second, strength is the denoise amount (0–1, default 0.5): low keeps your source nearly intact, high lets the model redraw. noise (optional, 0–1, default 0) adds extra noise before sampling, which loosens the tie to the source a bit - useful when the model clings too hard to the input.
The inputs
Required: image, prompt, negative_prompt, model (same eight-way dropdown as the generator), width/height, sampler, steps, cfg_scale, strength, seed (-1 random). Optional: scheduler (karras default), cfg_rescale, prefer_brownian, noise, variety_boost (default on; maps to skip_cfg_above_sigma for varied outputs), characterPrompts (a LIST from CharacterPromptSelect, V4/V5 only), and limit_opus_free (default True - caps pixels at 1,048,576 and steps at 28; flip to False on a paid plan).
Output is a single IMAGE.
Install
With the rest of the pack. ComfyUI Manager → Custom Nodes Manager → search ComfyUI_RS_NAI_API_Request → Install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/raspie10032/ComfyUI_RS_NAI_API_Request.git
pip install -r requirements.txt
Before any generation node runs you need a token in ComfyUI_RS_NAI_API_Request/.env:
NAI_ACCESS_TOKEN=your_token_here
(NAI_API_TOKEN works as a fallback.)
Common issues
- Image comes back at the wrong size - you set width/height wrong, or
limit_opus_freescaled them down to stay under the free-tier pixel cap. Set the dimensions you want and, on a paid account, turn the limit off. - Result is too close to / too far from the source - that's
strength, pure and simple. 0.3–0.4 for light edits, 0.6+ for a serious redraw. - 429 rate limiting - the node sleeps 60 seconds and retries once; on the free tier the caps are doing their job.
- Request rejected with no image - Anlas balance or subscription trouble; the API decides, not the node, and the error prints in the console.
One caveat: the request batching is fixed at a single sample, so run it per-image and seed-sweep outside the node if you want variations.
Inputs (18)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| 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 | — |