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
Allow base_model for non Azure providers in proxy (#18038)
Jorge Yero Salazar48a3a741e5f3
diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.pyindex da09346503d..8fdea95d7ad 100644--- a/litellm/proxy/proxy_server.py+++ b/litellm/proxy/proxy_server.py@@ -4249,7 +4249,7 @@ def get_litellm_model_info(model: dict = {}):model_info = model.get("model_info", {})model_to_lookup = model.get("litellm_params", {}).get("model", None)try:- if "azure" in model_to_lookup:+ if "azure" in model_to_lookup or model_info.get("base_model"):model_to_lookup = model_info.get("base_model", None)litellm_model_info = litellm.get_model_info(model_to_lookup)return litellm_model_infodiff --git a/tests/proxy_unit_tests/test_proxy_server.py b/tests/proxy_unit_tests/test_proxy_server.pyindex d7e338d657b..8d3b0fee48f 100644--- a/tests/proxy_unit_tests/test_proxy_server.py+++ b/tests/proxy_unit_tests/test_proxy_server.py@@ -2671,3 +2671,61 @@ async def test_update_config_success_callback_normalization():assert "sQs" not in callbacks# Existing callback should still be presentassert "langfuse" in callbacks+++ "data",+ [+ {+ "model": {+ "model_name": "azure/gpt-4.1-mini",+ "litellm_params": {"model": "azure/gpt-4.1-mini"},+ "model_info": {"base_model": "gpt-4.1-mini"},+ },+ "expected": "gpt-4.1-mini",+ },+ {+ "model": {+ "model_name": "openai/gpt-4.1-mini",+ "litellm_params": {"model": "openai/gpt-4.1-mini"},+ },+ "expected": "openai/gpt-4.1-mini",+ },+ {+ "model": {+ "model_name": "openai/gpt-4.1-mini",+ "litellm_params": {"model": "openai/gpt-4.1-mini"},+ "model_info": {"base_model": "gpt-4.1-mini"},+ },+ "expected": "gpt-4.1-mini",+ },+ {+ "model": {+ "model_name": "claude-sonnet-4-5-20250929",+ "litellm_params": {"model": "anthropic/claude-sonnet-4-5@20250929"},+ "model_info": {"base_model": "anthropic/claude-sonnet-4-5-20250929"},+ },+ "expected": "anthropic/claude-sonnet-4-5-20250929",+ },+ {+ "model": {+ "model_name": "gemini-2.5-flash-001",+ "litellm_params": {"model": "gemini/gemini-2.5-flash@001"},+ "model_info": {"base_model": "gemini-2.5-flash-001"},+ },+ "expected": "gemini-2.5-flash-001",+ },+ ],+)+def test_get_litellm_model_info(data):+ from litellm.proxy.proxy_server import get_litellm_model_info++ model = data["model"]+ get_info_mock = MagicMock()++ with mock.patch(+ "litellm.get_model_info",+ new=get_info_mock,+ ):+ get_litellm_model_info(model=model)+ get_info_mock.assert_called_once_with(data["expected"])