Jobs
Submit and track AI generation tasks. All job endpoints use the Standard response envelope: { code, msg, data }.
Auth: Authorization: Bearer zpk_... required on every endpoint.
POST /api/v1/jobs/createTask
Enqueue a generation task. Returns immediately with a taskId.
Supports: Idempotency-Key header (up to 128 chars).
Request body
{
"model": "wan-i2v-480p",
"input": {
"prompt": "A cat on a rooftop at sunset",
"output_format": "mp4",
"aspect_ratio": "16:9",
"images": ["https://example.com/reference.jpg"],
"videos": []
},
"callBackUrl": "https://yourapp.com/callback"
}| Field | Type | Required | Notes |
|---|---|---|---|
model | string | yes | Generation model name. |
input.prompt | string | yes | 1-5000 chars. |
input.output_format | "png" or "jpeg" or "mp4" | no | |
input.aspect_ratio | string | no | e.g. "16:9", "1:1". |
input.images | string[] (URLs) | no | Reference images. Max 16. |
input.videos | string[] (URLs) | no | Reference videos. Max 16. |
callBackUrl | string (URL) | no | Callback URL notified on completion. |
Response 200
{ "code": 200, "msg": "success", "data": { "taskId": "task_01abc..." } }Errors
| Status | Meaning |
|---|---|
400 | Validation error. |
401 | Missing or invalid API key. |
402 | Insufficient credits. |
408 | Generation service timed out -- retry. |
422 | Invalid model or input parameters. |
429 | Rate limited. Honor Retry-After header. |
GET /api/v1/jobs/recordInfo
Poll the status of a task.
Query params
| Param | Required | Notes |
|---|---|---|
taskId | yes | The taskId from createTask. |
Example
curl -s "https://nokai.studio/api/v1/jobs/recordInfo?taskId=task_01abc..." \
-H "Authorization: Bearer $NOKAI_KEY"Response 200
{
"code": 200,
"msg": "success",
"data": {
"taskId": "task_01abc...",
"model": "wan-i2v-480p",
"state": "success",
"param": "{}",
"resultJson": "{\"resultUrls\":[\"https://nokai.studio/f/Qm9XvT2sLp8Zr4Kc7Nw1Jd6Hy3Ga5Ue0Ft9Bo2Mi8Sx4Vk7Rl1Pq6Dz3Cn5Wj0Ey/output.mp4\"]}",
"failCode": null,
"failMsg": null,
"costTime": 18432,
"completeTime": 1748563200,
"createTime": 1748563182,
"updateTime": 1748563200,
"progress": 100,
"creditsConsumed": 10,
"attempts": [
{ "model": "wan-i2v-480p", "attempt": 1, "state": "success" }
]
}
}resultJson is a JSON-encoded string. Parse it to get resultUrls.
Errors
| Status | Meaning |
|---|---|
400 | Missing or invalid taskId query param. |
401 | Missing or invalid API key. |
404 | Task not found or belongs to another account. |
429 | Rate limited. |
GET /api/v1/jobs
List jobs for the calling account.
Query params
| Param | Type | Notes |
|---|---|---|
state | waiting or queuing or generating or success or fail | Filter by state. |
order | asc or desc | Default: desc (newest first). |
limit | integer 1-1000 | Default: 50. |
offset | integer >= 0 | Pagination offset. |
Response 200
{
"data": [ { "...RecordInfoData..." } ],
"total": 142,
"limit": 50,
"offset": 0
}Each item has the same shape as recordInfo data.
GET /api/v1/balance
Current credit balance.
Response 200
{
"customerId": "cust_uuid",
"balanceUsdMicro": 5000000,
"lowBalanceThresholdUsdMicro": 1000000
}balanceUsdMicro / 1_000_000 = balance in USD.
GET /api/v1/chat/credit
Balance as an integer credit count (1 credit = $0.02). Standard response envelope.
Response 200
{ "code": 200, "msg": "success", "data": 1000 }Files -- upload reference media
Upload images or videos to use as input.images[] or input.videos[]. Returns a short-lived URL.
POST /api/file-stream-upload -- multipart
curl -s https://nokai.studio/api/file-stream-upload \
-H "Authorization: Bearer $NOKAI_KEY" \
-F "file=@reference.jpg"POST /api/file-url-upload -- URL fetch
curl -s https://nokai.studio/api/file-url-upload \
-H "Authorization: Bearer $NOKAI_KEY" \
-H "Content-Type: application/json" \
-d '{ "url": "https://example.com/reference.jpg" }'POST /api/file-base64-upload -- base64
{ "base64": "<base64-string>", "mimeType": "image/jpeg" }Response 200 (all three)
{
"code": 200,
"msg": "success",
"data": {
"fileName": "reference.jpg",
"fileUrl": "https://nokai.studio/f/Hy3Ga5Ue0Ft9Bo2Mi8Sx4Vk7Rl1Pq6Dz3Cn5Wj0EyQm9XvT2sLp8Zr4Kc7Nw1Jd6/reference.png",
"downloadUrl": "https://nokai.studio/f/Hy3Ga5Ue0Ft9Bo2Mi8Sx4Vk7Rl1Pq6Dz3Cn5Wj0EyQm9XvT2sLp8Zr4Kc7Nw1Jd6/reference.png",
"mimeType": "image/jpeg",
"size": 204800,
"expiresAt": "2026-05-30T12:00:00Z"
}
}Use downloadUrl as the value in input.images[] or input.videos[].