feat - add remaining budget for key on prometheus

This commit is contained in:
Ishaan Jaff 2024-06-13 14:37:02 -07:00
parent 51157c148f
commit 9b340fb2f8
2 changed files with 29 additions and 2 deletions

View file

@ -109,6 +109,10 @@ async def add_litellm_data_to_request(
data["metadata"]["user_api_key_team_max_budget"] = user_api_key_dict.team_max_budget
data["metadata"]["user_api_key_team_spend"] = user_api_key_dict.team_spend
# API Key spend, budget - used by prometheus.py
data["metadata"]["user_api_key_spend"] = user_api_key_dict.spend
data["metadata"]["user_api_key_max_budget"] = user_api_key_dict.max_budget
data["metadata"]["user_api_key_metadata"] = user_api_key_dict.metadata
_headers = dict(request.headers)
_headers.pop(