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
fix: fix linting error
Krrish Dholakia8661b3aaa684
diff --git a/litellm/responses/streaming_iterator.py b/litellm/responses/streaming_iterator.pyindex eda3e6921da..b78913402ff 100644--- a/litellm/responses/streaming_iterator.py+++ b/litellm/responses/streaming_iterator.py@@ -93,24 +93,35 @@ class BaseResponsesAPIStreamingIterator:# Store the completed responseif (openai_responses_api_chunk- and openai_responses_api_chunk.type+ and getattr(openai_responses_api_chunk, "type", None)== ResponsesAPIStreamEvents.RESPONSE_COMPLETED):self.completed_response = openai_responses_api_chunk# Add cost to usage object if include_cost_in_streaming_usage is True- if litellm.include_cost_in_streaming_usage and self.logging_obj is not None:- response_obj: Optional[ResponsesAPIResponse] = getattr(openai_responses_api_chunk, "response", None)+ if (+ litellm.include_cost_in_streaming_usage+ and self.logging_obj is not None+ ):+ response_obj: Optional[ResponsesAPIResponse] = getattr(+ openai_responses_api_chunk, "response", None+ )if response_obj:- usage_obj: Optional[ResponseAPIUsage] = getattr(response_obj, "usage", None)+ usage_obj: Optional[ResponseAPIUsage] = getattr(+ response_obj, "usage", None+ )if usage_obj is not None:try:- cost: Optional[float] = self.logging_obj._response_cost_calculator(result=response_obj)+ cost: Optional[float] = (+ self.logging_obj._response_cost_calculator(+ result=response_obj+ )+ )if cost is not None:setattr(usage_obj, "cost", cost)except Exception:# If cost calculation fails, continue without costpass-+self._handle_logging_completed_response()return openai_responses_api_chunk