mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-11 22:51:28 +00:00
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):
|
||||
id = str(id)
|
||||
|
||||
total_tokens = completion_response["usage"]["total_tokens"]
|
||||
total_tokens = completion_response["usage"].get("total_tokens", 0)
|
||||
|
||||
# ------------
|
||||
# Setup values
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue