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]

test: tidy price-derivation cleanup

kerry0e8aa60b4107
diff --git a/tests/test_litellm/llms/bedrock/messages/invoke_transformations/test_anthropic_claude3_transformation.py b/tests/test_litellm/llms/bedrock/messages/invoke_transformations/test_anthropic_claude3_transformation.py
index 40233c8502e..619f2a7599d 100644
--- a/tests/test_litellm/llms/bedrock/messages/invoke_transformations/test_anthropic_claude3_transformation.py
+++ b/tests/test_litellm/llms/bedrock/messages/invoke_transformations/test_anthropic_claude3_transformation.py
@@ -9,27 +9,28 @@ from unittest.mock import Mock
import pytest
-from litellm.constants import (
- BEDROCK_MIN_THINKING_BUDGET_TOKENS,
- DEFAULT_REASONING_EFFORT_HIGH_THINKING_BUDGET,
- DEFAULT_REASONING_EFFORT_MEDIUM_THINKING_BUDGET,
- DEFAULT_REASONING_EFFORT_XHIGH_THINKING_BUDGET,
-)
-
# Ensure the project root is on the import path so `litellm` can be imported when
# tests are executed from any working directory.
+
from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj
from litellm.llms.bedrock.common_utils import (
ensure_bedrock_anthropic_messages_tool_names,
normalize_custom_field_on_tools,
normalize_tool_input_schema_types_for_bedrock_invoke,
)
+from litellm.constants import (
+ BEDROCK_MIN_THINKING_BUDGET_TOKENS,
+ DEFAULT_REASONING_EFFORT_HIGH_THINKING_BUDGET,
+ DEFAULT_REASONING_EFFORT_MEDIUM_THINKING_BUDGET,
+ DEFAULT_REASONING_EFFORT_XHIGH_THINKING_BUDGET,
+)
from litellm.llms.bedrock.messages.invoke_transformations.anthropic_claude3_transformation import (
AmazonAnthropicClaudeMessagesConfig,
AmazonAnthropicClaudeMessagesStreamDecoder,
)
+
@pytest.mark.asyncio
async def test_bedrock_sse_wrapper_encodes_dict_chunks():
"""Verify that `bedrock_sse_wrapper` converts dictionary chunks to properly formatted Server-Sent Events and forwards non-dict chunks unchanged."""
@@ -2931,6 +2932,7 @@ def test_bedrock_messages_thinking_shape_follows_exact_bedrock_entry_flag(
forced ``thinking.type='adaptive'`` even with ``supports_adaptive_thinking``
explicitly set to ``false`` on the entry."""
import litellm
+
from litellm.types.router import GenericLiteLLMParams
model = "global.anthropic.claude-opus-4-8"
diff --git a/tests/test_litellm/llms/gemini/realtime/test_gemini_realtime_transformation.py b/tests/test_litellm/llms/gemini/realtime/test_gemini_realtime_transformation.py
index 736602c3968..acafb93e675 100644
--- a/tests/test_litellm/llms/gemini/realtime/test_gemini_realtime_transformation.py
+++ b/tests/test_litellm/llms/gemini/realtime/test_gemini_realtime_transformation.py
@@ -1911,6 +1911,8 @@ def test_gemini_response_done_bills_audio_output_tokens_at_audio_rate(monkeypatc
+ 51 * model_info["output_cost_per_audio_token"]
+ 37 * model_info["output_cost_per_token"]
)
+
+
@pytest.fixture(autouse=False)
def patch_gemini_transcribe_live_cost_map_entry(monkeypatch):
"""Inject the gemini-3.5-transcribe-live registry entry locally.
diff --git a/tests/test_litellm/test_cost_calculator.py b/tests/test_litellm/test_cost_calculator.py
index 7a00345263c..ea8b33ab547 100644
--- a/tests/test_litellm/test_cost_calculator.py
+++ b/tests/test_litellm/test_cost_calculator.py
@@ -569,7 +569,7 @@ def test_realtime_logging_object_does_not_validate_unknown_event_types():
def test_realtime_transcription_duration_cost(monkeypatch):
"""
- gpt-realtime-whisper transcription sessions are billed by input audio duration
+ gpt-realtime-whisper transcription sessions are billed by input audio duration.
The .completed events carry usage {type: duration, seconds: N};
cost must equal total_seconds * input_cost_per_second.
"""