diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 2343fe8c35d..9959918b76c 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -4605,10 +4605,6 @@ async def async_data_generator( response=response, request_data=request_data, ): - verbose_proxy_logger.debug( - "async_data_generator: received streaming chunk - {}".format(chunk) - ) - ### CALL HOOKS ### - modify outgoing data chunk = await proxy_logging_obj.async_post_call_streaming_hook( user_api_key_dict=user_api_key_dict, @@ -4629,7 +4625,14 @@ async def async_data_generator( ) if isinstance(chunk, BaseModel): - chunk = chunk.model_dump_json(exclude_none=True, exclude_unset=True) + if getattr(chunk, "_usage_stripped", False): + chunk = chunk.model_dump_json( + exclude_none=True, exclude_unset=True, exclude={"usage"} # type: ignore + ) + else: + chunk = chunk.model_dump_json( + exclude_none=True, exclude_unset=True + ) elif isinstance(chunk, str) and chunk.startswith("data: "): error_message = chunk break