diff --git a/litellm/responses/streaming_iterator.py b/litellm/responses/streaming_iterator.py index 2be9fdbc2a5..e42d845325a 100644 --- a/litellm/responses/streaming_iterator.py +++ b/litellm/responses/streaming_iterator.py @@ -1751,7 +1751,7 @@ def _estimate_usage_from_text( responses_api_request: Mapping[str, object], generated_text: str, *, - use_default_image_token_count: bool, + use_default_image_token_count: bool = False, ) -> ResponseAPIUsage: messages: Final = LiteLLMCompletionResponsesConfig.transform_responses_api_input_to_messages( # pyright: ignore[reportUnknownMemberType] # the transformer's signature is partially untyped input=request_input, # pyright: ignore[reportArgumentType] # the raw Responses API input is a str or ResponseInputParam list, matching the helper's declared union diff --git a/tests/unit/responses/test_streaming_iterator.py b/tests/unit/responses/test_streaming_iterator.py index 663e3b16a16..533b8d5267e 100644 --- a/tests/unit/responses/test_streaming_iterator.py +++ b/tests/unit/responses/test_streaming_iterator.py @@ -1206,7 +1206,7 @@ async def test_completed_event_survives_a_failing_usage_estimate(): malformed_input: Final = [{"type": "message", "role": "user", "content": 42}] with pytest.raises(ValueError, match="Invalid content type"): _estimate_usage_from_text( - "gpt-4o-mini", malformed_input, {"input": malformed_input}, "hello world", use_default_image_token_count=False + "gpt-4o-mini", malformed_input, {"input": malformed_input}, "hello world" ) response = _responses_api_response_without_usage()