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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
test_string_cost_values_edge_cases
Ishaan Jafferf0a93fb9b954
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.pyindex 814d0f23a6b..65e3dbec8bd 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@@ -438,9 +438,9 @@ def test_string_cost_values_edge_cases():# Expected costs:# Prompt: 1000 * 1e-6 + 100 * 0 (invalid string becomes 0)- # Completion: 500 * 2e-6 (text_tokens == completion_tokens, so is_text_tokens_total=True, no separate audio cost)+ # Completion: 500 * 2e-6 + 50 * 2e-6 (audio tokens fall back to base cost when output_cost_per_audio_token is None)expected_prompt_cost = 1000 * 1e-6- expected_completion_cost = 500 * 2e-6+ expected_completion_cost = 500 * 2e-6 + 50 * 2e-6assert round(prompt_cost, 12) == round(expected_prompt_cost, 12)assert round(completion_cost, 12) == round(expected_completion_cost, 12)