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
Map output_tokens_details of responses API to completion_tokens_details
Sameer Kankute2072dcefa87c
diff --git a/litellm/llms/azure/chat/gpt_5_transformation.py b/litellm/llms/azure/chat/gpt_5_transformation.pyindex 2d0ce8b5bce..87f81d117f0 100644--- a/litellm/llms/azure/chat/gpt_5_transformation.py+++ b/litellm/llms/azure/chat/gpt_5_transformation.py@@ -60,7 +60,6 @@ class AzureOpenAIGPT5Config(AzureOpenAIConfig, OpenAIGPT5Config):message=("Azure OpenAI does not support reasoning_effort='none' for this model. ""Supported values are: 'low', 'medium', and 'high'. "- "Note: gpt-5.1 does support reasoning_effort='none'. ""To drop this parameter, set `litellm.drop_params=True` or for proxy:\n\n""`litellm_settings:\n drop_params: true`\n""Issue: https://github.com/BerriAI/litellm/issues/16704"diff --git a/litellm/responses/utils.py b/litellm/responses/utils.pyindex 198182cf118..ad99609e905 100644--- a/litellm/responses/utils.py+++ b/litellm/responses/utils.py@@ -24,7 +24,12 @@ from litellm.types.llms.openai import (ResponseText,)from litellm.types.responses.main import DecodedResponseId-from litellm.types.utils import PromptTokensDetails, SpecialEnums, Usage+from litellm.types.utils import (+ CompletionTokensDetailsWrapper,+ PromptTokensDetails,+ SpecialEnums,+ Usage,+)class ResponsesAPIRequestUtils:@@ -366,10 +371,11 @@ class ResponsesAPIRequestUtils:Headers from tools.headers in request body should be passed to MCP server."""from starlette.datastructures import Headers+from litellm.proxy._experimental.mcp_server.auth.user_api_key_auth_mcp import (MCPRequestHandler,)-+# Extract headers from secret_fields which contains the original request headersraw_headers_from_request: Optional[Dict[str, str]] = Noneif secret_fields and isinstance(secret_fields, dict):@@ -445,11 +451,20 @@ class ResponseAPILoggingUtils:cached_tokens=response_api_usage.input_tokens_details.cached_tokens,audio_tokens=response_api_usage.input_tokens_details.audio_tokens,)+ completion_tokens_details: Optional[CompletionTokensDetailsWrapper] = None+ if response_api_usage.output_tokens_details:+ completion_tokens_details = CompletionTokensDetailsWrapper(+ reasoning_tokens=getattr(+ response_api_usage.output_tokens_details, "reasoning_tokens", None+ )+ )+chat_usage = Usage(prompt_tokens=prompt_tokens,completion_tokens=completion_tokens,total_tokens=prompt_tokens + completion_tokens,prompt_tokens_details=prompt_tokens_details,+ completion_tokens_details=completion_tokens_details,)# Preserve cost attribute if it exists on ResponseAPIUsage