How to Check Balance
Check your WaveSpeedAI credit balance via API.
Endpoint
GET https://api.wavespeed.ai/api/v3/account/balanceRequest
curl --location --request GET 'https://api.wavespeed.ai/api/v3/account/balance' \
--header 'Authorization: Bearer ${WAVESPEED_API_KEY}'Response
{
"code": 200,
"message": "success",
"data": {
"balance": 156.78,
"currency": "USD"
}
}Response Fields
| Field | Type | Description |
|---|---|---|
balance | number | Current credit balance |
currency | string | Currency (USD) |
Python Example
import os
import requests
api_key = os.environ.get("WAVESPEED_API_KEY")
def check_balance():
response = requests.get(
"https://api.wavespeed.ai/api/v3/account/balance",
headers={"Authorization": f"Bearer {api_key}"}
)
return response.json()["data"]["balance"]
# Check balance
balance = check_balance()
print(f"Current balance: ${balance}")
# Check before expensive operation
if balance < 10:
print("Warning: Low balance, consider topping up")Use Cases
| Use Case | Description |
|---|---|
| Pre-check | Verify balance before expensive tasks |
| Monitoring | Track spending over time |
| Alerts | Notify when balance is low |
| Automation | Auto-pause when balance depleted |