REST API
WaveSpeedAI provides a RESTful API for programmatic access to 700+ AI models.
Base URL
https://api.wavespeed.ai/api/v3Authentication
All requests require an API key in the Authorization header:
Authorization: Bearer ${WAVESPEED_API_KEY}Get your API key at wavespeed.ai/accesskey. Store it as an environment variable for security.
Basic Workflow
- Submit a task — Send a POST request with your parameters
- Get the task ID — Returned in the response
- Poll for results — Check status until completion
- Retrieve outputs — Get URLs to generated content
Example Request
# Submit task
curl --location --request POST 'https://api.wavespeed.ai/api/v3/wavespeed-ai/flux-dev' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer ${WAVESPEED_API_KEY}' \
--data-raw '{
"prompt": "A cat wearing a space suit"
}'
# Get result (use the task ID from response)
curl --location --request GET 'https://api.wavespeed.ai/api/v3/predictions/TASK_ID' \
--header 'Authorization: Bearer ${WAVESPEED_API_KEY}'Response Format
Task Submission Response
{
"code": 200,
"message": "success",
"data": {
"id": "task-abc123",
"status": "processing",
"urls": {
"get": "https://api.wavespeed.ai/api/v3/predictions/task-abc123"
}
}
}Task Result Response
{
"code": 200,
"message": "success",
"data": {
"id": "task-abc123",
"status": "completed",
"outputs": ["https://..."],
"timings": {
"inference": 2500
}
}
}Task Status Values
| Status | Description |
|---|---|
created | Task received |
processing | Generation in progress |
completed | Success, outputs available |
failed | Error occurred |
Error Handling
| Code | Description |
|---|---|
| 200 | Success |
| 400 | Bad request (invalid parameters) |
| 401 | Unauthorized (invalid API key) |
| 403 | Forbidden (account issue) |
| 429 | Rate limit exceeded |
| 500 | Server error |
API Reference
Model Documentation
Each model has specific parameters. See the Model Library for complete API documentation for each model.