mirror of
https://github.com/tiennm99/litellm.git
synced 2026-07-17 22:17: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:
+1
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user