← Back to changelog
February 19, 2024

New API: GET /metrics/daily

Picture Marc KlingenMarc Klingen

Retrieve aggregated daily usage metrics via a unified endpoint. Filters for application type, user, or tags are available for tailored data retrieval.

Returned data includes:

  • Daily trace count
  • Daily total cost
  • Daily usage per model (broken down by input and output)

Optional filters

  • traceName to commonly filter by the application type, depending on how you use name in your traces
  • userId to filter by user
  • tags to filter by tags

See API reference (opens in a new tab) for more details.

Do you miss any other GET API routes or metrics on this one? Add them to our idea board!

Example

GET /api/public/metrics/daily?traceName=my-copilot&userId=john
{
  "data": [
    {
      "date": "2024-02-18",
      "countTraces": 1500,
      "totalCost": 102.19,
      "usage": [
        {
          "model": "llama2",
          "inputUsage": 1200,
          "outputUsage": 1300,
          "totalUsage": 2500
        },
        {
          "model": "gpt-4",
          "inputUsage": 500,
          "outputUsage": 550,
          "totalUsage": 1050
        }
      ]
    },
    {
      "date": "2024-02-17",
      "countTraces": 1250,
      "totalCost": 250.0,
      "usage": [
        {
          "model": "llama2",
          "inputUsage": 1000,
          "outputUsage": 1100,
          "totalUsage": 2100
        }
      ]
    }
  ],
  "meta": {
    "page": 1,
    "limit": 2,
    "totalItems": 60,
    "totalPages": 30
  }
}

Was this page useful?

Questions? We're here to help

Subscribe to updates