Check your Algerian Dinar totals and balance through the OpenDunes API.
Every OpenDunes account holds a balance in Algerian Dinars (DA). You top it up with a CIB or Edahabia card and pay per-token as requests complete. Internally all balances are tracked in micro-DA (1 DA = 1,000,000 micro-DA) to avoid floating-point errors.
GET /v1/credits returns your lifetime DA totals — everything credited and everything spent:
import os
import httpx
headers = {"Authorization": f"Bearer {os.environ['OPENDUNES_API_KEY']}"}
resp = httpx.get("https://opendunes.com/v1/credits", headers=headers)
data = resp.json()["data"]
print(f"Into wallet: {data['total_credits']} DA")
print(f"Spent: {data['total_usage']} DA")
print(f"Remaining: {data['total_credits'] - data['total_usage']} DA")The live spendable balance also appears in the X-Balance-Available response header (in micro-DA) on every chat completion — so you can monitor it without a separate round-trip.
Fetch your daily activity — one row per day and model:
resp = httpx.get(
"https://opendunes.com/v1/activity",
headers=headers,
)
for row in resp.json()["data"]:
print(row["date"], row["model"], row["requests"], "reqs,", row["usage"], "DA")Each row includes the model slug, prompt/completion token totals, request count, and the DA amount spent. Pass ?date=YYYY-MM-DD to narrow to a single day.
Each request's cost is charged in Algerian Dinars (DA), rounded up to the nearest micro-DA (minimum 1 micro-DA). Model rates are shown in DA per million tokens in the catalog — the DA figure is the total you pay.
When your balance reaches zero, subsequent requests return HTTP 402 with error.metadata.limit_source wallet (see Errors). Top up your balance from the dashboard.