Async Tasks
Async Tasks API
Image and video generation both go through the /v1/tasks endpoint. Video models are asynchronous (create a task to get a task_id, then poll for the result), while image models (such as wan2.6-t2i) are synchronous and return results directly without polling. Video generation usually takes 1-5 minutes.
HTTP Call Flow
1
Create a task to get task_idPOST
https://nexusflow.hk/v1/tasks2
Poll the result by task_idGET
https://nexusflow.hk/v1/tasks/{task_id}Note:
- After successful creation, query the result using the returned
id(the task_id). Do not recreate the task — just poll. - Image models (such as wan2.6-t2i) are synchronous: the create request returns results directly, no polling needed.
- For video models, poll at a recommended interval of 10-15 seconds.
- task_id queries are valid for 24 hours; after that they cannot be queried.
- Output file URLs are valid for 24 hours; download and save them immediately.
- Only image and video models support the
/v1/tasksendpoint; use/v1/chat/completionsfor chat models.
Step 1: Create a Task
Example model:
wan2.6-t2iRequest Parameters
Request Example
Step 1 Response: Get task_id
On success, task information is returned (HTTP 202); the id is the task_id used for subsequent polling.
Step 2: Poll the Result by task_id
GET
https://nexusflow.hk/v1/tasks/{task_id}Query Request
Image Task Succeeded
Task Failed
Response Parameters
List Tasks
GET
https://nexusflow.hk/v1/tasks?limit=20Retrieve the current user's recent tasks. Use the limit parameter to control the number returned (default 20, max 100).
Best Practices
Back off when polling
Poll image tasks every 5-10 seconds and video tasks every 10-15 seconds; avoid sub-second polling to reduce unnecessary requests.
Separate sync and async
Route chat requests through /v1/chat/completions and image/video through /v1/tasks to reduce interference.
Download results promptly
Output URLs are valid for 24 hours; download and save files immediately after a task completes.
Handle failure retries
When a task fails, check the error field. Fix parameter errors before retrying; for upstream timeouts, simply recreate the task.
HappyHorse API
View the dedicated HappyHorse video generation docs
Rate Limits
Limits and optimization tips for high concurrency
Full Pricing
View pricing for all models