GET /v1/ai-spend
Service: analytics · operationId: (none)
Required scopes
(no scope declared — review service config)
Query parameters
groupBy(string) required —from(string) required —to(string) required —
Responses
200 AI spend breakdown
{
"type": "object",
"properties": {
"group_by": {
"type": "string",
"enum": [
"service",
"user",
"model",
"route"
]
},
"rows": {
"type": "array",
"items": {
"type": "object",
"properties": {
"group_value": {
"type": [
"string",
"null"
]
},
"request_count": {
"type": "integer"
},
"prompt_tokens": {
"type": "integer"
},
"completion_tokens": {
"type": "integer"
},
"total_tokens": {
"type": "integer"
},
"cost_usd": {
"type": "string"
}
},
"required": [
"group_value",
"request_count",
"prompt_tokens",
"completion_tokens",
"total_tokens",
"cost_usd"
]
}
}
},
"required": [
"group_by",
"rows"
]
}400 Invalid input
{
"type": "object",
"properties": {
"error": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"error",
"message"
]
}Example
curl -X GET https://analytics.platform.loop.health/v1/ai-spend \
-H "Authorization: Bearer $ACCESS_TOKEN"Related
services/analytics— service overview- All endpoints — directory across services
- Auth model — how scopes are enforced