Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

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

shin-bot-litellme2475f4f9aba
diff --git a/tests/test_litellm/litellm_core_utils/llm_cost_calc/test_llm_cost_calc_utils.py b/tests/test_litellm/litellm_core_utils/llm_cost_calc/test_llm_cost_calc_utils.py
index 5ba78d9eed1..9e70f3e08d5 100644
--- a/tests/test_litellm/litellm_core_utils/llm_cost_calc/test_llm_cost_calc_utils.py
+++ b/tests/test_litellm/litellm_core_utils/llm_cost_calc/test_llm_cost_calc_utils.py
@@ -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
),