BerriAI/litellm · error · APIError

APIError: {exception_provider} - {message}

Error message

APIError: {exception_provider} - {message}

What it means

Error "APIError: {exception_provider} - {message}" thrown in BerriAI/litellm.

Source

Thrown at litellm/litellm_core_utils/exception_mapping_utils.py:481

            )
        elif original_exception.status_code == 503:
            raise ServiceUnavailableError(
                message=f"ServiceUnavailableError: {exception_provider} - {message}",
                model=model,
                llm_provider=custom_llm_provider,
                response=getattr(original_exception, "response", None),
                litellm_debug_info=extra_information,
            )
        elif original_exception.status_code == 504:  # gateway timeout error
            raise Timeout(
                message=f"Timeout Error: {exception_provider} - {message}",
                model=model,
                llm_provider=custom_llm_provider,
                litellm_debug_info=extra_information,
                exception_status_code=original_exception.status_code,
            )
        else:
            raise APIError(
                status_code=original_exception.status_code,
                message=f"APIError: {exception_provider} - {message}",
                llm_provider=custom_llm_provider,
                model=model,
                request=getattr(original_exception, "request", None),
                litellm_debug_info=extra_information,
            )
    else:
        # if no status code then it is an APIConnectionError: https://github.com/openai/openai-python#handling-errors
        # exception_mapping_worked = True
        raise APIConnectionError(
            message=f"APIConnectionError: {exception_provider} - {message}",
            llm_provider=custom_llm_provider,
            model=model,
            litellm_debug_info=extra_information,
            request=httpx.Request(method="POST", url="https://api.openai.com/v1/"),
        )

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Inspect the provider error message; retry or adjust the request accordingly.

When it happens

Trigger: Thrown at litellm/litellm_core_utils/exception_mapping_utils.py:481 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/9a83eb6f22467603. Report an issue: GitHub.