Skip to main content

Retrieve AI Aggregate Stats

GET 

/api/v1/stats/ai

Retrieve aggregated AI credit usage statistics for the Dashboard UI.

Authorization

  • Regular users can only query their own stats (user_id must match JWT or be omitted).
  • Admin users can query any user or omit user_id for group-wide consolidated stats.

Response (consolidated, no user_id)

{
"usergroup_id": 100,
"period": 720,
"data": {
"*": {
"AI_CREDITS_USED": 342,
"AI_REQUESTS": 13
}
},
"credit_balance": 1158
}

Response (per-user, with user_id=42)

{
"usergroup_id": 100,
"period": 720,
"data": {
"42": {
"AI_CREDITS_USED": 34,
"AI_REQUESTS": 5
}
},
"credit_balance": 1158
}

Metric Keys

KeyDescription
AI_CREDITS_USEDTotal AI credits consumed in the period
AI_REQUESTSNumber of AI Agent requests in the period

Request

Responses

Successful operation