{"record":{"id":"156e45eb5970422d","repo":"BerriAI/litellm","slug":"azure-api-base-not-found","errorCode":null,"errorMessage":"Azure api base not found","messagePattern":"Azure api base not found","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/llms/azure/passthrough/transformation.py","lineNumber":35,"sourceCode":"\n\nclass AzurePassthroughConfig(BasePassthroughConfig):\n    def is_streaming_request(self, endpoint: str, request_data: dict) -> bool:\n        return \"stream\" in request_data\n\n    def get_complete_url(\n        self,\n        api_base: str | None,\n        api_key: str | None,\n        model: str,\n        endpoint: str,\n        request_query_params: dict | None,\n        litellm_params: dict,\n    ) -> tuple[\"URL\", str]:\n        base_target_url: Final = self.get_api_base(api_base)\n\n        if base_target_url is None:\n            raise Exception(\"Azure api base not found\")\n\n        litellm_metadata: Final = litellm_params.get(\"litellm_metadata\") or {}\n        model_group: Final = litellm_metadata.get(\"model_group\")\n        if model_group and model_group in endpoint:\n            endpoint = endpoint.replace(model_group, model)\n\n        complete_url: Final = BaseAzureLLM._get_base_azure_url(\n            api_base=base_target_url,\n            litellm_params=litellm_params,\n            route=endpoint,\n            default_api_version=litellm_params.get(\"api_version\"),\n        )\n        return (\n            httpx.URL(complete_url),\n            base_target_url,\n        )\n\n    def validate_environment(","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/azure/passthrough/transformation.py#L17-L53","documentation":"The Azure passthrough transformation derives the target URL from an api_base obtained via get_api_base(api_base); if nothing resolves, get_complete_url raises this generic Exception('Azure api base not found'). Because litellm passthrough forwards arbitrary paths to Azure, it must know the resource root URL, and without it the request cannot be routed. Note it is a bare Exception, not a ValueError, so broad handlers will also catch it.","triggerScenarios":"Using the passthrough endpoint (e.g. /azure/<deployment>/<path>) with no api_base supplied on the router model config, no litellm.api_base global, and no AZURE_API_BASE env var; adding an Azure deployment to the router without an api_base field.","commonSituations":"Proxy configs where the model_list entry has api_key but omits api_base; assuming passthrough inherits the base from a different provider's config; typos like api_base vs azure_endpoint field names in config files.","solutions":["Add api_base: https://<resource>.openai.azure.com to the Azure model's litellm_params in the router config.","Or set the AZURE_API_BASE environment variable for the proxy process.","Or set litellm.api_base globally if all Azure traffic shares one resource.","Restart the proxy after changing config so the model list is reloaded."],"exampleFix":"# before (config.yaml)\nmodel_list:\n  - model_name: azure-gpt4o\n    litellm_params:\n      model: azure/gpt-4o-deployment\n      api_key: os.environ/AZURE_API_KEY\n\n# after\nmodel_list:\n  - model_name: azure-gpt4o\n    litellm_params:\n      model: azure/gpt-4o-deployment\n      api_key: os.environ/AZURE_API_KEY\n      api_base: https://myresource.openai.azure.com","handlingStrategy":"validation","validationCode":"def validate_azure_passthrough_model(litellm_params: dict) -> None:\n    import os\n    base = litellm_params.get('api_base') or os.environ.get('AZURE_API_BASE')\n    if not base:\n        raise ValueError('Azure passthrough model config must include api_base')","typeGuard":null,"tryCatchPattern":"try:\n    resp = client.azure_passthrough(...)\nexcept Exception as e:\n    if 'Azure api base not found' in str(e):\n        raise ValueError('add api_base to the Azure model litellm_params or set AZURE_API_BASE') from e\n    raise","preventionTips":["Lint proxy config at startup: every azure/* model must have api_base in litellm_params.","Use env-var references (os.environ/AZURE_API_BASE) in config.yaml so bases are consistent.","Note this raises a bare Exception, so match on the message text."],"tags":["azure","passthrough","proxy","api-base","configuration","router"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}