From 9f768c35ba10903594a8e5d64a11bc3a4fe1670d Mon Sep 17 00:00:00 2001 From: Pascal Tempier Date: Sun, 28 Jun 2026 15:07:51 +0200 Subject: [PATCH] test(cost): route per-second regression test through generic provider branch The new test registered an unprefixed synthetic model name with no custom_llm_provider set, so cost_per_token's provider dispatch resolved it to the OpenAI-specific branch (via get_llm_provider's default) instead of the generic input_cost_per_second fallback the test means to exercise. That made the real cost calculator raise inside model_info lookup, which gets caught and turned into None several layers up, rather than hitting either the buggy 0.0 or the fixed 0.02. Passing custom_llm_provider="custom" explicitly keeps it on the generic branch. --- .../llm_response_utils/test_response_metadata.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/test_litellm/litellm_core_utils/llm_response_utils/test_response_metadata.py b/tests/test_litellm/litellm_core_utils/llm_response_utils/test_response_metadata.py index 7d026c1ce25..bc28fc0b6ca 100644 --- a/tests/test_litellm/litellm_core_utils/llm_response_utils/test_response_metadata.py +++ b/tests/test_litellm/litellm_core_utils/llm_response_utils/test_response_metadata.py @@ -265,6 +265,11 @@ class TestPerSecondCostUsesActualDuration: model=model, optional_params={}, litellm_params={}, + # Bypass the explicit per-provider branches in cost_per_token (e.g. + # the OpenAI one, which unprefixed model names resolve to by + # default) so the lookup reaches the generic input_cost_per_second + # fallback this test is exercising. + custom_llm_provider="custom", ) return logging_obj