How to Check Usage
Monitor your WaveSpeedAI API usage via API.
Endpoint
GET https://api.wavespeed.ai/api/v3/account/usageRequest
curl --location --request GET 'https://api.wavespeed.ai/api/v3/account/usage' \
--header 'Authorization: Bearer ${WAVESPEED_API_KEY}'Response
{
"code": 200,
"message": "success",
"data": {
"period": "2024-01",
"total_requests": 1250,
"total_cost": 45.67,
"by_model": [
{
"model": "wavespeed-ai/flux-dev",
"requests": 500,
"cost": 15.00
},
{
"model": "google/veo3",
"requests": 100,
"cost": 25.00
}
]
}
}Response Fields
| Field | Type | Description |
|---|---|---|
period | string | Billing period |
total_requests | integer | Total API calls |
total_cost | number | Total spending |
by_model | array | Breakdown by model |
Query Parameters
| Parameter | Description | Example |
|---|---|---|
start_date | Start of period | 2024-01-01 |
end_date | End of period | 2024-01-31 |
model | Filter by model | wavespeed-ai/flux-dev |
Example: Date Range
curl --location --request GET 'https://api.wavespeed.ai/api/v3/account/usage?start_date=2024-01-01&end_date=2024-01-31' \
--header 'Authorization: Bearer ${WAVESPEED_API_KEY}'Python Example
import os
import requests
api_key = os.environ.get("WAVESPEED_API_KEY")
def get_usage(start_date=None, end_date=None):
url = "https://api.wavespeed.ai/api/v3/account/usage"
params = {}
if start_date:
params["start_date"] = start_date
if end_date:
params["end_date"] = end_date
response = requests.get(
url,
headers={"Authorization": f"Bearer {api_key}"},
params=params
)
return response.json()["data"]
# Get current month usage
usage = get_usage()
print(f"Total requests: {usage['total_requests']}")
print(f"Total cost: ${usage['total_cost']}")
# Show top models
for model in usage["by_model"][:5]:
print(f"- {model['model']}: {model['requests']} requests, ${model['cost']}")Use Cases
| Use Case | Implementation |
|---|---|
| Cost tracking | Monitor spending by model |
| Optimization | Identify expensive operations |
| Reporting | Generate usage reports |
| Budgeting | Plan based on usage patterns |