BerriAI/litellm · error · ValueError

Missing required parameter: display_width_px or…

Error message

Missing required parameter: display_width_px or display_height_px

What it means

Anthropic computer-use tool mapping guard: the tool's parameters lack display_width_px or display_height_px, both mandatory for computer-use tools; the request is rejected before it reaches Anthropic.

Solutions

  1. Provide display_width_px or display_height_px in the computer-use tool definition.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/llms/anthropic/chat/transformation.py:695 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/b3376f08e0f4a8bb. Report an issue: GitHub.

Appendix: source

Thrown at litellm/llms/anthropic/chat/transformation.py:695

                input_schema=input_anthropic_schema,
                type="custom",
            )

            _description: Final = tool["function"].get("description")
            if _description is not None:
                _tool["description"] = _description

            returned_tool = _tool

        elif tool["type"].startswith("computer_"):
            ## check if all required 'display_' params are given
            if "parameters" not in tool["function"]:
                raise ValueError("Missing required parameter: parameters")

            _display_width_px: Final[int | None] = tool["function"]["parameters"].get("display_width_px")
            _display_height_px: Final[int | None] = tool["function"]["parameters"].get("display_height_px")
            if _display_width_px is None or _display_height_px is None:
                raise ValueError("Missing required parameter: display_width_px or display_height_px")

            _computer_tool: Final = AnthropicComputerTool(
                type=tool["type"],
                name=tool["function"].get("name", "computer"),
                display_width_px=_display_width_px,
                display_height_px=_display_height_px,
            )

            _display_number: Final = tool["function"]["parameters"].get("display_number")
            if _display_number is not None:
                _computer_tool["display_number"] = _display_number

            returned_tool = _computer_tool
        elif any(tool["type"].startswith(t) for t in ANTHROPIC_HOSTED_TOOLS):
            function_name_obj: Final = tool.get("name", tool.get("function", {}).get("name"))
            if function_name_obj is None or not isinstance(function_name_obj, str):
                raise ValueError("Missing required parameter: name")
            function_name: Final = function_name_obj

View on GitHub (pinned to 77b7c6c40c)