Query LLM usage in project
Sums the usage of an organization's or a project's requests to models over a range of days in UTC, grouped as asked.
Sums the usage of an organization's or a project's requests to models over a range of days in UTC, grouped as asked.
bearerAuthorizationBearer <token>An access token, or an API key.
project*stringThe project's ID.
^prj_[0-7][0-9a-hjkmnp-tv-z]{25}$startDate?stringThe first day to sum, in UTC, such as 2026-01-31. Defaults to the first of the current month.
dateendDate?stringThe last day to sum, in UTC. Defaults to today. At most 400 days after startDate.
dategroupBy?array<>What to group the sums by: DATE, the day in UTC; PROJECT; MODEL; PRINCIPAL, who made the requests; SOURCE, what in kosem made them, such as an agent, which counts only the requests that a source made. None sums them all into one row.
source?stringOnly the requests that this source made, such as an agent, projects/{project_id}/agents/{agent_id}.
length <= 200model?stringOnly the requests to this model: a project's, projects/{project_id}/models/{model_id}, or an organization's, organizations/{organization_id}/models/{model_id}, for the requests to the projects' adoptions of it.
length <= 200principal?stringOnly the requests of this caller, such as user:usr_…, serviceAccount:sa_… or agent:ags_….
length <= 200OK
application/json- response
rows*array<>A row for each group, ordered by the dimensions grouped by.
curl -X GET 'https://api.kosem.ai/v1/projects/string/llmUsage'{
"rows": [
{
"alias": "string",
"cacheReadTokens": 0,
"cacheWriteTokens": 0,
"cost": {
"currencyCode": "string",
"nanos": -999999999,
"units": 0
},
"date": "2019-08-24",
"durationMs": 0,
"failedRequests": 0,
"firstTokenLatencyMs": 0,
"inputTokens": 0,
"model": "string",
"outputTokens": 0,
"principal": "string",
"project": "string",
"providerErrors": 0,
"reasoningTokens": 0,
"refusedRequests": 0,
"requests": 0,
"source": "string",
"sourceModel": "string",
"streamedOutputTokens": 0,
"streamedRequests": 0,
"streamingMs": 0,
"succeededRequests": 0,
"unpricedRequests": 0,
"unreachableRequests": 0
}
]
}