Skip to content
会nokai.studio

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"
}
FieldTypeRequiredNotes
modelstringyesGeneration model name.
input.promptstringyes1-5000 chars.
input.output_format"png" or "jpeg" or "mp4"no
input.aspect_ratiostringnoe.g. "16:9", "1:1".
input.imagesstring[] (URLs)noReference images. Max 16.
input.videosstring[] (URLs)noReference videos. Max 16.
callBackUrlstring (URL)noCallback URL notified on completion.

Response 200

{ "code": 200, "msg": "success", "data": { "taskId": "task_01abc..." } }

Errors

StatusMeaning
400Validation error.
401Missing or invalid API key.
402Insufficient credits.
408Generation service timed out -- retry.
422Invalid model or input parameters.
429Rate limited. Honor Retry-After header.

GET /api/v1/jobs/recordInfo

Poll the status of a task.

Query params

ParamRequiredNotes
taskIdyesThe 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

StatusMeaning
400Missing or invalid taskId query param.
401Missing or invalid API key.
404Task not found or belongs to another account.
429Rate limited.

GET /api/v1/jobs

List jobs for the calling account.

Query params

ParamTypeNotes
statewaiting or queuing or generating or success or failFilter by state.
orderasc or descDefault: desc (newest first).
limitinteger 1-1000Default: 50.
offsetinteger >= 0Pagination 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[].