BerriAI/litellm · error · Exception

Required 'AZURE_API_BASE' in environment to make pass-throug

Error message

Required 'AZURE_API_BASE' in environment to make pass-through calls to Azure.

What it means

Guard at the fallback path of the Azure pass-through: no per-deployment api_base was resolved, so the proxy falls back to the global AZURE_API_BASE environment variable, which is unset — leaving no target URL for the request.

Source

Thrown at litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py:1427

                extra_headers = auth_credentials.get("headers") or {}

                base_target_url = litellm_params.get("api_base")
                if base_target_url is None:
                    raise Exception(f"API base not found for {part}")
                return await BaseOpenAIPassThroughHandler._base_openai_pass_through_handler(
                    endpoint=endpoint,
                    request=request,
                    fastapi_response=fastapi_response,
                    user_api_key_dict=user_api_key_dict,
                    base_target_url=base_target_url,
                    api_key=None,
                    custom_llm_provider=litellm.LlmProviders.AZURE_AI,
                    extra_headers=cast(dict, extra_headers),
                )

    base_target_url = get_secret_str(secret_name="AZURE_API_BASE")
    if base_target_url is None:
        raise Exception("Required 'AZURE_API_BASE' in environment to make pass-through calls to Azure.")
    # Add or update query parameters
    azure_api_key: Final = passthrough_endpoint_router.get_credentials(
        custom_llm_provider=litellm.LlmProviders.AZURE.value,
        region_name=None,
    )
    if azure_api_key is None:
        raise Exception("Required 'AZURE_API_KEY' in environment to make pass-through calls to Azure.")

    return await BaseOpenAIPassThroughHandler._base_openai_pass_through_handler(
        endpoint=endpoint,
        request=request,
        fastapi_response=fastapi_response,
        user_api_key_dict=user_api_key_dict,
        base_target_url=base_target_url,
        api_key=azure_api_key,
        custom_llm_provider=litellm.LlmProviders.AZURE,
    )

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Set AZURE_API_BASE in the proxy environment to your Azure OpenAI endpoint URL.
  2. Alternatively configure api_base on the Azure deployment in config.yaml.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py:1427 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/38a014f26faaf0be. Report an issue: GitHub.