NAI Img2Img
Re-roll a local image with NovelAI's closed models
- image
- characterPrompts
- vibes
- references
- nai_context
- image
- nai_context
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 (38)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| prompt | STRING | prompt here | — |
| negative_prompt | STRING | lowres, bad anatomy | — |
| model | COMBO | NAI Diffusion V5 Curated | V5 Full Medium Effort always uses 14 steps, Euler Ancestral, zero CFG Rescale, and fixed Heavy Undesired Content. Custom base/character negative prompts are ignored. Prompt Guidance remains adjustable. Image-to-image and inpainting require limit_opus_free=False and can spend Anlas. |
| 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 | V5: up to 22 active character prompts; V4/V4.5: up to 6. V5 Curated inpainting uses V4.5 (6). | |
| limit_opus_freeopt | BOOLEAN | true | — |
| vibesopt | RS_NAI_VIBES | — | |
| referencesopt | RS_NAI_REFERENCES | — | |
| normalize_vibe_strengthsopt | BOOLEAN | true | V4/V4.5 Vibe: scale strengths down if their absolute sum exceeds 1.0. |
| save_formatopt | COMBO | PNG | Autosave format. Preserves NovelAI generation information. No ComfyUI workflow is embedded. |
| webp_qualityopt | INT | 901–100 | Used only for lossy WebP. Lossless WebP preserves pixels. |
| nai_contextopt | NAI_CONTEXT | Connect the previous NAI generation context. Carries prompts, characters and generation settings; seed, size, strength, references and Anlas protection stay local. | |
| request_delay_secondsopt | FLOAT | 0.00–3600 | Wait before each NovelAI request, including each detail region and uncached Vibe encoding. 0 adds no delay. The built-in 2-second gap overlaps this timer; a longer server retry wait still applies. Preview-only runs do not wait. Stop cancels the countdown. |
| use_context_settingsopt | BOOLEAN | true | Use connected prompts, characters, model and sampling settings. Turn off to use this node's manual values. Seed always uses this node's setting. |
| context_modeopt | COMBO | inherit_all | With context enabled, inherit everything or replace only checked fields with this node's values. Unchecked fields still come from context. |
| override_promptopt | BOOLEAN | false | Use this node's prompt in override_selected mode. An empty string, zero or False is an intentional replacement. |
| override_negative_promptopt | BOOLEAN | false | Use this node's negative_prompt in override_selected mode. An empty string, zero or False is an intentional replacement. |
| override_modelopt | BOOLEAN | false | Use this node's model in override_selected mode. An empty string, zero or False is an intentional replacement. |
| override_sampleropt | BOOLEAN | false | Use this node's sampler in override_selected mode. An empty string, zero or False is an intentional replacement. |
| override_stepsopt | BOOLEAN | false | Use this node's steps in override_selected mode. An empty string, zero or False is an intentional replacement. |
| override_cfg_scaleopt | BOOLEAN | false | Use this node's cfg_scale in override_selected mode. An empty string, zero or False is an intentional replacement. |
| override_scheduleropt | BOOLEAN | false | Use this node's scheduler in override_selected mode. An empty string, zero or False is an intentional replacement. |
| override_cfg_rescaleopt | BOOLEAN | false | Use this node's cfg_rescale in override_selected mode. An empty string, zero or False is an intentional replacement. |
| override_prefer_brownianopt | BOOLEAN | false | Use this node's prefer_brownian in override_selected mode. An empty string, zero or False is an intentional replacement. |
| override_variety_boostopt | BOOLEAN | false | Use this node's variety_boost in override_selected mode. An empty string, zero or False is an intentional replacement. |
| override_characterPromptsopt | BOOLEAN | false | Replace the complete character list with characterPrompts, including negatives and positions. No connection clears the list. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| nai_context | NAI_CONTEXT | — |