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 litellm_gigachat_passthrough_25886
mateo-berri70e2f4e68fb8
diff --cc litellm/proxy/common_request_processing.pyindex 69a2ff53672,c6a6639409a..38867519d80--- a/litellm/proxy/common_request_processing.py+++ b/litellm/proxy/common_request_processing.py@@@ -2423,15 -2411,23 +2440,30 @@@ class ProxyBaseLLMRequestProcessing)logging_obj._on_deferred_stream_complete = _on_deferred_stream_complete+ elif (+ _post_call_guardrails_active+ and route_type == "anthropic_messages"+ and self._is_streaming_response(response)+ ):+ from litellm.litellm_core_utils.logging_worker import (+ GLOBAL_LOGGING_WORKER,+ )++ async def _on_deferred_native_stream_complete(+ logging_coroutine: Coroutine[object, object, object],+ ) -> None:+ GLOBAL_LOGGING_WORKER.ensure_initialized_and_enqueue(async_coroutine=logging_coroutine)++ logging_obj._on_deferred_stream_complete = _on_deferred_native_stream_completeif route_type == "allm_passthrough_route":+ streaming_headers = custom_headers # rebind-ok: initial assignment before header merge+ if hasattr(response, "headers"):+ streaming_headers = ProxyBaseLLMRequestProcessing._merge_passthrough_streaming_headers( # rebind-ok: merge result replaces initial assignment+ response_headers=getattr(response, "headers", None),+ custom_headers=custom_headers,+ )+# Check if response is an async generatorif self._is_streaming_response(response):if asyncio.iscoroutine(response):diff --cc litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.pyindex c7c290dcd2d,525e7099b89..42d45bce3fa--- a/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py+++ b/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py@@@ -28,8 -26,8 +28,9 @@@ from litellm.constants importALLOWED_VERTEX_AI_PASSTHROUGH_HEADERS,BEDROCK_AGENT_RUNTIME_PASS_THROUGH_ROUTES,)+ from litellm.litellm_core_utils.aws_partition import get_aws_dns_suffixfrom litellm.llms.anthropic.common_utils import AnthropicModelInfo+from litellm.llms.custom_httpx.http_handler import get_async_httpx_clientfrom litellm.llms.vertex_ai.vertex_llm_base import VertexBasefrom litellm.proxy._types import *from litellm.proxy.auth.handle_jwt import JWTHandler