Broker usage: add reset_at (credit renewal date)

This commit is contained in:
inference-bot committed 2026-09-14 14:28:16 -06:00
1 parent 0453cee019
commit 87374dfeab
1 file changed
+3
+3
View File
@@ -1193,6 +1193,7 @@ async def broker_get_usage(email: str) -> dict:
balance = get_member_balance(email) balance = get_member_balance(email)
spend = 0.0 spend = 0.0
reset_at = None
async with httpx.AsyncClient() as client: async with httpx.AsyncClient() as client:
# 1. Team spend + budget # 1. Team spend + budget
@@ -1205,6 +1206,7 @@ async def broker_get_usage(email: str) -> dict:
if t.get("team_id") == team_id: if t.get("team_id") == team_id:
balance = float(t.get("max_budget") or balance) balance = float(t.get("max_budget") or balance)
spend = float(t.get("spend") or 0.0) spend = float(t.get("spend") or 0.0)
reset_at = t.get("budget_reset_at")
break break
# 2. Per-model token/spend breakdown from spend logs (filtered by team). # 2. Per-model token/spend breakdown from spend logs (filtered by team).
@@ -1245,6 +1247,7 @@ async def broker_get_usage(email: str) -> dict:
"spend": spend, "spend": spend,
"remaining": max(balance - spend, 0.0), "remaining": max(balance - spend, 0.0),
"total_tokens": total_tokens, "total_tokens": total_tokens,
"reset_at": reset_at,
"models": model_list, "models": model_list,
} }