{"record":{"id":"2065fdc0d2a9671e","repo":"BerriAI/litellm","slug":"api-base-is-required-for-azure-ai-agents-set-it-v","errorCode":null,"errorMessage":"api_base is required for Azure AI Agents. Set it via AZURE_AI_API_BASE env var or api_base parameter.","messagePattern":"api_base is required for Azure AI Agents\\. Set it via AZURE_AI_API_BASE env var or api_base parameter\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/azure_ai/agents/transformation.py","lineNumber":163,"sourceCode":"        api_base: str | None,\n        api_key: str | None,\n        model: str,\n        optional_params: dict,\n        litellm_params: dict,\n        stream: bool | None = None,\n    ) -> str:\n        \"\"\"\n        Get the base URL for Azure AI Agent Service.\n\n        The actual endpoint will vary based on the operation:\n        - /openai/threads for creating threads\n        - /openai/threads/{thread_id}/messages for adding messages\n        - /openai/threads/{thread_id}/runs for creating runs\n\n        This returns the base URL that will be modified for each operation.\n        \"\"\"\n        if api_base is None:\n            raise ValueError(\n                \"api_base is required for Azure AI Agents. Set it via AZURE_AI_API_BASE env var or api_base parameter.\"\n            )\n\n        # Remove trailing slash if present\n        api_base = api_base.rstrip(\"/\")\n\n        # Return base URL - actual endpoints will be constructed during request\n        return api_base\n\n    def _get_agent_id(self, model: str, optional_params: dict) -> str:\n        \"\"\"\n        Get the agent ID from model or optional_params.\n\n        model format: \"azure_ai/agents/<agent_id>\" or \"agents/<agent_id>\" or just \"<agent_id>\"\n        \"\"\"\n        agent_id: Final = optional_params.get(\"agent_id\") or optional_params.get(\"assistant_id\")\n        if agent_id:\n            return agent_id","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/azure_ai/agents/transformation.py#L145-L181","documentation":"Error \"api_base is required for Azure AI Agents. Set it via AZURE_AI_API_BASE env var or api_base parameter.\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/azure_ai/agents/transformation.py:163 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set AZURE_AI_API_BASE or pass api_base for Azure AI Agents."],"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"}