From 80f4d7ed19e74c75309a9fb2ae95f85e85c44d8f Mon Sep 17 00:00:00 2001 From: tusharjamunkar Date: Fri, 11 Sep 2026 23:17:06 +0530 Subject: [PATCH] test(proxy_server): add independent regression test for _get_proxy_model_info with fresh model --- .../proxy_server/test_routes_model_info.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/tests/test_litellm/proxy/proxy_server/test_routes_model_info.py b/tests/test_litellm/proxy/proxy_server/test_routes_model_info.py index 2e1056f751d..60dcd3b72bc 100644 --- a/tests/test_litellm/proxy/proxy_server/test_routes_model_info.py +++ b/tests/test_litellm/proxy/proxy_server/test_routes_model_info.py @@ -546,7 +546,7 @@ def test_v2_model_info_access_group_paginates_over_the_filtered_set(client, auth def test_enrich_model_info_with_litellm_data_populates_none_keys(monkeypatch): monkeypatch.setenv("LITELLM_LOCAL_MODEL_COST_MAP", "True") from litellm.proxy._types import ModelInfo as ProxyModelInfo - from litellm.proxy.proxy_server import _enrich_model_info_with_litellm_data, _get_proxy_model_info + from litellm.proxy.proxy_server import _enrich_model_info_with_litellm_data backend = "bedrock/eu.anthropic.claude-opus-5" p_model_info = ProxyModelInfo(id="d1").model_dump() @@ -558,7 +558,17 @@ def test_enrich_model_info_with_litellm_data_populates_none_keys(monkeypatch): assert mi.get("max_tokens") == 128000 assert mi.get("mode") == "chat" - proxy_info = _get_proxy_model_info(model=model) + +def test_get_proxy_model_info_populates_none_keys(monkeypatch): + monkeypatch.setenv("LITELLM_LOCAL_MODEL_COST_MAP", "True") + from litellm.proxy._types import ModelInfo as ProxyModelInfo + from litellm.proxy.proxy_server import _get_proxy_model_info + + backend = "bedrock/eu.anthropic.claude-opus-5" + p_model_info = ProxyModelInfo(id="d1").model_dump() + fresh_model = {"model_name": "m", "litellm_params": {"model": backend}, "model_info": dict(p_model_info)} + + proxy_info = _get_proxy_model_info(model=fresh_model) p_mi = proxy_info["model_info"] assert p_mi.get("input_cost_per_token") == 5.5e-06 assert p_mi.get("max_tokens") == 128000 @@ -579,7 +589,8 @@ def test_enrich_model_info_with_litellm_data_preserves_custom_pricing(monkeypatc assert mi.get("input_cost_per_token") == 0.00099 assert mi.get("max_tokens") == 128000 - proxy_info = _get_proxy_model_info(model=model) + fresh_custom_model = {"model_name": "m", "litellm_params": {"model": backend}, "model_info": dict(custom_model_info)} + proxy_info = _get_proxy_model_info(model=fresh_custom_model) p_mi = proxy_info["model_info"] assert p_mi.get("input_cost_per_token") == 0.00099