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: Fix cost calculation for responses
Adam Taof11083e992dd
diff --git a/litellm/responses/utils.py b/litellm/responses/utils.pyindex 336f2b5a947..fdbc692a977 100644--- a/litellm/responses/utils.py+++ b/litellm/responses/utils.py@@ -23,7 +23,7 @@ from litellm.types.llms.openai import (ResponseText,)from litellm.types.responses.main import DecodedResponseId-from litellm.types.utils import SpecialEnums, Usage+from litellm.types.utils import PromptTokensDetails, SpecialEnums, Usageclass ResponsesAPIRequestUtils:@@ -375,8 +375,15 @@ class ResponseAPILoggingUtils:)prompt_tokens: int = response_api_usage.input_tokens or 0completion_tokens: int = response_api_usage.output_tokens or 0+ prompt_tokens_details: Optional[PromptTokensDetails] = None+ if response_api_usage.input_tokens_details:+ prompt_tokens_details = PromptTokensDetails(+ cached_tokens=response_api_usage.input_tokens_details.cached_tokens,+ audio_tokens=response_api_usage.input_tokens_details.audio_tokens,+ )return Usage(prompt_tokens=prompt_tokens,completion_tokens=completion_tokens,total_tokens=prompt_tokens + completion_tokens,- )\ No newline at end of file+ prompt_tokens_details=prompt_tokens_details,+ )