The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
refactor(streaming): copy usage-only chunk instead of mutating the parameter
mateo-berrifbc5c1c3d41c
diff --git a/litellm/litellm_core_utils/streaming_handler.py b/litellm/litellm_core_utils/streaming_handler.pyindex 0e584c73146..43bcf892865 100644--- a/litellm/litellm_core_utils/streaming_handler.py+++ b/litellm/litellm_core_utils/streaming_handler.py@@ -1828,8 +1828,7 @@ class CustomStreamWrapper:"""if getattr(model_response, "usage", None) is None:return- model_response.choices = []- self.chunks.append(model_response)+ self.chunks.append(model_response.model_copy(update={"choices": []}))@staticmethoddef _propagate_usage_cost_to_hidden_params(