Update litellm/litellm_core_utils/llm_cost_calc/utils.py

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
This commit is contained in:
Praveen11558 2026-03-24 23:15:21 +05:30 committed by GitHub
parent 64161bc85d
commit 718118f3e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -709,10 +709,10 @@ def generic_cost_per_token( # noqa: PLR0915
# This handles both cases:
# 1. text_tokens=0 (provider didn't set it) - gap fills the entire remainder
# 2. text_tokens>0 but < total (mixed content like PDF+text) - gap fills remainder
#
# Skip filling when has_alternative_billing is True (character_count,
# Skip filling when has_non_token_alternative_billing is True (character_count,
# video_length_seconds, or image_count are active) - those dimensions
# already account for the prompt_tokens gap.
# already account for the prompt_tokens gap.
unaccounted_tokens = usage.prompt_tokens - accounted_tokens
prompt_tokens_details["text_tokens"] += unaccounted_tokens