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_generation/mai_transformation.py:188

            "1792x1024": (1792, 1024),
            "1024x1792": (1024, 1792),
            "512x512": (512, 512),
            "256x256": (256, 256),
        }

        if size in size_mapping:
            width, height = size_mapping[size]
            optional_params["width"] = width
            optional_params["height"] = height
        elif "x" in size:
            try:
                width, height = map(int, size.lower().split("x"))
                optional_params["width"] = width
                optional_params["height"] = height
            except ValueError:
                raise ValueError(f"Invalid size format: '{size}'. Expected format 'WIDTHxHEIGHT' (e.g., '1024x1024').")
        else:
            raise ValueError(
                f"Unsupported size value: '{size}'. "
                f"Use a known size (e.g., '1024x1024') or a custom 'WIDTHxHEIGHT' string."
            )

    def transform_image_generation_response(
        self,
        model: str,
        raw_response: httpx.Response,
        model_response: ImageResponse,
        logging_obj: "LiteLLMLoggingObj",
        request_data: dict,
        optional_params: dict,
        litellm_params: dict,
        encoding: Any,
        api_key: str | None = None,
        json_mode: bool | None = None,
    ) -> ImageResponse:
        try:

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_generation/mai_transformation.py:188 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/fde90796931fc47f. Report an issue: GitHub.