BerriAI/litellm · error · Exception

Required 'AZURE_API_KEY' in environment to make pass-through

Error message

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

What it means

Guard at the fallback path of the Azure pass-through: no credential supplied an API key, so the proxy falls back to the AZURE_API_KEY environment variable, which is unset — leaving no auth credential to sign the upstream request.

Source

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

                    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,
    )


from abc import ABC, abstractmethod


class BaseVertexAIPassThroughHandler(ABC):
    @staticmethod
    @abstractmethod

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Set AZURE_API_KEY in the proxy environment.
  2. Alternatively store the key on the Azure model entry via the UI (Models + Endpoints → LLM Credentials).
Defensive patterns

Strategy: validation

When it happens

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