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]

chat_completion_response_includes_annotations

Ishaan Jaff0f36b8afc2ff
diff --git a/litellm/litellm_core_utils/llm_cost_calc/tool_call_cost_tracking.py b/litellm/litellm_core_utils/llm_cost_calc/tool_call_cost_tracking.py
index 93e5be63110..594b59989ae 100644
--- a/litellm/litellm_core_utils/llm_cost_calc/tool_call_cost_tracking.py
+++ b/litellm/litellm_core_utils/llm_cost_calc/tool_call_cost_tracking.py
@@ -104,7 +104,12 @@ class StandardBuiltInToolCostTracking:
) -> bool:
for _choice in response_object.choices:
message = getattr(_choice, "message", None)
- if message is not None and hasattr(message, "annotations"):
+ if (
+ message is not None
+ and hasattr(message, "annotations")
+ and message.annotations is not None
+ and len(message.annotations) > 0
+ ):
return True
return False