v1

latestOpenAPI 3.1.0raw.githubusercontent.com2026-06-25173140700.7 KB
Llm

Get token usage metrics

Return current-month token totals and per-model token timeseries for the tenant.

post/llm/tokens

Query parameters

cookie_namestring nullable
tenant_idinteger

Request body

granularity'monthly' | 'yearly' | 'custom' required

Aggregation window; 'custom' requires date_start and date_end.

date_startstring date-time nullable

Start of the custom range (used only when granularity is 'custom').

date_endstring date-time nullable

End of the custom range (used only when granularity is 'custom').

Example request

{
  "granularity": "monthly",
  "date_start": "2026-01-01T00:00:00Z",
  "date_end": "2026-01-31T23:59:59Z"
}

Response

Successful Response

total_prompt_tokensnumber required

Total prompt tokens across all models for the current month.

total_completion_tokensnumber required

Total completion tokens across all models for the current month.

total_requestsnumber required

Total requests across all models for the current month.

total_tokensnumber required

Total tokens (prompt + completion) for the current month.

Example response

{
  "total_prompt_tokens": 80000,
  "total_completion_tokens": 40000,
  "total_requests": 420,
  "total_tokens": 120000,
  "tokens_per_model": [
    {
      "llm_model": "gpt-4o",
      "duration": "monthly",
      "total_tokens_count": 12345,
      "prompt_token_count": 8000,
      "completion_token_count": 4345,
      "total_requests": 42
    }
  ],
  "timeseries_per_model": [
    {
      "llm_model": "gpt-4o",
      "timeseries": {
        "TotalTokens": [
          {
            "date": "2026-01-15",
            "value": 1234
          }
        ]
      }
    }
  ]
}