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: move usage mapping imports to top-level for consistency
Chesars9d8e460a5e2d
diff --git a/litellm/responses/litellm_completion_transformation/transformation.py b/litellm/responses/litellm_completion_transformation/transformation.pyindex f172b6a7a2b..15ac5c042b0 100644--- a/litellm/responses/litellm_completion_transformation/transformation.py+++ b/litellm/responses/litellm_completion_transformation/transformation.py@@ -16,6 +16,7 @@ from litellm.responses.litellm_completion_transformation.session_handler importResponsesSessionHandler,)from litellm.responses.format_mapping import (+ chat_usage_to_response_api_usage,finish_reason_to_status,normalize_provider_specific_fields,text_format_to_response_format,@@ -1990,8 +1991,6 @@ class LiteLLMCompletionResponsesConfig:chat_completion_response: Union[ModelResponse, Usage],) -> ResponseAPIUsage:"""Transform Chat Completions Usage to ResponseAPIUsage."""- from litellm.responses.format_mapping import chat_usage_to_response_api_usage-return chat_usage_to_response_api_usage(chat_completion_response)@staticmethoddiff --git a/litellm/responses/utils.py b/litellm/responses/utils.pyindex 7c0bd5b6617..54e2282ba8c 100644--- a/litellm/responses/utils.py+++ b/litellm/responses/utils.py@@ -23,6 +23,7 @@ from litellm.types.llms.openai import (ResponsesAPIResponse,ResponseText,)+from litellm.responses.format_mapping import response_api_usage_to_chat_usagefrom litellm.types.responses.main import DecodedResponseIdfrom litellm.types.utils import (CompletionTokensDetailsWrapper,@@ -652,6 +653,4 @@ class ResponseAPILoggingUtils:usage_input: Optional[Union[dict, ResponseAPIUsage]],) -> Usage:"""Transform ResponseAPIUsage to Chat Completions Usage."""- from litellm.responses.format_mapping import response_api_usage_to_chat_usage-return response_api_usage_to_chat_usage(usage_input)