Poll Status
Multimodal generation such as image and video generation usually takes time. The create-task endpoint only creates an asynchronous task; final status and results are obtained by polling.
Request
Section titled “Request”Status queries can use the status_url from the create-task response, or build the request path with BASE_URL, endpoint, and request_id.
curl -sS "${STATUS_URL}" \ "${COMMON_HEADERS[@]}"curl -sS "${BASE_URL}/v1/queue/${ENDPOINT}/requests/${REQUEST_ID}/status" \ "${COMMON_HEADERS[@]}"Response
Section titled “Response”The status query response indicates whether the task still needs to wait and provides the basis for retrieving results or handling errors.
status | Description | Recommended next step |
|---|---|---|
IN_QUEUE | The task has been submitted and is waiting to run | Continue polling |
IN_PROGRESS | The task is running | Continue polling |
COMPLETED | The task has reached a terminal state | Check whether error exists; if not, retrieve the result |
IN_QUEUE response
Section titled “IN_QUEUE response”{ "status": "IN_QUEUE", "request_id": "mmsu_01hxyz...", "queue_position": 0, "response_url": "https://.../response"}IN_PROGRESS response
Section titled “IN_PROGRESS response”{ "status": "IN_PROGRESS", "request_id": "mmsu_01hxyz...", "response_url": "https://.../response"}COMPLETED response
Section titled “COMPLETED response”COMPLETED only means the task has reached a terminal state. The response may represent either success or failure; determine success by checking whether the error field exists. Examples:
{ "status": "COMPLETED", "request_id": "mmsu_01hxyz...", "response_url": "https://.../response", "metrics": { "inference_time": 12.34 }}{ "status": "COMPLETED", "request_id": "mmsu_01hxyz...", "response_url": "https://.../response", "error": "Task execution failed", "error_type": "INFERENCE_FAILURE"}Common error_type values:
error_type | Meaning |
|---|---|
INFERENCE_FAILURE | Model execution failed |
INFERENCE_TIMEOUT | Model execution timed out |
REQUEST_INVALID | Request parameters are invalid or do not match model requirements |
CONTENT_BLOCKED | Input or output content was blocked by safety policy |
CANCELED | The task has been canceled |
INTERNAL_SERVER_ERROR | Internal server error |