How to Submit Task

How to Submit Task

Submit generation tasks to WaveSpeedAI models via API.

Endpoint

POST https://api.wavespeed.ai/api/v3/{model-id}

Request Format

curl --location --request POST 'https://api.wavespeed.ai/api/v3/wavespeed-ai/flux-dev' \
--header 'Authorization: Bearer ${WAVESPEED_API_KEY}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "prompt": "A cat wearing a space suit"
}'

Headers

HeaderRequiredDescription
AuthorizationYesBearer ${WAVESPEED_API_KEY}
Content-TypeYesapplication/json

Request Body

The request body varies by model. Common parameters:

ParameterTypeDescription
promptstringText description
widthintegerOutput width
heightintegerOutput height
seedintegerRandom seed
webhook_urlstringCallback URL

Check the model’s documentation for specific parameters.

Response

{
  "code": 200,
  "message": "success",
  "data": {
    "id": "pred_abc123",
    "model": "wavespeed-ai/flux-dev",
    "status": "created",
    "urls": {
      "get": "https://api.wavespeed.ai/api/v3/predictions/pred_abc123"
    },
    "created_at": "2024-01-01T12:00:00.000Z"
  }
}

Response Fields

FieldDescription
data.idTask ID for polling
data.statusInitial status (created)
data.urls.getURL to check status

With Webhook

Receive notification when complete:

curl --location --request POST 'https://api.wavespeed.ai/api/v3/wavespeed-ai/flux-dev' \
--header 'Authorization: Bearer ${WAVESPEED_API_KEY}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "prompt": "A cat in space",
    "webhook_url": "https://your-server.com/webhook"
}'

Python Example

import os
import requests
 
api_key = os.environ.get("WAVESPEED_API_KEY")
 
response = requests.post(
    "https://api.wavespeed.ai/api/v3/wavespeed-ai/flux-dev",
    headers={
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json"
    },
    json={
        "prompt": "A cat wearing a space suit"
    }
)
 
task = response.json()["data"]
task_id = task["id"]
print(f"Task submitted: {task_id}")

Error Responses

CodeDescription
400Invalid parameters
401Invalid API key
403Account issue
429Rate limit exceeded
500Server error

Next Steps

After submitting, use How to Get Result to retrieve your output.

© 2025 WaveSpeedAI. All rights reserved.