Quickstart
Three curl commands. Five minutes. One generated video.
1. Get your API key
Sign in at nokai.studio, open API Keys -> New key, give it a name, copy the secret. It is shown once -- store it now.
export NOKAI_KEY="zpk_live_YOUR_KEY_HERE"2. Submit a generation task
curl -s https://nokai.studio/api/v1/jobs/createTask \
-H "Authorization: Bearer $NOKAI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "wan-i2v-480p",
"input": {
"prompt": "A cat sitting on a rooftop at sunset, cinematic",
"output_format": "mp4",
"aspect_ratio": "16:9"
}
}'Response:
{ "code": 200, "msg": "success", "data": { "taskId": "task_01abc..." } }Save the taskId.
3. Poll for the result
TASK_ID="task_01abc..."
curl -s "https://nokai.studio/api/v1/jobs/recordInfo?taskId=$TASK_ID" \
-H "Authorization: Bearer $NOKAI_KEY"While the job runs, state will be waiting, queuing, or generating. Keep polling every 5 seconds until state is success or fail.
Success response:
{
"code": 200,
"msg": "success",
"data": {
"taskId": "task_01abc...",
"model": "wan-i2v-480p",
"state": "success",
"resultJson": "{\"resultUrls\":[\"https://nokai.studio/f/Qm9XvT2sLp8Zr4Kc7Nw1Jd6Hy3Ga5Ue0Ft9Bo2Mi8Sx4Vk7Rl1Pq6Dz3Cn5Wj0Ey/output.mp4\"]}",
"creditsConsumed": 10,
"progress": 100,
"costTime": 18432,
"completeTime": 1748563200,
"createTime": 1748563182,
"updateTime": 1748563200,
"failCode": null,
"failMsg": null,
"param": "{}"
}
}Parse resultJson to get the output URL:
curl -s "https://nokai.studio/api/v1/jobs/recordInfo?taskId=$TASK_ID" \
-H "Authorization: Bearer $NOKAI_KEY" \
| jq -r '.data.resultJson | fromjson | .resultUrls[0]'Shell polling loop
while true; do
STATE=$(curl -s "https://nokai.studio/api/v1/jobs/recordInfo?taskId=$TASK_ID" \
-H "Authorization: Bearer $NOKAI_KEY" | jq -r '.data.state')
echo "state: $STATE"
[[ "$STATE" == "success" || "$STATE" == "fail" ]] && break
sleep 5
doneWhat just happened
POST /api/v1/jobs/createTaskenqueued the job and returned ataskIdimmediately.- The generation service picked it up, ran the model, stored the output.
GET /api/v1/jobs/recordInforeturned the final state with a URL inresultJson.
Next steps
- Webhooks -- receive job events instead of polling.
- Jobs lifecycle -- states, retries, and credits explained.
- API reference -- Jobs -- all fields and error codes.