Query daily request counts, token usage, and DA spend over time.
The activity API lets you pull usage data for your account — request volume, token counts, and DA spend — rolled up per day, model, and provider endpoint.
import os
import httpx
headers = {"Authorization": f"Bearer {os.environ['OPENDUNES_API_KEY']}"}
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")Returns the last 30 days by default. Each row contains: date, model, model_permaslug, endpoint_id, provider_name, prompt_tokens, completion_tokens, requests, and usage (DA spent).
resp = httpx.get(
"https://opendunes.com/v1/activity",
headers=headers,
params={"date": "2026-07-02"},
)The rows are already grouped per day × model, so account-level rollups are one sum() away:
rows = resp.json()["data"]
total_da = sum(r["usage"] for r in rows)
by_model = {}
for r in rows:
by_model[r["model"]] = by_model.get(r["model"], 0) + r["usage"]
print(f"Total spend: {total_da:.2f} DA")
for model, da in sorted(by_model.items(), key=lambda x: -x[1]):
print(f" {model}: {da:.4f} DA")For richer dashboards — spend over time, per-key breakdowns, request-level logs, and CSV/JSON export — use Dashboard → Analytics.