BerriAI/litellm · error · ValueError

Unsupported size value: '{size}'. Use a known size (e.g., '1

Error message

Unsupported size value: '{size}'. Use a known size (e.g., '1024x1024') or a custom 'WIDTHxHEIGHT' string.

What it means

Error "Unsupported size value: '{size}'. Use a known size (e.g., '1024x1024') or a custom 'WIDTHxHEIGHT' string." thrown in BerriAI/litellm.

Source

Thrown at litellm/llms/azure_ai/image_edit/mai_transformation.py:82

        known_sizes: Final = {
            "1024x1024",
            "1792x1024",
            "1024x1792",
            "512x512",
            "256x256",
        }

        if size in known_sizes:
            return

        if "x" in size:
            try:
                tuple(map(int, size.lower().split("x", 1)))
                return
            except ValueError:
                raise ValueError(f"Invalid size format: '{size}'. Expected format 'WIDTHxHEIGHT' (e.g., '1024x1024').")

        raise ValueError(
            f"Unsupported size value: '{size}'. Use a known size (e.g., '1024x1024') or a custom 'WIDTHxHEIGHT' string."
        )

    def validate_environment(
        self,
        headers: dict,
        model: str,
        api_key: str | None = None,
        litellm_params: dict | None = None,
        api_base: str | None = None,
    ) -> dict:
        api_key = AzureFoundryModelInfo.get_api_key(api_key)

        if not api_key:
            raise ValueError(
                f"Azure AI API key is required for model {model}. "
                "Set AZURE_AI_API_KEY environment variable or pass api_key parameter."
            )

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Use a known size or a valid 'WIDTHxHEIGHT' string.

When it happens

Trigger: Thrown at litellm/llms/azure_ai/image_edit/mai_transformation.py:82 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/a51941e2d6369c32. Report an issue: GitHub.