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(llms): migrate phase 6 provider unit tests to tests/unit

yunenge1d2789d2965
diff --git a/tests/test_litellm/llms/fal_ai/test_cost_calculator.py b/tests/test_litellm/llms/fal_ai/test_cost_calculator.py
deleted file mode 100644
index 419aff42059..00000000000
--- a/tests/test_litellm/llms/fal_ai/test_cost_calculator.py
+++ /dev/null
@@ -1,19 +0,0 @@
-import pytest
-
-import litellm
-from litellm.litellm_core_utils.llm_cost_calc.utils import CostCalculatorUtils
-from litellm.llms.fal_ai.cost_calculator import cost_calculator
-from litellm.types.utils import ImageObject, ImageResponse
-
-
[email protected](autouse=True)
-def _use_local_model_cost_map(monkeypatch):
- monkeypatch.setenv("LITELLM_LOCAL_MODEL_COST_MAP", "True")
- monkeypatch.setattr(litellm, "model_cost", litellm.get_model_cost_map(url=""))
- litellm.get_model_info.cache_clear()
- yield
- litellm.get_model_info.cache_clear()
-
-
-def _image_response(num_images: int = 1) -> ImageResponse:
- return ImageResponse(data=[ImageObject(url="https://example.com/img.png") for _ in range(num_images)])
diff --git a/tests/test_litellm/llms/chatgpt/chat/test_streaming_utils.py b/tests/unit/llms/chatgpt/chat/test_streaming_utils.py
similarity index 100%
rename from tests/test_litellm/llms/chatgpt/chat/test_streaming_utils.py
rename to tests/unit/llms/chatgpt/chat/test_streaming_utils.py
diff --git a/tests/test_litellm/llms/chatgpt/responses/test_chatgpt_responses_transformation.py b/tests/unit/llms/chatgpt/responses/test_chatgpt_responses_transformation.py
similarity index 97%
rename from tests/test_litellm/llms/chatgpt/responses/test_chatgpt_responses_transformation.py
rename to tests/unit/llms/chatgpt/responses/test_chatgpt_responses_transformation.py
index 9bf3eec61f9..c01ec312796 100644
--- a/tests/test_litellm/llms/chatgpt/responses/test_chatgpt_responses_transformation.py
+++ b/tests/unit/llms/chatgpt/responses/test_chatgpt_responses_transformation.py
@@ -19,6 +19,15 @@ from litellm.types.utils import LlmProviders
from litellm.utils import ProviderConfigManager
+def local_model_cost_map(monkeypatch):
+ monkeypatch.setenv("LITELLM_LOCAL_MODEL_COST_MAP", "True")
+ monkeypatch.setattr(litellm, "model_cost", litellm.get_model_cost_map(url=""))
+ litellm.get_model_info.cache_clear()
+ yield
+ litellm.get_model_info.cache_clear()
+
+
class TestChatGPTResponsesAPITransformation:
@pytest.mark.parametrize(
"model_name",
diff --git a/tests/test_litellm/llms/cloudflare/test_cloudflare_transformation.py b/tests/unit/llms/cloudflare/test_cloudflare_transformation.py
similarity index 100%
rename from tests/test_litellm/llms/cloudflare/test_cloudflare_transformation.py
rename to tests/unit/llms/cloudflare/test_cloudflare_transformation.py
diff --git a/tests/test_litellm/llms/cohere/chat/test_cohere_transformation.py b/tests/unit/llms/cohere/chat/test_cohere_transformation.py
similarity index 100%
rename from tests/test_litellm/llms/cohere/chat/test_cohere_transformation.py
rename to tests/unit/llms/cohere/chat/test_cohere_transformation.py
diff --git a/tests/test_litellm/llms/cohere/embed/test_v1_transformation.py b/tests/unit/llms/cohere/embed/test_v1_transformation.py
similarity index 100%
rename from tests/test_litellm/llms/cohere/embed/test_v1_transformation.py
rename to tests/unit/llms/cohere/embed/test_v1_transformation.py
diff --git a/tests/test_litellm/llms/cohere/ocr/test_cohere_parse_transformation.py b/tests/unit/llms/cohere/ocr/test_cohere_parse_transformation.py
similarity index 100%
rename from tests/test_litellm/llms/cohere/ocr/test_cohere_parse_transformation.py
rename to tests/unit/llms/cohere/ocr/test_cohere_parse_transformation.py
diff --git a/tests/test_litellm/llms/cohere/rerank/test_rerank_guardrail_handler.py b/tests/unit/llms/cohere/rerank/test_rerank_guardrail_handler.py
similarity index 100%
rename from tests/test_litellm/llms/cohere/rerank/test_rerank_guardrail_handler.py
rename to tests/unit/llms/cohere/rerank/test_rerank_guardrail_handler.py
diff --git a/tests/test_litellm/llms/crusoe/test_crusoe.py b/tests/unit/llms/crusoe/test_crusoe.py
similarity index 100%
rename from tests/test_litellm/llms/crusoe/test_crusoe.py
rename to tests/unit/llms/crusoe/test_crusoe.py
diff --git a/tests/test_litellm/llms/databricks/chat/test_databricks_chat_transformation.py b/tests/unit/llms/databricks/chat/test_databricks_chat_transformation.py
similarity index 100%
rename from tests/test_litellm/llms/databricks/chat/test_databricks_chat_transformation.py
rename to tests/unit/llms/databricks/chat/test_databricks_chat_transformation.py
diff --git a/tests/test_litellm/llms/databricks/responses/test_databricks_responses_transformation.py b/tests/unit/llms/databricks/responses/test_databricks_responses_transformation.py
similarity index 100%
rename from tests/test_litellm/llms/databricks/responses/test_databricks_responses_transformation.py
rename to tests/unit/llms/databricks/responses/test_databricks_responses_transformation.py
diff --git a/tests/test_litellm/llms/datarobot/chat/test_datarobot_chat_transformation.py b/tests/unit/llms/datarobot/chat/test_datarobot_chat_transformation.py
similarity index 100%
rename from tests/test_litellm/llms/datarobot/chat/test_datarobot_chat_transformation.py
rename to tests/unit/llms/datarobot/chat/test_datarobot_chat_transformation.py
diff --git a/tests/test_litellm/llms/datarobot/test_datarobot.py b/tests/unit/llms/datarobot/test_datarobot.py
similarity index 75%
rename from tests/test_litellm/llms/datarobot/test_datarobot.py
rename to tests/unit/llms/datarobot/test_datarobot.py
index d9f42960601..c98faf0151e 100644
--- a/tests/test_litellm/llms/datarobot/test_datarobot.py
+++ b/tests/unit/llms/datarobot/test_datarobot.py
@@ -78,27 +78,3 @@ def test_completion_datarobot_with_deployment():
except Exception as e:
pytest.fail(f"Error occurred: {e}")
-
-def test_completion_datarobot_with_environment_variables():
- """Allow the test to run with environment variables if they are set for integrations."""
- # If keys are not set, the test will be skipped
- if os.environ.get("DATAROBOT_API_TOKEN") is None:
- return
-
- messages = [
- {"role": "user", "content": "What's the weather like in San Francisco?"}
- ]
- try:
- response = completion(
- model="datarobot/vertex_ai/gemini-1.5-flash-002",
- messages=messages,
- max_tokens=5,
- clientId="custom-model",
- )
- print(response)
- assert response["object"] == "chat.completion"
- assert response["model"] == "gemini-1.5-flash-002"
- assert len(response["choices"]) == 1
- assert len(response["choices"][0]["message"]["content"]) > 0
- except Exception as e:
- pytest.fail(f"Error occurred: {e}")
diff --git a/tests/test_litellm/llms/deepseek/chat/test_deepseek_chat_transformation.py b/tests/unit/llms/deepseek/chat/test_deepseek_chat_transformation.py
similarity index 100%
rename from tests/test_litellm/llms/deepseek/chat/test_deepseek_chat_transformation.py
rename to tests/unit/llms/deepseek/chat/test_deepseek_chat_transformation.py
diff --git a/tests/test_litellm/llms/deepseek/messages/test_deepseek_anthropic_messages_transformation.py b/tests/unit/llms/deepseek/messages/test_deepseek_anthropic_messages_transformation.py
similarity index 100%
rename from tests/test_litellm/llms/deepseek/messages/test_deepseek_anthropic_messages_transformation.py
rename to tests/unit/llms/deepseek/messages/test_deepseek_anthropic_messages_transformation.py
diff --git a/tests/test_litellm/llms/deepseek/test_deepseek_cost_calculator.py b/tests/unit/llms/deepseek/test_deepseek_cost_calculator.py
similarity index 91%
rename from tests/test_litellm/llms/deepseek/test_deepseek_cost_calculator.py
rename to tests/unit/llms/deepseek/test_deepseek_cost_calculator.py
index c3a4cdad0ac..cde4a8a4244 100644
--- a/tests/test_litellm/llms/deepseek/test_deepseek_cost_calculator.py
+++ b/tests/unit/llms/deepseek/test_deepseek_cost_calculator.py
@@ -7,6 +7,16 @@ import litellm
from litellm._internal_context import pinned_billing_time
from litellm.types.utils import ModelResponse, PromptTokensDetailsWrapper, Usage
+
+def local_model_cost_map(monkeypatch):
+ monkeypatch.setenv("LITELLM_LOCAL_MODEL_COST_MAP", "True")
+ monkeypatch.setattr(litellm, "model_cost", litellm.get_model_cost_map(url=""))
+ litellm.get_model_info.cache_clear()
+ yield
+ litellm.get_model_info.cache_clear()
+
+
PEAK_MOMENTS: Final = (
pytest.param(datetime(2026, 9, 22, 8, 0, tzinfo=timezone.utc), id="tuesday-08:00"),
pytest.param(datetime(2026, 9, 25, 9, 59, tzinfo=timezone.utc), id="friday-09:59"),
diff --git a/tests/test_litellm/llms/docker_model_runner/test_docker_model_runner_chat_transformation.py b/tests/unit/llms/docker_model_runner/test_docker_model_runner_chat_transformation.py
similarity index 100%
rename from tests/test_litellm/llms/docker_model_runner/test_docker_model_runner_chat_transformation.py
rename to tests/unit/llms/docker_model_runner/test_docker_model_runner_chat_transformation.py
diff --git a/tests/test_litellm/llms/elevenlabs/test_elevenlabs_text_to_speech_transformation.py b/tests/unit/llms/elevenlabs/test_elevenlabs_text_to_speech_transformation.py
similarity index 100%
rename from tests/test_litellm/llms/elevenlabs/test_elevenlabs_text_to_speech_transformation.py
rename to tests/unit/llms/elevenlabs/test_elevenlabs_text_to_speech_transformation.py
diff --git a/tests/test_litellm/llms/fastcrw/search/test_transformation.py b/tests/unit/llms/fastcrw/search/test_transformation.py
similarity index 100%
rename from tests/test_litellm/llms/fastcrw/search/test_transformation.py
rename to tests/unit/llms/fastcrw/search/test_transformation.py