forked from phoenix/litellm-mirror
fix(proxy_server.py): track cost for global proxy
This commit is contained in:
parent
ba24037baf
commit
574208f005
3 changed files with 44 additions and 22 deletions
|
@ -1090,7 +1090,12 @@ class Logging:
|
|||
else: # streaming chunks + image gen.
|
||||
self.model_call_details["response_cost"] = None
|
||||
|
||||
if litellm.max_budget and self.stream:
|
||||
if (
|
||||
litellm.max_budget
|
||||
and self.stream
|
||||
and result is not None
|
||||
and "content" in result
|
||||
):
|
||||
time_diff = (end_time - start_time).total_seconds()
|
||||
float_diff = float(time_diff)
|
||||
litellm._current_cost += litellm.completion_cost(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue