调用顺序
所有请求使用本站 API Key。上传图片(纯文生图跳过)→ 用完整参数报价 → 带 quote_id 提交 → 保存任务 ID → 查询结果。这里没有 parameters 包装层。
curl --fail-with-body 'https://noveadream.com/v1/nai/capabilities' \
-H "Authorization: Bearer $NOVEA_API_KEY"1. 上传素材
curl --fail-with-body https://noveadream.com/v1/nai/assets \
-H "Authorization: Bearer $NOVEA_API_KEY" \
-F "file=@reference.png"使用返回的 data.id。底图与蒙版分别上传;后续请求使用同一账号拥有的资产。
2. 保存 request.json 并报价
这是完整的 V4.5 精准参考请求。把 123 换成刚上传的 data.id;纯文生图删除 references。使用 V5 时将 model_variant 设为 nai-diffusion-5-full(model 仍为 nai-v4.5;V5 同样支持最多 8 张 precise 参考,支持 costume 服装参考,strength 0–5)。
{
"model": "nai-v4.5",
"model_variant": "nai-diffusion-4-5-full",
"prompt": "watercolor, an adult traveler in a blue coat",
"negative_prompt": "lowres, blurry",
"width": 832,
"height": 1216,
"steps": 23,
"count": 1,
"seed": 42,
"guidance": 5,
"sampler": "k_euler_ancestral",
"quality_tags": false,
"references": [
{
"asset_id": 123,
"role": "precise",
"description": "character",
"strength": 1,
"fidelity": 0.7,
"information_extracted": 1
}
]
}curl --fail-with-body 'https://noveadream.com/v1/nai/estimate' \
-H "Authorization: Bearer $NOVEA_API_KEY" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H "Idempotency-Key: $REQUEST_ID" \
--data-binary @request.json响应的 data.quote_id 是报价 ID。报价会过期;改变图片或生成参数后重新报价。
3. 提交生成
保留 request.json 的全部字段,再在最外层加入 quote_id 与 client_request_id,保存为 submit.json。QUOTE_ID 换成报价返回值;client_request_id 使用自己生成的唯一字符串,同一请求重试时保持不变。
{
"model": "nai-v4.5",
"model_variant": "nai-diffusion-4-5-full",
"prompt": "watercolor, an adult traveler in a blue coat",
"negative_prompt": "lowres, blurry",
"width": 832,
"height": 1216,
"steps": 23,
"count": 1,
"seed": 42,
"guidance": 5,
"sampler": "k_euler_ancestral",
"quality_tags": false,
"references": [
{
"asset_id": 123,
"role": "precise",
"description": "character",
"strength": 1,
"fidelity": 0.7,
"information_extracted": 1
}
],
"quote_id": "QUOTE_ID",
"client_request_id": "YOUR_UNIQUE_REQUEST_ID"
}curl --fail-with-body 'https://noveadream.com/v1/nai/generations' \
-H "Authorization: Bearer $NOVEA_API_KEY" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H "Idempotency-Key: $REQUEST_ID" \
--data-binary @submit.json保存返回的 data.generation_id,作为后续 GET 查询中的 GENERATION_ID。
4. 查询或订阅同一任务
curl --fail-with-body 'https://noveadream.com/v1/nai/generations/GENERATION_ID' \
-H "Authorization: Bearer $NOVEA_API_KEY"curl -N https://noveadream.com/v1/nai/generations/GENERATION_ID/events \
-H "Authorization: Bearer $NOVEA_API_KEY"需要提交时就接收 SSE,可把第 3 步路径改成 /v1/nai/generations/stream,并加 curl -N。监听 queued、preview、done、error、keepalive;监听实时中间 preview 帧并在 done 事件读取最终结果。断线后使用已有任务 ID 重新订阅,避免重复创建新任务。