Analytics

Get usage by model

post/usage/models

Request

Headers

X-Project-Idstring required

LangDB project ID

Request body

start_time_usinteger
end_time_usinteger
min_unit'hour' | 'day' | 'month'

The granularity of the returned usage data.

Example request

{
  "start_time_us": 1693062345678,
  "min_unit": "hour"
}

Response

Successful response

period_startinteger required

Start of the usage period in microseconds since epoch

period_endinteger required

End of the usage period in microseconds since epoch

Example response

{
  "models": [
    {
      "hour": "2025-02-15 09:00:00",
      "provider": "openai",
      "model_name": "gpt-4o",
      "total_input_tokens": 451235,
      "total_output_tokens": 2553,
      "total_cost": 1.3843410000000005
    }
  ],
  "period_start": 1737504000000000,
  "period_end": 1740121147931000
}

Changes

No recorded changes to this operation across all 1 revision of this API.