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]

fix: test_create_simple_string_input

Sameer Kankute2d7f0a1351d0
diff --git a/litellm/utils.py b/litellm/utils.py
index fd1ee48850a..65d793fa12f 100644
--- a/litellm/utils.py
+++ b/litellm/utils.py
@@ -6915,6 +6915,8 @@ def get_valid_models(
################################
# init litellm_params
#################################
+ from litellm.types.router import LiteLLM_Params
+
if litellm_params is None:
litellm_params = LiteLLM_Params(model="")
if api_key is not None:
diff --git a/tests/test_litellm/interactions/base_interactions_test.py b/tests/test_litellm/interactions/base_interactions_test.py
index b7748a45f32..fee5758ab5e 100644
--- a/tests/test_litellm/interactions/base_interactions_test.py
+++ b/tests/test_litellm/interactions/base_interactions_test.py
@@ -52,7 +52,13 @@ class BaseInteractionsTest(ABC):
if response.usage:
# Usage is a dict in InteractionsAPIResponse
if isinstance(response.usage, dict):
- assert response.usage.get("input_tokens") is not None or response.usage.get("output_tokens") is not None
+ # Check for both possible key formats: input_tokens/output_tokens or total_input_tokens/total_output_tokens
+ assert (
+ response.usage.get("input_tokens") is not None
+ or response.usage.get("output_tokens") is not None
+ or response.usage.get("total_input_tokens") is not None
+ or response.usage.get("total_output_tokens") is not None
+ )
else:
# If it's an object, check attributes
assert hasattr(response.usage, "input_tokens") or hasattr(response.usage, "output_tokens")