# NovelAI integration

Use the NovelAI image request format and receive images in one request.

## Generate images directly

Use https://noveadream.com and your site API key. POST /ai/generate-image accepts input, model, action and parameters. No quote or model_variant is required. The default response is ZIP; Accept: application/json returns Base64 images in an images array.

```bash
curl --fail-with-body 'https://noveadream.com/ai/generate-image' \
  -H "Authorization: Bearer $NOVEA_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "input": "watercolor, a quiet garden",
  "model": "nai-diffusion-5-full",
  "action": "generate",
  "parameters": {
    "width": 1024,
    "height": 1024,
    "steps": 23,
    "n_samples": 1,
    "scale": 5,
    "seed": 42,
    "sampler": "k_euler_ancestral",
    "negative_prompt": ""
  }
}' --output images.zip
```

## Models & variants

| Model | model (native format) | Max characters |
| --- | --- | --- |
| NAI V4.5 Full | nai-diffusion-4-5-full | 6 |
| NAI V4.5 Curated | nai-diffusion-4-5-curated | 6 |
| NAI V5 Full | nai-diffusion-5-full | 32 |
| NAI V4 Full | nai-diffusion-4-full | 6 |
| NAI V4 Curated | nai-diffusion-4-curated-preview | 6 |
| NAI Anime V3 / Furry V3 | nai-diffusion-3 / nai-diffusion-furry-3 | 0 |

Characters use caption.char_captions inside parameters.v4_prompt / v4_negative_prompt. use_coords: false enables automatic positioning. Prompts are preserved without appending quality or negative tags.

## Compatibility & clients

Supports generate, img2img, infill, character prompts and Precise Reference for supported models. Send image and mask as Base64. Dimensions must be multiples of 64, at most 3145728 pixels and 3072 per side; 1–50 steps, 1–4 samples, seed 0–4294967295. Requests are limited to 40 MiB; each reference image to 24 MiB and 24 megapixels.

This endpoint does not currently support encoded Vibes, SMEA, ControlNet, Max Enhance, automatic upscaling, streaming or subscription emulation. Unsupported active parameters return 400 before charging. Use the workbench extensions below for quotes, asset IDs or SSE recovery.

Clients with a configurable NovelAI URL can use this base URL and key. Current SillyTavern release source hardcodes official image, subscription and upscale hosts: changing only the key cannot redirect it. Custom endpoint support is required in the client; this service does not impersonate an official subscription.

## Optional: workbench quote extension

```bash
curl --fail-with-body 'https://noveadream.com/v1/nai/estimate' \
  -H "Authorization: Bearer $NOVEA_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "nai-v4.5",
  "model_variant": "nai-diffusion-4-5-full",
  "prompt": "a quiet garden, watercolor, soft lighting",
  "negative_prompt": "lowres, blurry",
  "width": 1024,
  "height": 1024,
  "steps": 28,
  "count": 1
}'
```

Only this extension uses model: nai-v4.5 plus model_variant. Save data.quote_id and request a new quote after changing parameters. The native endpoint does not require this step.

## Submit a task

```bash
curl --fail-with-body 'https://noveadream.com/v1/nai/generations' \
  -H "Authorization: Bearer $NOVEA_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "nai-v4.5",
  "model_variant": "nai-diffusion-4-5-full",
  "prompt": "a quiet garden, watercolor, soft lighting",
  "negative_prompt": "lowres, blurry",
  "width": 1024,
  "height": 1024,
  "steps": 28,
  "count": 1,
  "quote_id": "QUOTE_ID",
  "client_request_id": "YOUR_UNIQUE_REQUEST_ID"
}'
```

Replace QUOTE_ID and YOUR_UNIQUE_REQUEST_ID. Keep client_request_id for a retry of the same request; create a new ID for a new image.
