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] 404 Not Found on /api/event_logging/batch endpoint (#20504)
Ishaan Jaffd2bd029fa4be
diff --git a/litellm/proxy/anthropic_endpoints/endpoints.py b/litellm/proxy/anthropic_endpoints/endpoints.pyindex 0033deb0766..77bb1f53e62 100644--- a/litellm/proxy/anthropic_endpoints/endpoints.py+++ b/litellm/proxy/anthropic_endpoints/endpoints.py@@ -80,6 +80,7 @@ async def anthropic_response( # noqa: PLR0915# Create Anthropic-formatted response with violation messageimport uuid+from litellm.types.utils import AnthropicMessagesResponse_anthropic_response = AnthropicMessagesResponse(@@ -240,3 +241,19 @@ async def count_tokens(raise HTTPException(status_code=500, detail={"error": f"Internal server error: {str(e)}"})+++ "/api/event_logging/batch",+ tags=["[beta] Anthropic Event Logging"],+)+async def event_logging_batch(+ request: Request,+):+ """+ Stubbed endpoint for Anthropic event logging batch requests.++ This endpoint accepts event logging requests but does nothing with them.+ It exists to prevent 404 errors from Claude Code clients that send telemetry.+ """+ return {"status": "ok"}diff --git a/tests/test_litellm/proxy/anthropic_endpoints/test_endpoints.py b/tests/test_litellm/proxy/anthropic_endpoints/test_endpoints.pyindex 4024983e260..f6189382d74 100644--- a/tests/test_litellm/proxy/anthropic_endpoints/test_endpoints.py+++ b/tests/test_litellm/proxy/anthropic_endpoints/test_endpoints.py@@ -7,6 +7,7 @@ import unittestfrom unittest.mock import AsyncMock, MagicMock, patchimport pytest+from fastapi.testclient import TestClientfrom litellm.proxy.common_request_processing import ProxyBaseLLMRequestProcessing@@ -66,3 +67,22 @@ class TestAnthropicEndpoints(unittest.TestCase):assert (mock_safe_dumps.call_count == 2) # Called twice, once for each dict object+++class TestEventLoggingBatchEndpoint:+ """Test the stubbed event logging batch endpoint"""++ def test_event_logging_batch_endpoint_exists(self):+ """Test that the event_logging_batch endpoint exists and returns 200"""+ from fastapi import FastAPI++ from litellm.proxy.anthropic_endpoints.endpoints import router++ app = FastAPI()+ app.include_router(router)++ client = TestClient(app)+ response = client.post("/api/event_logging/batch", json={"events": []})++ assert response.status_code == 200+ assert response.json() == {"status": "ok"}