From 575e360a609666e7d0bb454945e3aca697fcf47c Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Sat, 27 Sep 2025 13:31:11 -0700 Subject: [PATCH] fix: fix error on main --- litellm/llms/azure/completion/handler.py | 2 +- litellm/main.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/litellm/llms/azure/completion/handler.py b/litellm/llms/azure/completion/handler.py index 49f157495e..05d5e2f6c6 100644 --- a/litellm/llms/azure/completion/handler.py +++ b/litellm/llms/azure/completion/handler.py @@ -59,7 +59,7 @@ class AzureTextCompletion(BaseAzureLLM): ### CHECK IF CLOUDFLARE AI GATEWAY ### ### if so - set the model as part of the base url - if "gateway.ai.cloudflare.com" in api_base: + if api_base is not None and "gateway.ai.cloudflare.com" in api_base: ## build base url - assume api base includes resource name client = self._init_azure_client_for_cloudflare_ai_gateway( api_key=api_key, diff --git a/litellm/main.py b/litellm/main.py index 71d5509448..47f5cf1155 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -1537,6 +1537,11 @@ def completion( # type: ignore # noqa: PLR0915 api_base = api_base or litellm.api_base or get_secret_str("AZURE_API_BASE") + if api_base is None: + raise ValueError( + "api_base is required for Azure OpenAI LLM provider. Either set it dynamically or set the AZURE_API_BASE environment variable." + ) + api_version = ( api_version or litellm.api_version