AI Gateway Usage
get/ai/usage/by-project

Request

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

Query parameters

fromstring

ISO 8601 start time (defaults to 24h ago)

tostring

ISO 8601 end time (defaults to now)

limitinteger

Max projects (defaults to 50, max 100)

Response

Spend and volume per project, most expensive first

byok_request_countinteger required

Requests served with a caller-supplied provider key (not operator spend)

error_countinteger required
estimated_cost_microcentsinteger required

Estimated cost in microcents (1/10000 of a cent), from the model price list

input_tokensinteger required
monthly_budget_microcentsinteger nullable

The project's effective monthly budget after inheritance, in microcents; null when it has no cap. Left None by the usage service and filled in by the handler, which owns the link to the limits service.

operator_cost_microcentsinteger required

The part of estimated_cost_microcents the operator pays for: requests made with a caller-supplied provider key are excluded. This is the figure a project's monthly budget is measured against.

output_tokensinteger required
project_idinteger required
request_countinteger required

Changes