Docs·API reference
Usage
GET /v1/usage returns your account's requests, tokens and list-price cost per UTC day.
HTTP
GET https://platform.xerj.ai/v1/usage?start=YYYY-MM-DD&end=YYYY-MM-DD
Authorization: Bearer $XERJ_API_KEYUsage covers the whole account of the key, all keys and the playground together. The same numbers are on your Usage page.
Query #
| Name | Type | Required | Description |
|---|---|---|---|
start |
date | no | First UTC day, YYYY-MM-DD. Default: 29 days before today. |
end |
date | no | Last UTC day, YYYY-MM-DD. Default: today. |
With no query, you get the last 30 days. The longest range is 90 days.
Response #
| Field | Type | Description |
|---|---|---|
object |
string | Always "usage". |
start, end |
string | The range, as UTC days. |
data |
array | One row per day: date, requests, input_tokens, output_tokens, cost_usd. |
totals |
object | The same counts, summed over the range. |
limits |
object | requests_per_minute, input_tokens_per_day. |
today |
object | input_tokens used today and remaining_input_tokens. |
cost_usd is the list-price value of the usage: input tokens × $0.01 per 1M, output free. During the preview you are not charged.
Example #
curl
curl "https://platform.xerj.ai/v1/usage?start=2026-11-01&end=2026-11-10" \
-H "Authorization: Bearer $XERJ_API_KEY"Python
u = client.usage.retrieve(start="2026-11-01", end="2026-11-10")
print(u.totals.input_tokens, u.today.remaining_input_tokens)JavaScript
const u = await client.usage.retrieve({ start: "2026-11-01", end: "2026-11-10" });
console.log(u.totals.input_tokens, u.today.remaining_input_tokens);JSON
{
"object": "usage",
"start": "2026-11-01",
"end": "2026-11-10",
"data": [
{"date": "2026-11-09", "requests": 0, "input_tokens": 0, "output_tokens": 0, "cost_usd": 0},
{"date": "2026-11-10", "requests": 12, "input_tokens": 51234, "output_tokens": 60, "cost_usd": 0.00051234}
],
"totals": {"requests": 12, "input_tokens": 51234, "output_tokens": 60, "cost_usd": 0.00051234},
"limits": {"requests_per_minute": 60, "input_tokens_per_day": 2000000},
"today": {"input_tokens": 51234, "remaining_input_tokens": 1948766}
}data has a row for every day in the range, including days with no usage. The example shows two of them.
What is not in usage #
Usage records hold counts only: tokens, latency, endpoint and status. They never hold the text of a document, a question or an answer. See privacy and security.
Errors #
| Status | Code | When |
|---|---|---|
| 400 | invalid_date |
A date is not YYYY-MM-DD or not a real date, start is after end, or the range is longer than 90 days. |
| 401 | missing_api_key, invalid_api_key, revoked_api_key |
See errors. |