BerriAI/litellm · error · ValueError

custom_llm_provider is required for Anthropic messages…

Error message

custom_llm_provider is required for Anthropic messages, passed in model={model}, custom_llm_provider={custom_llm_provider}

What it means

Error "custom_llm_provider is required for Anthropic messages, passed in model={model}, custom_llm_provider={custom_llm_provider}" thrown in BerriAI/litellm.

Solutions

  1. Prefix the model with the provider (e.g. 'anthropic/claude-...') or pass custom_llm_provider explicitly.

When it happens

Trigger: Thrown at litellm/llms/anthropic/experimental_pass_through/messages/handler.py:566 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/5728e3fa97df282c. Report an issue: GitHub.

Appendix: source

Thrown at litellm/llms/anthropic/experimental_pass_through/messages/handler.py:566

            api_key=api_key,
            api_base=api_base,
            client=client,
            custom_llm_provider=custom_llm_provider,
            **kwargs,
        )
        if _should_route_to_responses_api(custom_llm_provider):
            return LiteLLMMessagesToResponsesAPIHandler.anthropic_messages_handler(**_shared_kwargs)

        # The in-gateway context_management polyfill runs inside
        # ``async_anthropic_messages_handler`` so it can ``await`` the
        # summarization model for ``compact_20260112``. ``context_management``
        # is passed through as a regular kwarg.
        return LiteLLMMessagesToCompletionTransformationHandler.anthropic_messages_handler(
            **_shared_kwargs,
        )

    if custom_llm_provider is None:
        raise ValueError(
            f"custom_llm_provider is required for Anthropic messages, passed in model={model}, custom_llm_provider={custom_llm_provider}"
        )

    local_vars.update(kwargs)
    anthropic_messages_optional_request_params: Final = (
        AnthropicMessagesRequestUtils.get_requested_anthropic_messages_optional_param(
            params=local_vars,
            model=model,
            drop_params=litellm_params.get("drop_params") is True,
            custom_llm_provider=custom_llm_provider,
        )
    )
    if is_reasoning_auto_summary_enabled():
        thinking_param: Final = anthropic_messages_optional_request_params.get("thinking")
        if isinstance(thinking_param, dict) and thinking_param.get("type") != "disabled":
            anthropic_messages_optional_request_params["thinking"] = {
                **thinking_param,
                "display": "summarized",

View on GitHub (pinned to 77b7c6c40c)