NovelAI 接入
使用 NovelAI 图片请求格式,一次提交即可获取图片。
直接生成图片
接入地址为 https://noveadream.com,使用站内 API Key。POST /ai/generate-image 接受 input、model、action、parameters,无需先报价或传 model_variant。默认返回 ZIP;Accept: application/json 返回 images 数组中的 Base64 图片。
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模型与版本
| 模型 | model(官方格式) | 角色数上限 |
|---|---|---|
| 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 |
角色使用 parameters.v4_prompt / v4_negative_prompt 的 caption.char_captions。use_coords: false 为自动位置。提示词原样传递,不额外补质量词或负面词。
兼容范围与客户端
支持 generate、img2img、infill、角色提示词及支持模型的 Precise Reference;image 和 mask 直接传 Base64。尺寸为 64 的倍数,最多 3145728 像素、单边 3072,1–50 步、1–4 张,seed 为 0–4294967295。请求上限 40 MiB,单张参考图片上限 24 MiB、2400 万像素。
当前不支持此入口的 Vibe 编码、SMEA、ControlNet、Max Enhance、自动放大、流式响应或账号订阅模拟;启用不支持的参数会在扣费前返回 400。需要报价、资产 ID 或 SSE 恢复时,可使用下方工作台扩展接口。
支持自定义 NovelAI 地址的客户端可更换地址与 Key 后接入。SillyTavern 当前 release 源码将图片、订阅和放大地址写死在官方域名,原版不能只更换 Key;需客户端提供自定义地址支持。本服务不冒充官网订阅。
可选:工作台扩展报价
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
}'仅扩展接口使用 model: nai-v4.5 与 model_variant。保存返回的 data.quote_id,修改参数后重新报价。官方格式入口不需要这一步。
提交任务
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"
}'替换 QUOTE_ID 与 YOUR_UNIQUE_REQUEST_ID。重试同一次请求时复用 client_request_id,新的创作使用新的 ID。
