Anthropic usage API
The Anthropic usage API exposes per-tenant aggregated usage data sourced from the Anthropic organisation usage report.
The data is populated by a periodic sync job that reads the Anthropic usage report and stores per-tenant totals in the local database.
Reading tenant usage
GET /admin/v1/tenants/<ID>/anthropic-usage
Required role: tenant admin or admin (tenant-scoped).
Returns aggregated input tokens, output tokens, cache reads, cache writes, and cost per day for the requested tenant.
Optional query parameters:
| Parameter | Description |
|---|---|
from |
Inclusive lower bound, formatted as YYYY-MM-DD. Defaults to 30 days before today (UTC). |
to |
Inclusive upper bound, formatted as YYYY-MM-DD. Defaults to today (UTC). |
The response is an object with three keys:
| Key | Description |
|---|---|
daily |
Array of usage rows grouped by day and by source, model, and service_tier — so a single day can produce several rows. Each row carries snapshot_date, source, model, service_tier, fetched_at, and the same token/cost fields as totals (uncached_input_tokens, output_tokens, cache_write_5m_tokens, cache_write_1h_tokens, cache_read_tokens, web_search_requests, cost_usd). |
totals |
Aggregate totals across the range, with uncached_input_tokens, output_tokens, cache_write_5m_tokens, cache_write_1h_tokens, cache_read_tokens, web_search_requests, and cost_usd. |
last_synced_at |
Timestamp (unix seconds) of the most recent successful sync for the returned data; null when the range holds no synced rows. |
Triggering a sync
POST /admin/v1/anthropic-usage/sync
Required role: tenant admin or admin.
Triggers a sync of the Anthropic organisation usage report. The sync runs asynchronously in the background; the endpoint returns immediately with { "ok": true, "message": "sync triggered" } and does not wait for the sync to finish or report a record count.