On this page
Account
Usage analytics
Aggregate spend, request counts, tokens, and a per-model breakdown.
GET
/usage?days=7JWT or API keydays is clamped to 1–90 and defaults to 7. The response powers the dashboard charts and the usage page.
Response
{ "days": 7, "balance_micro": 1522976, "balance_usd": 1.522976, "totals": { "requests": 331, "prompt_tokens": 25000000, "completion_tokens": 120000, "cost_micro": 1006802, "cost_usd": 1.006802 }, "per_day": [ { "day": 1792195200, "requests": 12, "prompt_tokens": 8000, "completion_tokens": 300, "cost_micro": 14000 } ], "by_model": [ { "model": "deepseek-v4.1-flash-1017", "requests": 320, "prompt_tokens": 24000000, "completion_tokens": 100000, "cost_micro": 980000 } ]}dayis a unix timestamp at UTC midnight.cost_microalready includes the network fee.by_modelis ordered by cost and limited to the top 50 models.per_dayonly includes days with usage; zero-filled rows are a client concern.
What is not available
There is no per-request log endpoint and no per-key breakdown yet. Use the aggregates for charts and the ops CLI for request-level debugging.
Fetching usage
const usage = await fetch("https://api.relayrouter.org/usage?days=30", { headers: { authorization: `Bearer ${jwt}` },}).then((res) => res.json());
console.log(usage.totals.cost_usd);