Skip to Content
kosemdocs
ReferenceAPILlm usage

Query LLM usage in organization

Sums the usage of an organization's or a project's requests to models over a range of days in UTC, grouped as asked.

GET
/v1/organizations/{organization}/llmUsage

Sums the usage of an organization's or a project's requests to models over a range of days in UTC, grouped as asked.

Authorization

bearer
headerAuthorizationBearer <token>

An access token, or an API key.

Path Parameters

organization*string

The organization's ID.

Match^org_[0-7][0-9a-hjkmnp-tv-z]{25}$

Query Parameters

startDate?string

The first day to sum, in UTC, such as 2026-01-31. Defaults to the first of the current month.

Formatdate
endDate?string

The last day to sum, in UTC. Defaults to today. At most 400 days after startDate.

Formatdate
groupBy?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?string

Only the requests that this source made, such as an agent, projects/{project_id}/agents/{agent_id}.

Lengthlength <= 200
model?string

Only 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.

Lengthlength <= 200
principal?string

Only the requests of this caller, such as user:usr_…, serviceAccount:sa_… or agent:ags_….

Lengthlength <= 200
project?string

Only the requests of this project, projects/{project_id}, one of the organization's.

Lengthlength <= 200

Response Body

OK

application/json
  1. response
rows*array<>

A row for each group, ordered by the dimensions grouped by.

Example Request
curl -X GET 'https://api.kosem.ai/v1/organizations/string/llmUsage'
Example Response
{
  "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
    }
  ]
}