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]

[stripe] opus budget thinking

Colin Lin3046b9f16368
diff --git a/litellm/litellm_core_utils/prompt_templates/common_utils.py b/litellm/litellm_core_utils/prompt_templates/common_utils.py
index c50ceeabdb2..d2c91f4a841 100644
--- a/litellm/litellm_core_utils/prompt_templates/common_utils.py
+++ b/litellm/litellm_core_utils/prompt_templates/common_utils.py
@@ -1071,7 +1071,7 @@ def _parse_content_for_reasoning(
return None, message_text
reasoning_match = re.match(
- r"<(?:think|thinking)>(.*?)</(?:think|thinking)>(.*)", message_text, re.DOTALL
+ r"<(?:think|thinking|budget:thinking)>(.*?)</(?:think|thinking|budget:thinking)>(.*)", message_text, re.DOTALL
)
if reasoning_match:
diff --git a/tests/litellm_utils_tests/test_utils.py b/tests/litellm_utils_tests/test_utils.py
index bffcc91a7a1..ddf97aeddbc 100644
--- a/tests/litellm_utils_tests/test_utils.py
+++ b/tests/litellm_utils_tests/test_utils.py
@@ -1043,6 +1043,11 @@ def test_convert_model_response_object():
"I am thinking here",
"The sky is a canvas of blue",
),
+ (
+ "<budget:thinking>\nLet me work through this step by step.\n</budget:thinking>\n\nYou have **8 fruits** remaining.",
+ "\nLet me work through this step by step.\n",
+ "\n\nYou have **8 fruits** remaining.",
+ ),
("I am a regular response", None, "I am a regular response"),
],
)