v51

OpenAPI 3.1.0raw.githubusercontent.com2026-08-018486293.2 KB
usage

List Usage

List usage logs ordered by timestamp (most recent first).

Supports optional filters for time range, user, status, model, and endpoint. Paginated via skip/limit. The return shape is a bare JSON array; external billing/analytics consumers depend on this, so the total row count for a paginated UI is served separately by GET /v1/usage/count rather than wrapped in an envelope here. Timestamps accept either ISO 8601 strings or Unix epoch seconds (numeric).

get/v1/usage

Query parameters

start_datestring date-time nullable

Return logs with timestamp >= start_date (ISO 8601 or Unix epoch seconds)

Return logs with timestamp >= start_date (ISO 8601 or Unix epoch seconds)

end_datestring date-time nullable

Return logs with timestamp < end_date (ISO 8601 or Unix epoch seconds)

Return logs with timestamp < end_date (ISO 8601 or Unix epoch seconds)

user_idstring nullable

Filter to a single user

Filter to a single user

statusstring nullable

Filter to a single status (e.g. 'success' or 'error')

Filter to a single status (e.g. 'success' or 'error')

modelstring nullable

Filter to a single model

Filter to a single model

endpointstring nullable

Filter to a single endpoint (e.g. '/v1/chat/completions')

Filter to a single endpoint (e.g. '/v1/chat/completions')

sourcestring nullable

Filter to a single provenance source (e.g. 'gateway' or 'claude_code')

Filter to a single provenance source (e.g. 'gateway' or 'claude_code')

api_key_idstring nullable

Filter to a single API key id

Filter to a single API key id

pricedboolean nullable

Filter by pricing state: true = only rows with a cost, false = only unpriced rows (cost is null)

Filter by pricing state: true = only rows with a cost, false = only unpriced rows (cost is null)

counts_toward_budgetboolean nullable

Filter by budget participation: true = only enforced gateway rows, false = only imported rows that never touch a budget

Filter by budget participation: true = only enforced gateway rows, false = only imported rows that never touch a budget

skipinteger
limitinteger

Response

Successful Response

api_key_idstring nullable required
billing_metersobject nullable required
cache_read_tokensinteger nullable required
cache_write_1h_tokensinteger nullable required
cache_write_tokensinteger nullable required
completion_tokensinteger nullable required
costnumber nullable required
counts_toward_budgetboolean required
endpointstring required
error_messagestring nullable required
idstring required
latency_msinteger nullable required
modelstring required
pricing_breakdownobject[] nullable required
prompt_tokensinteger nullable required
providerstring nullable required
sourcestring required
source_labelstring nullable required
statusstring required
timestampstring required
total_tokensinteger nullable required
user_idstring nullable required