From f0928e1423e69b0c2839f5347ab0da6f26d0c1ab Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Mon, 15 Dec 2025 17:21:24 +0530 Subject: [PATCH] Add anthropic tool caching support --- .../litellm_completion_transformation/transformation.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/litellm/responses/litellm_completion_transformation/transformation.py b/litellm/responses/litellm_completion_transformation/transformation.py index 0a42deb559a..da5b3e65cdd 100644 --- a/litellm/responses/litellm_completion_transformation/transformation.py +++ b/litellm/responses/litellm_completion_transformation/transformation.py @@ -705,8 +705,7 @@ class LiteLLMCompletionResponsesConfig: parameters = dict(typed_tool.get("parameters", {}) or {}) if not parameters or "type" not in parameters: parameters["type"] = "object" - chat_completion_tools.append( - ChatCompletionToolParam( + chat_completion_tool = ChatCompletionToolParam( type="function", function=ChatCompletionToolParamFunctionChunk( name=typed_tool.get("name") or "", @@ -715,6 +714,10 @@ class LiteLLMCompletionResponsesConfig: strict=typed_tool.get("strict", False) or False, ), ) + if tool.get("cache_control"): + chat_completion_tool["cache_control"] = tool.get("cache_control") + chat_completion_tools.append( + chat_completion_tool ) return chat_completion_tools, web_search_options