AI Gateway Usage

GET /ai/usage/summary

Changed on

Request

  • Base URL
    /api (relative, and the document was published on a file host, not at the API’s origin)
  • Auth
    HTTP bearer

Query parameters

fromstring

ISO 8601 start time (defaults to 24h ago)

tostring

ISO 8601 end time (defaults to now)

project_idinteger

Filter by project ID (deployment-token usage; instance administrators only)

Response

Usage summary for the time range

avg_latency_msnumber double required
byok_countinteger required
error_countinteger required
priced_requestsinteger required

Requests that used tokens and whose cost a known price gave, zero included. With unpriced_requests it tells a window with no priced request (no total to show) from one whose total is partial; requests that used no tokens (failures) are in neither.

streaming_countinteger required
total_cost_microcentsinteger required
total_input_tokensinteger required
total_output_tokensinteger required
total_requestsinteger required
total_tokensinteger required
unpriced_requestsinteger required

Requests that used tokens but whose cost no known price gave: logged before costs were estimated, or served by a model with no published price (a self-hosted server). A model with a published price of zero is priced, not counted here. total_cost_microcents leaves these out, so a client shows the total as partial, or unknown when every request is unpriced, rather than as free.

Changes