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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(logging): resolve cache_hit before hidden_params short-circuit in _response_cost_calculator (#21816)
Ishaan Jaff886d168154b0
diff --git a/litellm/litellm_core_utils/litellm_logging.py b/litellm/litellm_core_utils/litellm_logging.pyindex e3e4492098d..258df1bb900 100644--- a/litellm/litellm_core_utils/litellm_logging.py+++ b/litellm/litellm_core_utils/litellm_logging.py@@ -1394,6 +1394,12 @@ class Logging(LiteLLMLoggingBaseClass):used for consistent cost calculation across response headers + logging integrations."""+ if cache_hit is None:+ cache_hit = self.model_call_details.get("cache_hit", False)++ if cache_hit is True:+ return 0.0+if isinstance(result, BaseModel) and hasattr(result, "_hidden_params"):hidden_params = getattr(result, "_hidden_params", {})if (