Broker usage: expose allowance and credits buckets to dashboard
This commit is contained in:
1 parent
b7d239d9b6
commit
b93b208659
1 file changed
+6
-1
+6
-1
@@ -2104,7 +2104,8 @@ async def broker_get_usage(email: str, days: int = 0) -> dict:
|
|||||||
"""
|
"""
|
||||||
team_id = await litellm_get_or_create_team(email, get_member_balance(email))
|
team_id = await litellm_get_or_create_team(email, get_member_balance(email))
|
||||||
|
|
||||||
balance = get_member_balance(email)
|
allowance = get_member_balance(email)
|
||||||
|
credits = get_credit_balance(email)
|
||||||
spend = 0.0
|
spend = 0.0
|
||||||
reset_at = None
|
reset_at = None
|
||||||
|
|
||||||
@@ -2126,6 +2127,8 @@ async def broker_get_usage(email: str, days: int = 0) -> dict:
|
|||||||
return {
|
return {
|
||||||
"email": email,
|
"email": email,
|
||||||
"balance": balance,
|
"balance": balance,
|
||||||
|
"allowance": allowance,
|
||||||
|
"credits": credits,
|
||||||
"spend": spend,
|
"spend": spend,
|
||||||
"remaining": max(balance - spend, 0.0),
|
"remaining": max(balance - spend, 0.0),
|
||||||
"total_tokens": usage["totals"]["total_tokens"],
|
"total_tokens": usage["totals"]["total_tokens"],
|
||||||
@@ -2192,6 +2195,8 @@ async def broker_get_usage(email: str, days: int = 0) -> dict:
|
|||||||
return {
|
return {
|
||||||
"email": email,
|
"email": email,
|
||||||
"balance": balance,
|
"balance": balance,
|
||||||
|
"allowance": allowance,
|
||||||
|
"credits": credits,
|
||||||
"spend": spend,
|
"spend": spend,
|
||||||
"remaining": max(balance - spend, 0.0),
|
"remaining": max(balance - spend, 0.0),
|
||||||
"total_tokens": total_tokens,
|
"total_tokens": total_tokens,
|
||||||
|
|||||||
Reference in new issue
Block a user