{"record":{"id":"aafb658d5996e7e3","repo":"BerriAI/litellm","slug":"azure-ai-api-base-is-required-api-base-none-set","errorCode":null,"errorMessage":"Azure AI API Base is required. api_base=None. Set in call or via `AZURE_AI_API_BASE` env var.","messagePattern":"Azure AI API Base is required\\. api_base=None\\. Set in call or via `AZURE_AI_API_BASE` env var\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/azure_ai/rerank/transformation.py","lineNumber":29,"sourceCode":"from litellm.llms.cohere.rerank.transformation import CohereRerankConfig\nfrom litellm.secret_managers.main import get_secret_str\nfrom litellm.types.utils import RerankResponse\nfrom litellm.utils import _add_path_to_api_base\n\n\nclass AzureAIRerankConfig(CohereRerankConfig):\n    \"\"\"\n    Azure AI Rerank - Follows the same Spec as Cohere Rerank\n    \"\"\"\n\n    def get_complete_url(\n        self,\n        api_base: str | None,\n        model: str,\n        optional_params: dict | None = None,\n    ) -> str:\n        if api_base is None:\n            raise ValueError(\n                \"Azure AI API Base is required. api_base=None. Set in call or via `AZURE_AI_API_BASE` env var.\"\n            )\n        original_url: Final = httpx.URL(api_base)\n        if not original_url.is_absolute_url:\n            raise ValueError(\n                \"Azure AI API Base must be an absolute URL including scheme (e.g. \"\n                \"'https://<resource>.services.ai.azure.com'). \"\n                f\"Got api_base={api_base!r}.\"\n            )\n        normalized_path: Final = original_url.path.rstrip(\"/\")\n\n        # Allow callers to pass either full v1/v2 rerank endpoints:\n        # - https://<resource>.services.ai.azure.com/v1/rerank\n        # - https://<resource>.services.ai.azure.com/providers/cohere/v2/rerank\n        if normalized_path.endswith(\"/v1/rerank\") or normalized_path.endswith(\"/v2/rerank\"):\n            return str(original_url.copy_with(path=normalized_path or \"/\"))\n\n        # If callers pass just the version path (e.g. \".../v2\" or \".../providers/cohere/v2\"), append \"/rerank\"","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/azure_ai/rerank/transformation.py#L11-L47","documentation":"Error \"Azure AI API Base is required. api_base=None. Set in call or via `AZURE_AI_API_BASE` env var.\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/azure_ai/rerank/transformation.py:29 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set AZURE_AI_API_BASE or pass api_base for rerank."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}