Skip to content

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]

fix(anthropic_endpoints.py): publicly expose anthropic v1/messages endpoint

Krrish Dholakia1de2e4ce2827
diff --git a/litellm/proxy/anthropic_endpoints/endpoints.py b/litellm/proxy/anthropic_endpoints/endpoints.py
index 52dc01a86b9..8af9e4d1c18 100644
--- a/litellm/proxy/anthropic_endpoints/endpoints.py
+++ b/litellm/proxy/anthropic_endpoints/endpoints.py
@@ -19,11 +19,11 @@ from litellm.proxy.litellm_pre_call_utils import add_litellm_data_to_request
router = APIRouter()
+
@router.post(
"/v1/messages",
tags=["[beta] Anthropic `/v1/messages`"],
dependencies=[Depends(user_api_key_auth)],
- include_in_schema=False,
)
async def anthropic_response( # noqa: PLR0915
fastapi_response: Response,
@@ -167,11 +167,13 @@ async def anthropic_response( # noqa: PLR0915
if (
"stream" in data and data["stream"] is True
): # use generate_responses to stream responses
- selected_data_generator = ProxyBaseLLMRequestProcessing.async_sse_data_generator(
- response=response,
- user_api_key_dict=user_api_key_dict,
- request_data=data,
- proxy_logging_obj=proxy_logging_obj,
+ selected_data_generator = (
+ ProxyBaseLLMRequestProcessing.async_sse_data_generator(
+ response=response,
+ user_api_key_dict=user_api_key_dict,
+ request_data=data,
+ proxy_logging_obj=proxy_logging_obj,
+ )
)
return await create_streaming_response(