fix(test): correct prompt_tokens in test_string_cost_values (#20185)

The test had prompt_tokens=1000 but the sum of token details was 1150
(text=700 + audio=100 + cached=200 + cache_creation=150).

This triggered the double-counting detection logic which recalculated
text_tokens to 550, causing the assertion to fail.

Fixed by setting prompt_tokens=1150 to match the sum of details.
This commit is contained in:
shin-bot-litellm
2026-01-31 14:23:10 -08:00
committed by GitHub
parent 54286fca60
commit e2475f4f9a
@@ -313,10 +313,12 @@ def test_string_cost_values():
}
# Test usage with various token types
# Note: prompt_tokens must equal sum of details to avoid double-counting adjustment
# text_tokens(700) + audio_tokens(100) + cached_tokens(200) + cache_creation_tokens(150) = 1150
usage = Usage(
prompt_tokens=1000,
prompt_tokens=1150,
completion_tokens=500,
total_tokens=1500,
total_tokens=1650,
prompt_tokens_details=PromptTokensDetailsWrapper(
audio_tokens=100, cached_tokens=200, text_tokens=700, image_tokens=None, cache_creation_tokens=150
),