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
feat(advisor): wire MessagesInterceptor registry into anthropic_messages handler
Ishaan Jafferebc57a157dc5
diff --git a/litellm/llms/anthropic/experimental_pass_through/messages/handler.py b/litellm/llms/anthropic/experimental_pass_through/messages/handler.pyindex 3da118fd349..c400d82b7cf 100644--- a/litellm/llms/anthropic/experimental_pass_through/messages/handler.py+++ b/litellm/llms/anthropic/experimental_pass_through/messages/handler.py@@ -26,6 +26,7 @@ from litellm.utils import ProviderConfigManager, clientfrom ..adapters.handler import LiteLLMMessagesToCompletionTransformationHandlerfrom ..responses_adapters.handler import LiteLLMMessagesToResponsesAPIHandler+from .interceptors import get_messages_interceptorsfrom .utils import AnthropicMessagesRequestUtils, mock_response# Providers that are routed directly to the OpenAI Responses API instead of@@ -236,6 +237,23 @@ async def anthropic_messages(if short_circuit_response is not None:return short_circuit_response+ # Run registered MessagesInterceptors (e.g. advisor orchestration loop).+ # api_key and api_base are explicit params (not in **kwargs) so pass them+ # explicitly so interceptor sub-calls can route to the same backend.+ for interceptor in get_messages_interceptors():+ if interceptor.can_handle(tools, custom_llm_provider):+ return await interceptor.handle(+ model=model,+ messages=messages,+ tools=tools,+ stream=original_stream,+ max_tokens=max_tokens,+ custom_llm_provider=custom_llm_provider,+ api_key=api_key,+ api_base=api_base,+ **kwargs,+ )+loop = asyncio.get_event_loop()kwargs["is_async"] = True