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: pass application/json for GenericAPILogger (#10772)
Ishaan Jaffa4fb1da2d9be
diff --git a/enterprise/litellm_enterprise/enterprise_callbacks/generic_api_callback.py b/enterprise/litellm_enterprise/enterprise_callbacks/generic_api_callback.pyindex 3db8f0f7cef..d239be41257 100644--- a/enterprise/litellm_enterprise/enterprise_callbacks/generic_api_callback.py+++ b/enterprise/litellm_enterprise/enterprise_callbacks/generic_api_callback.py@@ -74,7 +74,9 @@ class GenericAPILogger(CustomBatchLogger):headers: Optional[dict] = None"""# Process headers from different sources- headers_dict = {}+ headers_dict = {+ "Content-Type": "application/json",+ }# 1. First check for headers from env varenv_headers = os.getenv("GENERIC_LOGGER_HEADERS")diff --git a/tests/logging_callback_tests/test_generic_api_callback.py b/tests/logging_callback_tests/test_generic_api_callback.pyindex c033f323ec8..a2301b0303a 100644--- a/tests/logging_callback_tests/test_generic_api_callback.py+++ b/tests/logging_callback_tests/test_generic_api_callback.py@@ -78,6 +78,9 @@ async def test_generic_api_callback():print("##########\n")print("logs were flushed to URL", actual_url, "with the following headers", mock_post.call_args[1]["headers"])assert actual_url == test_endpoint, f"Expected URL {test_endpoint}, got {actual_url}"++ # Validate headers+ assert mock_post.call_args[1]["headers"]["Content-Type"] == "application/json", "Content-Type should be application/json"# For the GenericAPILogger, it sends the payload directly as JSON in the data fieldjson_data = mock_post.call_args[1]["data"]