Levain LabsLevain Labs
API ReferenceAnalytics

Summary

Headline totals for the selected period plus the previous one.

previous covers the same-duration window immediately preceding current, so callers can render a like-for-like comparison without computing window math themselves.

GET
/api/v1/analytics/summary

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Query Parameters

period?Period
Default"month"
Value in"day" | "week" | "month" | "quarter"

Header Parameters

X-API-Key?string|null

Response Body

application/json

application/json

curl -X GET "https://api.levainlabs.com/api/v1/analytics/summary"
{
  "period": "day",
  "start": "2019-08-24T14:15:22Z",
  "end": "2019-08-24T14:15:22Z",
  "current": {
    "cost_usd": 0,
    "billed_usd": 0,
    "tokens_in": 0,
    "tokens_out": 0,
    "request_count": 0,
    "run_count": 0,
    "agent_count": 0
  },
  "previous": {
    "cost_usd": 0,
    "billed_usd": 0,
    "tokens_in": 0,
    "tokens_out": 0,
    "request_count": 0,
    "run_count": 0,
    "agent_count": 0
  },
  "last_activity_at": "2019-08-24T14:15:22Z"
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}