Skip to content

Commit

Permalink
fix(router.py): gracefully handle scenario where completion response …
Browse files Browse the repository at this point in the history
…doesn't have total tokens

Closes #4968
  • Loading branch information
krrishdholakia committed Jul 30, 2024
1 parent 311521e commit ec6db03
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion litellm/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -2944,7 +2944,7 @@ async def deployment_callback_on_success(
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
Expand Down

0 comments on commit ec6db03

Please sign in to comment.