(feat) view spend per tag

This commit is contained in:
ishaan-jaff 2024-02-16 10:16:48 -08:00
parent 23589a398a
commit 138f5ceb1e
5 changed files with 171 additions and 0 deletions

View file

@ -0,0 +1,16 @@
# Enterprise Proxy Util Endpoints
async def get_spend_by_tags(start_date=None, end_date=None, prisma_client=None):
response = await prisma_client.db.query_raw(
"""
SELECT
jsonb_array_elements_text(request_tags) AS individual_request_tag,
COUNT(*) AS log_count,
SUM(spend) AS total_spend
FROM "LiteLLM_SpendLogs"
GROUP BY individual_request_tag;
"""
)
return response