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 pull request #39723 from Atharva-Kanherkar/fix/anthropic-responses-refusal-translation
Mateo Wang41048684581a
diff --cc litellm/llms/anthropic/experimental_pass_through/responses_adapters/transformation.pyindex 62fc06a7c30,9fb44127f5b..f1daf2be42a--- a/litellm/llms/anthropic/experimental_pass_through/responses_adapters/transformation.py+++ b/litellm/llms/anthropic/experimental_pass_through/responses_adapters/transformation.py@@@ -676,13 -700,13 +700,13 @@@ class LiteLLMAnthropicToResponsesAPIAdaid=item.get("call_id") or item.get("id", ""),name=item.get("name", ""),input=input_data,- ).model_dump()+ ).model_dump(exclude_none=True))stop_reason = "tool_use"-- # status -> stop_reason overrideif response.status == "incomplete":stop_reason = "max_tokens"+ elif refusal_text is not None:+ stop_reason = "refusal"anthropic_usage: Final = self.translate_responses_api_usage_to_anthropic_usage(response.usage)