{"record":{"id":"3740b09fe47bea0e","repo":"BerriAI/litellm","slug":"api-base-is-required-for-azure-websocket","errorCode":null,"errorMessage":"api_base is required for Azure WebSocket","messagePattern":"api_base is required for Azure WebSocket","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/azure/responses/transformation.py","lineNumber":189,"sourceCode":"            route=\"/openai/responses\",\n            default_api_version=AZURE_DEFAULT_RESPONSES_API_VERSION,\n        )\n\n    def supports_native_websocket(self) -> bool:\n        return True\n\n    def get_websocket_url(\n        self,\n        api_base: str | None,\n        litellm_params: dict,\n    ) -> str:\n        \"\"\"\n        Azure Responses WebSocket endpoint is at /openai/v1/responses with no\n        api-version query param. Auth is via Authorization header, model is sent\n        in the response.create body — not the URL.\n        \"\"\"\n        if api_base is None:\n            raise ValueError(\"api_base is required for Azure WebSocket\")\n\n        parsed_url: Final = httpx.URL(api_base)\n        path = parsed_url.path.rstrip(\"/\")\n        # Strip existing /openai/responses path if the api_base already contains it\n        for suffix in (\"/openai/v1/responses\", \"/openai/responses\"):\n            if path.endswith(suffix):\n                path = path[: -len(suffix)]\n                break\n        scheme: Final = \"wss\" if parsed_url.scheme == \"https\" else \"ws\"\n        return str(parsed_url.copy_with(scheme=scheme, path=f\"{path}/openai/v1/responses\", query=None))\n\n    def model_in_websocket_url(self) -> bool:\n        # Azure sends the model in the response.create body, not the URL\n        return False\n\n    #########################################################\n    ########## DELETE RESPONSE API TRANSFORMATION ##############\n    #########################################################","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/azure/responses/transformation.py#L171-L207","documentation":"Error \"api_base is required for Azure WebSocket\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/azure/responses/transformation.py:189 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass api_base or set AZURE_API_BASE for the responses WebSocket call."],"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"}