Some models (bailian) process generation asynchronously. When you pass task: true, you get back a task_id — poll the task endpoint to check when it's done.
Check a task
curl https://51kik.com/v1/image/v1/tasks/abc123-task-id \
-H 'Authorization: Bearer sk-xxxxxxxx'
Status values
| Status | Meaning | What to do |
|---|---|---|
pending / running | Still processing | Keep polling |
success | Done | Read data for your images |
failed | Something went wrong | Read error for details |
Success response
{
"task_id": "abc123-task-id",
"task_status": "success",
"model": "wanx-v1",
"created": 1719000000,
"updated": 1719000020,
"completed": 1719000020,
"data": [{ "url": "https://..." }],
"error": null
}
Failure response
{
"task_id": "abc123-task-id",
"task_status": "failed",
"model": "wanx-v1",
"created": 1719000000,
"data": [],
"error": { "code": "task_failed", "message": "..." }
}
Using the SDK (recommended)
The SDK handles polling for you:
const result = await rb.image({
model: 'wanx-v1',
prompt: 'a panoramic mountain landscape',
}).task({ pollInterval: 2000 });
See SDK image generation for details on timeout cancellation.
Tips
- Poll every 2-5 seconds
- Don't combine
task: truewithstream: true— pick one - Set a timeout so polling doesn't run forever