forked from phoenix/litellm-mirror
fix(router.py): gracefully handle scenario where completion response doesn't have total tokens
Closes https://github.com/BerriAI/litellm/issues/4968
This commit is contained in:
parent
311521e56e
commit
ec6db03c41
1 changed files with 1 additions and 1 deletions
|
@ -2944,7 +2944,7 @@ class Router:
|
||||||
elif isinstance(id, int):
|
elif isinstance(id, int):
|
||||||
id = str(id)
|
id = str(id)
|
||||||
|
|
||||||
total_tokens = completion_response["usage"]["total_tokens"]
|
total_tokens = completion_response["usage"].get("total_tokens", 0)
|
||||||
|
|
||||||
# ------------
|
# ------------
|
||||||
# Setup values
|
# Setup values
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue