BerriAI/litellm · error · ValueError
api_base is required for Azure OpenAI calls
Error message
api_base is required for Azure OpenAI calls
What it means
Error "api_base is required for Azure OpenAI calls" thrown in BerriAI/litellm.
Solutions
- Pass api_base or set AZURE_API_BASE for the realtime call.
When it happens
Trigger: Thrown at litellm/llms/azure/realtime/handler.py:107 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/3e21ecef9fd4a660.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/llms/azure/realtime/handler.py:107
model: str,
websocket: Any,
logging_obj: LiteLLMLogging,
api_base: str | None = None,
api_key: str | None = None,
api_version: str | None = None,
azure_ad_token: str | None = None,
client: Any | None = None,
timeout: float | None = None,
realtime_protocol: str | None = None,
query_params: RealtimeQueryParams | None = None,
user_api_key_dict: Any | None = None,
litellm_metadata: dict | None = None,
):
import websockets
from websockets.asyncio.client import ClientConnection
if api_base is None:
raise ValueError("api_base is required for Azure OpenAI calls")
backend_uses_beta_protocol: Final = realtime_protocol is None or realtime_protocol.upper() not in ("GA", "V1")
if api_version is None and backend_uses_beta_protocol:
raise ValueError("api_version is required for Azure OpenAI calls")
url: Final = self._construct_url(
api_base,
model,
api_version,
realtime_protocol=realtime_protocol,
query_params=query_params,
)
try:
ssl_context: Final = get_shared_realtime_ssl_context()
async with websockets.connect(
url,
additional_headers={
"api-key": api_key,View on GitHub (pinned to 77b7c6c40c)