Get Result

How to Get Result

Retrieve results from completed WaveSpeedAI tasks.

Endpoint

GET https://api.wavespeed.ai/api/v3/predictions/{task-id}

Request

curl --location --request GET 'https://api.wavespeed.ai/api/v3/predictions/pred_abc123' \
--header 'Authorization: Bearer ${WAVESPEED_API_KEY}'

Response (Processing)

{
  "code": 200,
  "message": "success",
  "data": {
    "id": "pred_abc123",
    "model": "wavespeed-ai/flux-dev",
    "status": "processing",
    "outputs": [],
    "created_at": "2024-01-01T12:00:00.000Z"
  }
}

Response (Completed)

{
  "code": 200,
  "message": "success",
  "data": {
    "id": "pred_abc123",
    "model": "wavespeed-ai/flux-dev",
    "status": "completed",
    "outputs": [
      "https://cdn.wavespeed.ai/generated/image123.png"
    ],
    "timings": {
      "inference": 2500
    },
    "created_at": "2024-01-01T12:00:00.000Z"
  }
}

Response (Failed)

{
  "code": 200,
  "message": "success",
  "data": {
    "id": "pred_abc123",
    "status": "failed",
    "error": "Error message here",
    "created_at": "2024-01-01T12:00:00.000Z"
  }
}

Status Values

StatusDescriptionAction
createdTask queuedContinue polling
processingGeneration in progressContinue polling
completedSuccessGet outputs
failedError occurredCheck error field

Task Result Polling Frequency

After submitting a task, use the result query endpoint to check task status and retrieve the final output. To keep integrations stable, avoid high-frequency polling for the same task ID.

Recommended polling intervals:

Task typeRecommended interval
Image tasksAt least 2 seconds between checks
Video tasksAt least 5 seconds between checks

For long-running tasks, use an increasing interval instead of fixed high-frequency polling. For example, check after 2 seconds, then after 5 seconds, and gradually increase the interval while the task is still created or processing.

Stop polling as soon as the task reaches a terminal status such as completed, failed, or your own timeout. The result query endpoint is intended for task status retrieval, not for millisecond-level or multiple-times-per-second probing.

Sustained high-frequency polling may trigger platform rate limiting, traffic control, or alerting. If rate limiting is triggered, requests may be rejected, responses may slow down, or result synchronization may become less stable for your application.

Polling Example

import os
import requests
import time
 
api_key = os.environ.get("WAVESPEED_API_KEY")
 
def get_result(task_id, max_wait=300):
    """Poll for result with timeout."""
    url = f"https://api.wavespeed.ai/api/v3/predictions/{task_id}"
    headers = {"Authorization": f"Bearer {api_key}"}
 
    start = time.time()
    poll_interval = 2
    max_interval = 30
 
    while time.time() - start < max_wait:
        response = requests.get(url, headers=headers)
        data = response.json()["data"]
 
        if data["status"] == "completed":
            return data["outputs"]
        elif data["status"] == "failed":
            raise Exception(data.get("error", "Unknown error"))
 
        time.sleep(poll_interval)
        poll_interval = min(max_interval, poll_interval * 1.5)
 
    raise Exception("Timeout waiting for result")
 
# Usage
outputs = get_result("pred_abc123")
print(outputs[0])

Output Fields

FieldTypeDescription
outputsarrayURLs to generated content
timings.inferenceintegerGeneration time in ms
errorstringError message (if failed)

Alternatives to Polling

© 2025 WaveSpeedAI. All rights reserved.