Get Started with API
Start making API calls to WaveSpeedAI in minutes.
Step 1: Get Your API Key
- Go to API Keys
- Enter a name and click Generate
- Copy your key and save it securely

Important: API keys require a top-up to activate. Keys generated without a top-up will not work.
Step 2: Submit a Task
Send a POST request to generate content. Here’s an example using the FLUX model:
cURL
curl -X POST "https://api.wavespeed.ai/api/v3/wavespeed-ai/flux-dev" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt": "A cat wearing a space suit"}'Python
import requests
response = requests.post(
"https://api.wavespeed.ai/api/v3/wavespeed-ai/flux-dev",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
json={"prompt": "A cat wearing a space suit"}
)
data = response.json()
print(data)JavaScript
const apiKey = "YOUR_API_KEY";
fetch("https://api.wavespeed.ai/api/v3/wavespeed-ai/flux-dev", {
method: "POST",
headers: {
"Authorization": `Bearer ${apiKey}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
prompt: "A cat wearing a space suit"
})
})
.then(res => res.json())
.then(data => console.log(data));Response:
{
"code": 200,
"message": "success",
"data": {
"id": "abc123-task-id",
"status": "pending",
"urls": {
"get": "https://api.wavespeed.ai/api/v3/predictions/abc123-task-id/result"
}
}
}Save the id or urls.get — you’ll need it to retrieve your result.
Step 3: Get the Result
Poll the result URL until the task is complete:
cURL
curl "https://api.wavespeed.ai/api/v3/predictions/abc123-task-id/result" \
-H "Authorization: Bearer YOUR_API_KEY"Python
import time
import requests
task_id = "abc123-task-id" # From Step 2 response
while True:
response = requests.get(
f"https://api.wavespeed.ai/api/v3/predictions/{task_id}/result",
headers={"Authorization": "Bearer YOUR_API_KEY"}
)
data = response.json()
if data["data"]["status"] == "completed":
print("Done!", data["data"]["outputs"])
break
elif data["data"]["status"] == "failed":
print("Failed:", data["data"]["error"])
break
time.sleep(1) # Wait 1 second before checking againResponse (completed):
{
"code": 200,
"message": "success",
"data": {
"id": "abc123-task-id",
"status": "completed",
"outputs": [
"https://cdn.wavespeed.ai/outputs/image-xxxxx.png"
]
}
}The outputs array contains URLs to your generated content.
API Reference
| Item | Value |
|---|---|
| Base URL | https://api.wavespeed.ai/api/v3 |
| Auth Header | Authorization: Bearer YOUR_API_KEY |
| Content Type | application/json |
Task Status Values
| Status | Description |
|---|---|
pending | Task is queued |
processing | Task is running |
completed | Task finished successfully |
failed | Task failed (check error field) |
Next Steps
- API Authentication — Security best practices
- How to Submit Task — Detailed submission options
- How to Get Result — Polling and webhooks
- Model Library — Browse all available models