BerriAI/litellm · error · ValueError

Unknown partner model: {model}

Error message

Unknown partner model: {model}

What it means

Sentinel from publisher detection for the count-tokens handler: the model name contains none of the known markers (claude, mistral/codestral, llama/meta), so its publisher path segment for the Vertex count-tokens URL is unknown.

Source

Thrown at litellm/llms/vertex_ai/vertex_ai_partner_models/count_tokens/handler.py:44

        Determine the publisher name for the given model.

        Args:
            model: The model name (e.g., "claude-3-5-sonnet-20241022")

        Returns:
            Publisher name to use in the Vertex AI endpoint URL

        Raises:
            ValueError: If the model is not a recognized partner model
        """
        if "claude" in model:
            return "anthropic"
        elif "mistral" in model or "codestral" in model:
            return "mistralai"
        elif "llama" in model or "meta/" in model:
            return "meta"
        else:
            raise ValueError(f"Unknown partner model: {model}")

    def _build_count_tokens_endpoint(
        self,
        model: str,
        project_id: str,
        vertex_location: str,
        api_base: str | None = None,
    ) -> str:
        """
        Build the count-tokens endpoint URL for a partner model.

        Args:
            model: The model name
            project_id: Google Cloud project ID
            vertex_location: Vertex AI location (e.g., "us-east5")
            api_base: Optional custom API base URL

        Returns:

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Use a partner model name recognized by litellm's count_tokens handler (e.g. a supported Claude/Llama/Mistral model on Vertex).
  2. Check the model string spelling and the supported partner-model list in the litellm docs.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at litellm/llms/vertex_ai/vertex_ai_partner_models/count_tokens/handler.py:44 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/a29972a25aeb13e8. Report an issue: GitHub.