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]

Merge pull request #25846 from BerriAI/litellm_bedrock_cache_start_negative_cost

ishaan-berrif4764478758f
diff --cc litellm/llms/bedrock/messages/invoke_transformations/anthropic_claude3_transformation.py
index 141d63950aa,67b4ad1b23a..31e0e76fd9f
--- a/litellm/llms/bedrock/messages/invoke_transformations/anthropic_claude3_transformation.py
+++ b/litellm/llms/bedrock/messages/invoke_transformations/anthropic_claude3_transformation.py
@@@ -657,10 -601,12 +685,14 @@@ class AmazonAnthropicClaudeMessagesConf
raw_input = stop_usage.get("input_tokens")
if raw_input is not None:
- delta_usage["input_tokens"] = raw_input if isinstance(raw_input, int) else 0
+ delta_usage["input_tokens"] = (
+ raw_input if isinstance(raw_input, int) else 0
+ )
+ AmazonAnthropicClaudeMessagesConfig._merge_message_start_cache_into_delta_usage(
+ delta_usage, start_usage_snapshot
+ )
+
if delta_usage:
pending_delta["usage"] = delta_usage # type: ignore[arg-type]