The two spending limits you can set, what a 402 and a 429 mean, and how to read your balance.
Besides your wallet, the API has two limits, both in DA. There is no cap on the number of requests: a key sends as many as it likes, and your balance is the brake.
GET /v1/key reads the key it is called with: its cap, what is left of it, and what it has spent, all in DA.
curl https://opendunes.com/v1/key \
-H "Authorization: Bearer $OPENDUNES_API_KEY"{
"data": {
"limit": 2000,
"limit_reset": "monthly",
"limit_remaining": 1240.5,
"usage": 759.5,
"usage_daily": 42.1,
"usage_weekly": 310.75,
"usage_monthly": 759.5
}
}| Field | Description |
|---|---|
limit | The key's cap in DA, or null for none |
limit_reset | daily, weekly or monthly; null for a cap that never resets |
limit_remaining | What the key may still spend before its cap, in DA; null with no cap |
usage | What the key has spent since it was created, in DA |
usage_daily · usage_weekly · usage_monthly | What it spent this day, this week (from Monday) and this month, in Algeria time |
Your wallet's balance is read with a management key at GET /v1/credits.
| Limit | Set by | When spent |
|---|---|---|
| a key's cap | you, on one key — from your dashboard or PATCH /v1/keys/{hash} | 402 on that key; your other keys keep running |
| a guardrail's budget | you, on a guardrail | 402 on every key the guardrail is assigned to |
A 402 names what stopped it in error.metadata.limit_source: wallet, key or guardrail.
{
"error": {
"code": 402,
"message": "Insufficient balance for this request.",
"metadata": {
"limit_source": "wallet",
"error_type": "payment_required"
}
}
}A 402 is not a wait-and-retry case. Deposit DA from your dashboard for wallet; raise or clear the key's cap for key; wait for the budget's reset or change the guardrail for guardrail. Then send the same request again.
A 429 comes from the provider serving the model, never from a cap of ours. It carries Retry-After — the seconds to wait — and the provider's X-RateLimit-* headers when it sent them.
HTTP/1.1 429 Too Many Requests
Retry-After: 7
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1758700000Retry-After.A 503 — no provider meets the routing you asked for — carries Retry-After too. Neither header rides a successful answer.
A billed answer that is not streamed carries X-Balance-Available: your balance after this request's charge, in micro-DA (1 DA = 1,000,000 micro-DA).
X-Balance-Available: 48320000004,832,000,000 micro-DA is 4,832 DA. A streamed answer does not carry it — its headers leave before the charge exists. Read GET /v1/key, or GET /v1/credits with a management key, instead.
Conversations on opendunes.com/chat are limited to 30 messages per minute per account. The limit is the chat's own; the API has none.