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]

refactor(databricks): drive anthropic-thinking routing via JSON flag.

cohml2bff743f438c
diff --git a/litellm/llms/databricks/chat/transformation.py b/litellm/llms/databricks/chat/transformation.py
index e6e63392e9c..8902f4cb061 100644
--- a/litellm/llms/databricks/chat/transformation.py
+++ b/litellm/llms/databricks/chat/transformation.py
@@ -273,15 +273,14 @@ class DatabricksConfig(DatabricksBase, OpenAILikeChatConfig, AnthropicConfig):
GPT-5/GPT-OSS accept `reasoning_effort` natively and need no
translation.
"""
- model_lower = model.lower()
- if "claude" in model_lower:
- return True
- # Match gemini-2-5 / gemini-2.5 only — not the broader 2.x range, which
- # could catch hypothetical future 2.0/2.6/etc variants that may use a
- # different reasoning contract.
- if "gemini-2-5" in model_lower or "gemini-2.5" in model_lower:
- return True
- return False
+ from litellm.utils import _supports_factory
+
+ normalized = model.lower().replace(".", "-")
+ return _supports_factory(
+ model=normalized,
+ custom_llm_provider="databricks",
+ key="supports_anthropic_thinking_payload",
+ )
def convert_anthropic_tool_to_databricks_tool(
self, tool: Optional[AllAnthropicToolsValues]
diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json
index 70b6b05e6ec..1cd41a40ed4 100644
--- a/litellm/model_prices_and_context_window_backup.json
+++ b/litellm/model_prices_and_context_window_backup.json
@@ -12690,6 +12690,7 @@
"supports_assistant_prefill": true,
"supports_function_calling": true,
"supports_reasoning": true,
+ "supports_anthropic_thinking_payload": true,
"supports_tool_choice": true
},
"databricks/databricks-claude-haiku-4-5": {
@@ -12709,6 +12710,7 @@
"supports_assistant_prefill": true,
"supports_function_calling": true,
"supports_reasoning": true,
+ "supports_anthropic_thinking_payload": true,
"supports_tool_choice": true
},
"databricks/databricks-claude-opus-4": {
@@ -12728,6 +12730,7 @@
"supports_assistant_prefill": true,
"supports_function_calling": true,
"supports_reasoning": true,
+ "supports_anthropic_thinking_payload": true,
"supports_tool_choice": true
},
"databricks/databricks-claude-opus-4-1": {
@@ -12747,6 +12750,7 @@
"supports_assistant_prefill": true,
"supports_function_calling": true,
"supports_reasoning": true,
+ "supports_anthropic_thinking_payload": true,
"supports_tool_choice": true
},
"databricks/databricks-claude-opus-4-5": {
@@ -12766,6 +12770,7 @@
"supports_assistant_prefill": true,
"supports_function_calling": true,
"supports_reasoning": true,
+ "supports_anthropic_thinking_payload": true,
"supports_tool_choice": true,
"supports_output_config": true
},
@@ -12786,6 +12791,7 @@
"supports_assistant_prefill": true,
"supports_function_calling": true,
"supports_reasoning": true,
+ "supports_anthropic_thinking_payload": true,
"supports_tool_choice": true
},
"databricks/databricks-claude-sonnet-4-1": {
@@ -12805,6 +12811,7 @@
"supports_assistant_prefill": true,
"supports_function_calling": true,
"supports_reasoning": true,
+ "supports_anthropic_thinking_payload": true,
"supports_tool_choice": true
},
"databricks/databricks-claude-sonnet-4-5": {
@@ -12824,6 +12831,7 @@
"supports_assistant_prefill": true,
"supports_function_calling": true,
"supports_reasoning": true,
+ "supports_anthropic_thinking_payload": true,
"supports_tool_choice": true
},
"databricks/databricks-gemini-2-5-flash": {
@@ -12841,6 +12849,7 @@
"output_dbu_cost_per_token": 3.5714e-05,
"source": "https://www.databricks.com/product/pricing/proprietary-foundation-model-serving",
"supports_function_calling": true,
+ "supports_anthropic_thinking_payload": true,
"supports_tool_choice": true
},
"databricks/databricks-gemini-2-5-pro": {
@@ -12858,6 +12867,7 @@
"output_dbu_cost_per_token": 0.000142857,
"source": "https://www.databricks.com/product/pricing/proprietary-foundation-model-serving",
"supports_function_calling": true,
+ "supports_anthropic_thinking_payload": true,
"supports_tool_choice": true
},
"databricks/databricks-gemma-3-12b": {
diff --git a/litellm/types/utils.py b/litellm/types/utils.py
index 908f5b76424..10af3fc8866 100644
--- a/litellm/types/utils.py
+++ b/litellm/types/utils.py
@@ -151,6 +151,7 @@ class ProviderSpecificModelInfo(TypedDict, total=False):
supports_max_reasoning_effort: Optional[bool]
supports_output_config: Optional[bool]
supports_image_size: Optional[bool]
+ supports_anthropic_thinking_payload: Optional[bool]
bedrock_output_config_effort_ceiling: Optional[Literal["low", "medium", "high", "max", "xhigh"]]
bedrock_converse_supports_strict_tools: Optional[bool]
diff --git a/litellm/utils.py b/litellm/utils.py
index 19c2fe16085..5f7985b84fd 100644
--- a/litellm/utils.py
+++ b/litellm/utils.py
@@ -5472,6 +5472,7 @@ def _get_model_info_helper(
supports_url_context=_model_info.get("supports_url_context", None),
supports_reasoning=_model_info.get("supports_reasoning", None),
supports_adaptive_thinking=_model_info.get("supports_adaptive_thinking", None),
+ supports_anthropic_thinking_payload=_model_info.get("supports_anthropic_thinking_payload", None),
supports_none_reasoning_effort=_model_info.get("supports_none_reasoning_effort", None),
supports_minimal_reasoning_effort=_model_info.get("supports_minimal_reasoning_effort", None),
supports_low_reasoning_effort=_model_info.get("supports_low_reasoning_effort", None),
diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json
index b961c326625..fb9b192bac5 100644
--- a/model_prices_and_context_window.json
+++ b/model_prices_and_context_window.json
@@ -12690,6 +12690,7 @@
"supports_assistant_prefill": true,
"supports_function_calling": true,
"supports_reasoning": true,
+ "supports_anthropic_thinking_payload": true,
"supports_tool_choice": true
},
"databricks/databricks-claude-haiku-4-5": {
@@ -12709,6 +12710,7 @@
"supports_assistant_prefill": true,
"supports_function_calling": true,
"supports_reasoning": true,
+ "supports_anthropic_thinking_payload": true,
"supports_tool_choice": true
},
"databricks/databricks-claude-opus-4": {
@@ -12728,6 +12730,7 @@
"supports_assistant_prefill": true,
"supports_function_calling": true,
"supports_reasoning": true,
+ "supports_anthropic_thinking_payload": true,
"supports_tool_choice": true
},
"databricks/databricks-claude-opus-4-1": {
@@ -12747,6 +12750,7 @@
"supports_assistant_prefill": true,
"supports_function_calling": true,
"supports_reasoning": true,
+ "supports_anthropic_thinking_payload": true,
"supports_tool_choice": true
},
"databricks/databricks-claude-opus-4-5": {
@@ -12766,6 +12770,7 @@
"supports_assistant_prefill": true,
"supports_function_calling": true,
"supports_reasoning": true,
+ "supports_anthropic_thinking_payload": true,
"supports_tool_choice": true,
"supports_output_config": true
},
@@ -12786,6 +12791,7 @@
"supports_assistant_prefill": true,
"supports_function_calling": true,
"supports_reasoning": true,
+ "supports_anthropic_thinking_payload": true,
"supports_tool_choice": true
},
"databricks/databricks-claude-sonnet-4-1": {
@@ -12805,6 +12811,7 @@
"supports_assistant_prefill": true,
"supports_function_calling": true,
"supports_reasoning": true,
+ "supports_anthropic_thinking_payload": true,
"supports_tool_choice": true
},
"databricks/databricks-claude-sonnet-4-5": {
@@ -12824,6 +12831,7 @@
"supports_assistant_prefill": true,
"supports_function_calling": true,
"supports_reasoning": true,
+ "supports_anthropic_thinking_payload": true,
"supports_tool_choice": true
},
"databricks/databricks-gemini-2-5-flash": {
@@ -12841,6 +12849,7 @@
"output_dbu_cost_per_token": 3.5714e-05,
"source": "https://www.databricks.com/product/pricing/proprietary-foundation-model-serving",
"supports_function_calling": true,
+ "supports_anthropic_thinking_payload": true,
"supports_tool_choice": true
},
"databricks/databricks-gemini-2-5-pro": {
@@ -12858,6 +12867,7 @@
"output_dbu_cost_per_token": 0.000142857,
"source": "https://www.databricks.com/product/pricing/proprietary-foundation-model-serving",
"supports_function_calling": true,
+ "supports_anthropic_thinking_payload": true,
"supports_tool_choice": true
},
"databricks/databricks-gemma-3-12b": {
diff --git a/tests/test_litellm/llms/databricks/chat/test_databricks_chat_transformation.py b/tests/test_litellm/llms/databricks/chat/test_databricks_chat_transformation.py
index 02936e740f7..59872e9962f 100644
--- a/tests/test_litellm/llms/databricks/chat/test_databricks_chat_transformation.py
+++ b/tests/test_litellm/llms/databricks/chat/test_databricks_chat_transformation.py
@@ -8,6 +8,7 @@ from fastapi.testclient import TestClient
sys.path.insert(0, os.path.abspath("../../../../..")) # Adds the parent directory to the system path
from unittest.mock import MagicMock, patch
+import litellm
from litellm.constants import (
DEFAULT_REASONING_EFFORT_HIGH_THINKING_BUDGET,
DEFAULT_REASONING_EFFORT_LOW_THINKING_BUDGET,
@@ -20,6 +21,12 @@ from litellm.llms.databricks.chat.transformation import (
)
[email protected](autouse=True)
+def _use_local_model_cost_map(monkeypatch):
+ monkeypatch.setenv("LITELLM_LOCAL_MODEL_COST_MAP", "True")
+ monkeypatch.setattr(litellm, "model_cost", litellm.get_model_cost_map(url=""))
+
+
def test_transform_choices():
config = DatabricksConfig()
databricks_choices = [