Usage API is a Guard extension for monitoring your own key. It shows balance, aggregates and request history for Claude, Kimi, Composer and Grok, including free token counting where supported. It is not the Anthropic organization Admin API and does not grant access to other keys.
| Parameter | Rule |
|---|---|
starting_at | RFC 3339 window start; defaults to 30 days before ending_at |
ending_at | Exclusive RFC 3339 upper bound; defaults to the start of tomorrow UTC |
bucket_width | Only 1d |
curl -G https://api.guardrelay.ai/v1/usage \
-H "x-api-key: $GUARD_API_KEY" \
--data-urlencode "starting_at=2026-07-01T00:00:00Z" \
--data-urlencode "ending_at=2026-07-08T00:00:00Z" \
--data-urlencode "bucket_width=1d"{
"object": "usage_report",
"starting_at": "2026-07-01T00:00:00.000Z",
"ending_at": "2026-07-08T00:00:00.000Z",
"bucket_width": "1d",
"current_balance": {
"scope": "key_including_inflight_reservations",
"credit_usd": "100.00000000",
"used_usd": "3.42000000",
"remaining_usd": "96.58000000"
},
"retention": {
"detailed_days": 90,
"detailed_starting_at": "2026-04-09T12:00:00.000Z",
"daily_aggregates": "lifetime"
},
"tracking_started_at": "2026-07-01T08:30:00.000Z",
"data": [],
"totals": {
"requests": 18,
"successful_requests": 16,
"failed_requests": 1,
"cancelled_requests": 1,
"interrupted_requests": 0,
"input_tokens": 123456,
"output_tokens": 7890,
"cached_input_tokens": 20000,
"cache_creation_input_tokens": 1000,
"web_search_requests": 2,
"web_fetch_requests": 1,
"server_tool_error_count": 1,
"token_cost_usd": "0.42000000",
"server_tool_cost_usd": "0.02000000",
"total_cost_usd": "0.44000000"
},
"tracked_totals": {
"scope": "selected_inference_requests_since_tracking_started_at",
"requests": 18,
"successful_requests": 16,
"failed_requests": 1,
"cancelled_requests": 1,
"interrupted_requests": 0,
"input_tokens": 123456,
"output_tokens": 7890,
"cached_input_tokens": 20000,
"cache_creation_input_tokens": 1000,
"web_search_requests": 2,
"web_fetch_requests": 1,
"server_tool_error_count": 1,
"token_cost_usd": "0.42000000",
"server_tool_cost_usd": "0.02000000",
"total_cost_usd": "0.44000000"
},
"token_counting": {
"calls": 3,
"successful_calls": 2,
"failed_calls": 1,
"cancelled_calls": 0,
"interrupted_calls": 0,
"counted_input_tokens": 45678
},
"tracked_token_counting": {
"scope": "selected_token_estimates_since_tracking_started_at",
"calls": 4,
"successful_calls": 3,
"failed_calls": 1,
"cancelled_calls": 0,
"interrupted_calls": 0,
"counted_input_tokens": 60000
},
"by_model": []
}The example is abridged: data and by_model are intentionally empty. data, totals, tracked_totals, and by_model contain selected inference requests across all families, including zero-cost outcomes; free count_tokens calls are separated and not added to their token or cost totals. token_counting covers count calls in the selected window, while tracked_token_counting covers them since tracking_started_at; both operations remain visible individually in /v1/usage/requests. tracking_started_at is a lower coverage bound and can be null until the first event is recorded; after the earliest detail is compacted, it is rounded down to the UTC start of the first aggregate day. daily_aggregates: "lifetime" means compacted tracked daily buckets are retained without expiry; it does not recreate history from before tracking began. Every *_usd field is a string with 8 decimal places; timestamps are RFC 3339 UTC (Z). starting_at and ending_at must be UTC day boundaries; the maximum window is 366 days.
| Parameter | Rule |
|---|---|
starting_at / ending_at | RFC 3339 with a timezone; defaults to the last 90 days |
limit | 1–100; default 50 |
cursor | The signed opaque token from next_cursor; pass it unchanged. It freezes the original page's window and filters |
status | An exact status from the list below |
outcome | A coarse group: success, failed, cancelled, or interrupted; combines with status using AND |
operation | messages or count_tokens |
curl -G https://api.guardrelay.ai/v1/usage/requests \
-H "x-api-key: $GUARD_API_KEY" \
--data-urlencode "status=server_tool_error" \
--data-urlencode "operation=messages" \
--data-urlencode "limit=50"{
"object": "list",
"data": [
{
"request_id": "req_0123456789abcdef0123456789abcdef",
"created_at": "2026-09-09T11:20:31.120Z",
"completed_at": "2026-09-09T11:20:32.960Z",
"operation": "messages",
"status": "server_tool_error",
"retryable": false,
"http_status": 200,
"latency_ms": 1840,
"model": "claude-opus-5",
"stream": false,
"usage": {
"input_tokens": 840,
"output_tokens": 90,
"cached_input_tokens": 0,
"cache_creation_input_tokens": 0
},
"server_tools": {
"web_search_requests": 0,
"web_fetch_requests": 1,
"error_count": 1
},
"cost": {
"token_cost_usd": "0.00483750",
"server_tool_cost_usd": "0.00000000",
"total_cost_usd": "0.00483750"
},
"error": {
"code": "server_tool_error",
"message": "Серверный инструмент завершился ошибкой. Проверьте его параметры или повторите запрос.",
"action": "Исправьте указанные параметры и повторите запрос."
},
"family": "claude",
"server_prompt_applied": false,
"discount_percent": 25
}
],
"has_more": true,
"next_cursor": "<opaque-signed-cursor>",
"retention": {
"detailed_days": 90,
"detailed_starting_at": "2026-06-11T12:00:00.000Z",
"daily_aggregates": "lifetime"
}
}pending,success,client_error,rate_limited,policy_refusal.upstream_error,stream_error,server_tool_error,internal_error.cancelledmeans the client cancelled the request;interruptedmeans a service restart interrupted it.retryabletells an automated client whether retrying the call is sensible.- Free
count_tokenscalls also appear in the ledger, with zero cost.
- Detailed logical events are retained for 90 days; the current lower detail boundary is returned as
retention.detailed_starting_at. - Older tracked events are compacted into daily aggregates that are retained without expiry. Requests before
tracking_started_atare not backfilled. - These endpoints do not return prompts, responses, URLs/search queries, document content, tool arguments, IPs, User-Agent, or raw errors.
- Internal request-processing, account, and network details are not exposed. Errors are normalized to safe
code+messagepairs. - Pagination runs newest to oldest: when
has_more=true, passnext_cursorunchanged as the nextcursor. You may omit the window and filters because the cursor restores them; if repeated, they must match exactly. A modified, foreign, or malformed cursor receives the same400 Invalid cursorresponse.
The family filter accepts all, claude, kimi, composer and grok. Omitting it selects every family.
Kimi spend, its own rates and the reserve formula are covered on Kimi · Pricing, reserve and usage.
Kimi spend sits in the same report as everything else: the key and the balance are shared. Two active filters select it, family and endpoint; they combine as AND.
| Filter | What it takes |
|---|---|
family | all, claude, kimi, composer, grok; default all |
mode | Removed: any value returns 410 product_modes_removed; omit this parameter |
endpoint | chat_completions, messages, responses, search, fetch, token_estimate or all |
curl -G https://api.guardrelay.ai/v1/usage \
-H "Authorization: Bearer $GUARD_API_KEY" \
--data-urlencode "family=kimi" \
--data-urlencode "bucket_width=1d"curl -G https://api.guardrelay.ai/v1/usage/requests \
-H "Authorization: Bearer $GUARD_API_KEY" \
--data-urlencode "family=kimi" \
--data-urlencode "endpoint=chat_completions" \
--data-urlencode "limit=50"