Get how many tokens a project has spent on the AI Gateway, per key, minute, hour or day, and model
Changed onThis endpoint may be changed or removed at any time. Don't use it in production environments.
A row with no key_id is the whole project's usage for that time bucket and model, and is reported only when no key_id is asked for. A bucket nothing was spent on is left out rather than reported as zeroes. Both ends of the range must fall on a UTC minute. A bucket that the range cuts holds only the usage inside the range. A range on whole UTC hours at hour or day granularity is read from the hourly totals, which keep the whole history but take up to about 15 minutes to show recent usage. Any other range is read from the requests themselves, which are up to date but kept for 3 months only. The cost is an estimate at the rates the catalogue lists now, not what was charged at the time: the input outside the prompt cache, the tokens read from and written to it, and the output, each at a rate of its own. A model the catalogue no longer lists keeps its usage and is reported with no cost at all.
Request
- Base URLhttps://api.aiven.io/v1
- URLhttps://api.aiven.io/v1/project/{project}/ai-gateway/usage
- AuthHTTP bearer and OAuth 2Authorization code: https://console.aiven.io/oauth/authorizeToken URL: https://api.aiven.io/v1/oauth2/token scopes: projects:read
Path parameters
Project name
Query parameters
Report only this key, and no project totals
Start of the range, inclusive, on a UTC minute (ISO 8601, default: start of the month)
End of the range, exclusive, on a UTC minute (ISO 8601, default: the end of the current hour)
Size of the time buckets usage is reported in. A per-minute range is limited to 1 day, an hourly one to 7 days, a daily one to 366
Response
Response
Changes
- info
endpoint added
- info