Image Generation
Novel AI async image generation endpoint
The Novel AI image generation endpoint (focused on anime-style text-to-image). Submits a generation task from a prompt. The interface is async: on success it returns an image.task object; poll the Query Result endpoint with the returned task ID until status becomes completed to fetch the final image.
Billing model
This endpoint is billed under the model specified by the model field (nai-diffusion-4-5-full / nai-diffusion-4-5-curated), and the fee is deducted from your account balance.
Async flow
POST /v1/images/async/generationssubmits the task and returnstask_id(prefixed withtask_) andstatus=queued/in_progress;- Poll
GET /v1/images/async/generations/{task_id}with thattask_id; - When
status=completed, thedataarray contains the final image URL (urlfield); whenfailed,errorexplains why.
Images are kept for about 2 hours
The returned image URL is temporary (metadata.assetsExpireAt holds the expiry time in Unix seconds); images are kept for about 2 hours and then deleted automatically. Download them before they expire if you need long-term storage.
Authorization
BearerAuth
使用 Bearer Token 认证。
格式: Authorization: Bearer sk-xxxxxx
令牌需开通对应模型的调用权限。
In: header
Request Body
application/json
模型名称,可选:nai-diffusion-4-5-full、nai-diffusion-4-5-curated
提示词,描述希望生成的图片内容
生成数量(1-4),默认 1
1 <= value <= 4输出尺寸(像素,OpenAI 风格 宽x高),例如 1024x1024、竖版 832x1216、横版 1216x832。不传默认 1024x1024
Response Body
application/json
application/json
application/json
curl -X POST "https://www.omwai.xyz/v1/images/async/generations" \ -H "Content-Type: application/json" \ -d '{ "model": "nai-diffusion-4-5-curated", "prompt": "1girl, professional office lady, warm smile, masterpiece, best quality", "size": "832x1216", "n": 1 }'{
"id": "task_01J8ABCDEFGHIJKLMNOPQRST",
"task_id": "task_01J8ABCDEFGHIJKLMNOPQRST",
"object": "image.task",
"model": "nai-diffusion-4-5-curated",
"status": "queued",
"progress": "20%",
"created_at": 1788256630,
"completed_at": 1788256720
}{
"code": "invalid_request",
"message": "string"
}{
"code": "string",
"message": "string"
}Note
A successful submission (HTTP 200) only means the task was accepted, not that the image is ready. Always poll the query endpoint until status=completed.
How is this guide?
Last updated on