From 769d1777fca97ece5dc1a3141a4dcff1dfa8e8dd Mon Sep 17 00:00:00 2001 From: Ryan Crabbe Date: Sat, 7 Feb 2026 09:51:51 -0800 Subject: [PATCH] fix: add isinstance(str) check to get_api_base fast path Ensures non-string api_base values (e.g. int, list) fall through to Pydantic validation instead of being returned directly. --- litellm/litellm_core_utils/llm_response_utils/get_api_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/litellm_core_utils/llm_response_utils/get_api_base.py b/litellm/litellm_core_utils/llm_response_utils/get_api_base.py index c633f421059..253e975178a 100644 --- a/litellm/litellm_core_utils/llm_response_utils/get_api_base.py +++ b/litellm/litellm_core_utils/llm_response_utils/get_api_base.py @@ -32,7 +32,7 @@ def get_api_base( # without constructing a full LiteLLM_Params Pydantic model. if isinstance(optional_params, dict): _api_base = optional_params.get("api_base") - if _api_base is not None: + if isinstance(_api_base, str): return _api_base try: