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
Merge remote-tracking branch 'origin/litellm_internal_staging' into fix-responses-batch-usage
mateo-berri83008a916dca
diff --cc litellm/batches/batch_utils.pyindex 60bc1ccf98a,4835fd722bc..1ef6e06abfe--- a/litellm/batches/batch_utils.py+++ b/litellm/batches/batch_utils.py@@@ -431,12 -432,8 +432,12 @@@ def _get_batch_job_usage_from_response_usage_object=response_body.get("usage", None) or {},reasoning_content=None,)- _usage_dict = response_body.get("usage", None) or {}+ from litellm.responses.utils import ResponseAPILoggingUtils++ _usage_dict: Final = response_body.get("usage", None) or {}+ if ResponseAPILoggingUtils._is_response_api_usage(_usage_dict):+ return ResponseAPILoggingUtils._transform_response_api_usage_to_chat_usage(_usage_dict)- usage: Usage = Usage(**_usage_dict)+ usage: Final[Usage] = Usage(**_usage_dict)return usagediff --cc litellm/batches/main.pyindex 073f25d19b8,d6c5f0a509f..61a42f515cc--- a/litellm/batches/main.py+++ b/litellm/batches/main.py@@@ -103,13 -104,13 +104,13 @@@ def _resolve_timeout@clientasync def acreate_batch(completion_window: Literal["24h"],- endpoint: Literal["/v1/chat/completions", "/v1/embeddings", "/v1/completions"],+ endpoint: Literal["/v1/chat/completions", "/v1/embeddings", "/v1/completions", "/v1/responses"],input_file_id: str,custom_llm_provider: Literal["openai", "azure", "vertex_ai", "bedrock", "hosted_vllm"] = "openai",- metadata: Optional[Dict[str, str]] = None,- extra_headers: Optional[Dict[str, str]] = None,- extra_body: Optional[Dict[str, str]] = None,- output_expires_after: Optional[Dict[str, Any]] = None,+ metadata: dict[str, str] | None = None,+ extra_headers: dict[str, str] | None = None,+ extra_body: dict[str, str] | None = None,+ output_expires_after: dict[str, Any] | None = None,**kwargs,) -> LiteLLMBatch:"""@@@ -153,15 -154,15 +154,15 @@@@clientdef create_batch(completion_window: Literal["24h"],- endpoint: Literal["/v1/chat/completions", "/v1/embeddings", "/v1/completions"],+ endpoint: Literal["/v1/chat/completions", "/v1/embeddings", "/v1/completions", "/v1/responses"],input_file_id: str,custom_llm_provider: Literal["openai", "azure", "vertex_ai", "bedrock", "hosted_vllm"] = "openai",- metadata: Optional[Dict[str, str]] = None,- extra_headers: Optional[Dict[str, str]] = None,- extra_body: Optional[Dict[str, str]] = None,- output_expires_after: Optional[Dict[str, Any]] = None,+ metadata: dict[str, str] | None = None,+ extra_headers: dict[str, str] | None = None,+ extra_body: dict[str, str] | None = None,+ output_expires_after: dict[str, Any] | None = None,**kwargs,- ) -> Union[LiteLLMBatch, Coroutine[Any, Any, LiteLLMBatch]]:+ ) -> LiteLLMBatch | Coroutine[Any, Any, LiteLLMBatch]:"""Creates and executes a batch from an uploaded file of request