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: migrate phase 9 legacy llm provider tests to tests/unit

yunengad523edb254f
diff --git a/tests/test_litellm/llms/litellm_proxy/chat/test_litellm_proxy_chat_transformation.py b/tests/unit/llms/litellm_proxy/chat/test_litellm_proxy_chat_transformation.py
similarity index 100%
rename from tests/test_litellm/llms/litellm_proxy/chat/test_litellm_proxy_chat_transformation.py
rename to tests/unit/llms/litellm_proxy/chat/test_litellm_proxy_chat_transformation.py
diff --git a/tests/test_litellm/llms/litellm_proxy/skills/test_code_execution.py b/tests/unit/llms/litellm_proxy/skills/test_code_execution.py
similarity index 100%
rename from tests/test_litellm/llms/litellm_proxy/skills/test_code_execution.py
rename to tests/unit/llms/litellm_proxy/skills/test_code_execution.py
diff --git a/tests/test_litellm/llms/litellm_proxy/skills/test_skill_search.py b/tests/unit/llms/litellm_proxy/skills/test_skill_search.py
similarity index 100%
rename from tests/test_litellm/llms/litellm_proxy/skills/test_skill_search.py
rename to tests/unit/llms/litellm_proxy/skills/test_skill_search.py
diff --git a/tests/test_litellm/llms/llamafile/chat/test_llamafile_chat_transformation.py b/tests/unit/llms/llamafile/chat/test_llamafile_chat_transformation.py
similarity index 100%
rename from tests/test_litellm/llms/llamafile/chat/test_llamafile_chat_transformation.py
rename to tests/unit/llms/llamafile/chat/test_llamafile_chat_transformation.py
diff --git a/tests/unit/llms/manus/__init__.py b/tests/unit/llms/manus/__init__.py
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/tests/unit/llms/manus/responses/__init__.py b/tests/unit/llms/manus/responses/__init__.py
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/tests/test_litellm/llms/manus/responses/test_manus_responses_transformation.py b/tests/unit/llms/manus/responses/test_manus_responses_transformation.py
similarity index 100%
rename from tests/test_litellm/llms/manus/responses/test_manus_responses_transformation.py
rename to tests/unit/llms/manus/responses/test_manus_responses_transformation.py
diff --git a/tests/test_litellm/llms/meta/realtime/test_meta_realtime_transformation.py b/tests/unit/llms/meta/realtime/test_meta_realtime_transformation.py
similarity index 100%
rename from tests/test_litellm/llms/meta/realtime/test_meta_realtime_transformation.py
rename to tests/unit/llms/meta/realtime/test_meta_realtime_transformation.py
diff --git a/tests/test_litellm/llms/meta_llama/test_meta_llama_chat_transformation.py b/tests/unit/llms/meta_llama/test_meta_llama_chat_transformation.py
similarity index 100%
rename from tests/test_litellm/llms/meta_llama/test_meta_llama_chat_transformation.py
rename to tests/unit/llms/meta_llama/test_meta_llama_chat_transformation.py
diff --git a/tests/unit/llms/minimax/__init__.py b/tests/unit/llms/minimax/__init__.py
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/tests/unit/llms/minimax/chat/__init__.py b/tests/unit/llms/minimax/chat/__init__.py
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/tests/test_litellm/llms/minimax/chat/test_transformation.py b/tests/unit/llms/minimax/chat/test_transformation.py
similarity index 54%
rename from tests/test_litellm/llms/minimax/chat/test_transformation.py
rename to tests/unit/llms/minimax/chat/test_transformation.py
index 9d51b556500..2645b2832aa 100644
--- a/tests/test_litellm/llms/minimax/chat/test_transformation.py
+++ b/tests/unit/llms/minimax/chat/test_transformation.py
@@ -2,14 +2,9 @@
Test MiniMax OpenAI-compatible API support
"""
-import os
from unittest.mock import MagicMock, patch
-import pytest
-
-
import litellm
-from litellm import completion
from litellm.llms.minimax.chat.transformation import MinimaxChatConfig
@@ -107,97 +102,6 @@ def test_minimax_provider_config_manager():
assert isinstance(config, MinimaxChatConfig)
[email protected](reason="Requires actual MiniMax API key")
-def test_minimax_chat_completion_basic():
- """Test basic chat completion with MiniMax OpenAI-compatible API"""
- response = completion(
- model="minimax/MiniMax-M2.1",
- messages=[
- {"role": "system", "content": "You are a helpful assistant."},
- {"role": "user", "content": "Hello, how are you?"},
- ],
- api_key=os.getenv("MINIMAX_API_KEY"),
- api_base="https://api.minimax.io/v1",
- )
-
- assert response is not None
- assert hasattr(response, "choices")
- assert len(response.choices) > 0
-
-
[email protected](reason="Requires actual MiniMax API key")
-def test_minimax_chat_completion_with_reasoning_split():
- """Test completion with reasoning_split parameter (MiniMax M2.1 feature)"""
- response = completion(
- model="minimax/MiniMax-M2.1",
- messages=[
- {"role": "system", "content": "You are a helpful assistant."},
- {"role": "user", "content": "Solve this problem: 2+2=?"},
- ],
- api_key=os.getenv("MINIMAX_API_KEY"),
- api_base="https://api.minimax.io/v1",
- extra_body={"reasoning_split": True},
- )
-
- assert response is not None
- # Check if reasoning_details is present in response
- if hasattr(response.choices[0].message, "reasoning_details"):
- assert response.choices[0].message.reasoning_details is not None
-
-
[email protected](reason="Requires actual MiniMax API key")
-def test_minimax_chat_completion_with_tools():
- """Test completion with tool calling (function calling)"""
- tools = [
- {
- "type": "function",
- "function": {
- "name": "get_weather",
- "description": "Get the current weather in a location",
- "parameters": {
- "type": "object",
- "properties": {
- "location": {
- "type": "string",
- "description": "The city and state, e.g. San Francisco, CA",
- }
- },
- "required": ["location"],
- },
- },
- }
- ]
-
- response = completion(
- model="minimax/MiniMax-M2.1",
- messages=[{"role": "user", "content": "What's the weather in San Francisco?"}],
- tools=tools,
- api_key=os.getenv("MINIMAX_API_KEY"),
- api_base="https://api.minimax.io/v1",
- )
-
- assert response is not None
- assert hasattr(response, "choices")
-
-
[email protected](reason="Requires actual MiniMax API key")
-def test_minimax_chat_completion_streaming():
- """Test streaming completion"""
- response = completion(
- model="minimax/MiniMax-M2.1",
- messages=[{"role": "user", "content": "Count to 5"}],
- stream=True,
- api_key=os.getenv("MINIMAX_API_KEY"),
- api_base="https://api.minimax.io/v1",
- )
-
- chunks = []
- for chunk in response:
- chunks.append(chunk)
-
- assert len(chunks) > 0
-
-
if __name__ == "__main__":
# Run basic tests that don't require API key
print("Testing MiniMax Chat Config...")
diff --git a/tests/unit/llms/minimax/messages/__init__.py b/tests/unit/llms/minimax/messages/__init__.py
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/tests/test_litellm/llms/minimax/messages/test_transformation.py b/tests/unit/llms/minimax/messages/test_transformation.py
similarity index 57%
rename from tests/test_litellm/llms/minimax/messages/test_transformation.py
rename to tests/unit/llms/minimax/messages/test_transformation.py
index c7435a52890..a4b075414e3 100644
--- a/tests/test_litellm/llms/minimax/messages/test_transformation.py
+++ b/tests/unit/llms/minimax/messages/test_transformation.py
@@ -2,14 +2,9 @@
Test MiniMax Anthropic-compatible API support
"""
-import os
from unittest.mock import MagicMock, patch
-import pytest
-
-
import litellm
-from litellm import completion
from litellm.llms.minimax.messages.transformation import MinimaxMessagesConfig
@@ -58,75 +53,6 @@ def test_minimax_provider_config_manager():
assert config.custom_llm_provider == "minimax"
[email protected](reason="Requires actual MiniMax API key")
-def test_minimax_completion_basic():
- """Test basic completion with MiniMax Anthropic-compatible API"""
- response = completion(
- model="minimax/MiniMax-M2.1",
- messages=[{"role": "user", "content": "Hello, how are you?"}],
- api_key=os.getenv("MINIMAX_API_KEY"),
- api_base="https://api.minimax.io/anthropic/v1/messages",
- )
-
- assert response is not None
- assert hasattr(response, "choices")
- assert len(response.choices) > 0
-
-
[email protected](reason="Requires actual MiniMax API key")
-def test_minimax_completion_with_thinking():
- """Test completion with thinking parameter (MiniMax M2.1 feature)"""
- response = completion(
- model="minimax/MiniMax-M2.1",
- messages=[{"role": "user", "content": "Solve this problem: 2+2=?"}],
- api_key=os.getenv("MINIMAX_API_KEY"),
- api_base="https://api.minimax.io/anthropic/v1/messages",
- thinking={"type": "enabled", "budget_tokens": 1000},
- )
-
- assert response is not None
- # Check if thinking content is present in response
- for choice in response.choices:
- if hasattr(choice.message, "content"):
- # MiniMax returns thinking blocks similar to Anthropic
- assert choice.message.content is not None
-
-
[email protected](reason="Requires actual MiniMax API key")
-def test_minimax_completion_with_tools():
- """Test completion with tool calling (function calling)"""
- tools = [
- {
- "type": "function",
- "function": {
- "name": "get_weather",
- "description": "Get the current weather in a location",
- "parameters": {
- "type": "object",
- "properties": {
- "location": {
- "type": "string",
- "description": "The city and state, e.g. San Francisco, CA",
- }
- },
- "required": ["location"],
- },
- },
- }
- ]
-
- response = completion(
- model="minimax/MiniMax-M2.1",
- messages=[{"role": "user", "content": "What's the weather in San Francisco?"}],
- tools=tools,
- api_key=os.getenv("MINIMAX_API_KEY"),
- api_base="https://api.minimax.io/anthropic/v1/messages",
- )
-
- assert response is not None
- assert hasattr(response, "choices")
-
-
if __name__ == "__main__":
# Run basic tests that don't require API key
print("Testing MiniMax Anthropic Config...")
diff --git a/tests/unit/llms/mistral/__init__.py b/tests/unit/llms/mistral/__init__.py
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/tests/test_litellm/llms/mistral/audio_speech/test_mistral_audio_speech_transformation.py b/tests/unit/llms/mistral/audio_speech/test_mistral_audio_speech_transformation.py
similarity index 100%
rename from tests/test_litellm/llms/mistral/audio_speech/test_mistral_audio_speech_transformation.py
rename to tests/unit/llms/mistral/audio_speech/test_mistral_audio_speech_transformation.py
diff --git a/tests/unit/llms/mistral/batches/__init__.py b/tests/unit/llms/mistral/batches/__init__.py
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/tests/test_litellm/llms/mistral/batches/test_mistral_batches_transformation.py b/tests/unit/llms/mistral/batches/test_mistral_batches_transformation.py
similarity index 100%
rename from tests/test_litellm/llms/mistral/batches/test_mistral_batches_transformation.py
rename to tests/unit/llms/mistral/batches/test_mistral_batches_transformation.py
diff --git a/tests/unit/llms/mistral/files/__init__.py b/tests/unit/llms/mistral/files/__init__.py
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/tests/test_litellm/llms/mistral/files/test_mistral_files_transformation.py b/tests/unit/llms/mistral/files/test_mistral_files_transformation.py
similarity index 100%
rename from tests/test_litellm/llms/mistral/files/test_mistral_files_transformation.py
rename to tests/unit/llms/mistral/files/test_mistral_files_transformation.py
diff --git a/tests/unit/llms/mistral/ocr/__init__.py b/tests/unit/llms/mistral/ocr/__init__.py
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py b/tests/unit/llms/mistral/ocr/test_mistral_ocr_transformation.py
similarity index 100%
rename from tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py
rename to tests/unit/llms/mistral/ocr/test_mistral_ocr_transformation.py
diff --git a/tests/test_litellm/llms/modelscope/image_generation/test_modelscope_image_gen_transformation.py b/tests/unit/llms/modelscope/image_generation/test_modelscope_image_gen_transformation.py
similarity index 100%
rename from tests/test_litellm/llms/modelscope/image_generation/test_modelscope_image_gen_transformation.py
rename to tests/unit/llms/modelscope/image_generation/test_modelscope_image_gen_transformation.py
diff --git a/tests/test_litellm/llms/mongodb/vector_stores/test_mongodb_transformation.py b/tests/unit/llms/mongodb/vector_stores/test_mongodb_transformation.py
similarity index 100%
rename from tests/test_litellm/llms/mongodb/vector_stores/test_mongodb_transformation.py
rename to tests/unit/llms/mongodb/vector_stores/test_mongodb_transformation.py
diff --git a/tests/test_litellm/llms/moonshot/test_moonshot_chat_transformation.py b/tests/unit/llms/moonshot/test_moonshot_chat_transformation.py
similarity index 96%
rename from tests/test_litellm/llms/moonshot/test_moonshot_chat_transformation.py
rename to tests/unit/llms/moonshot/test_moonshot_chat_transformation.py
index f94ea5e3db2..c39affc18a8 100644
--- a/tests/test_litellm/llms/moonshot/test_moonshot_chat_transformation.py
+++ b/tests/unit/llms/moonshot/test_moonshot_chat_transformation.py
@@ -19,31 +19,6 @@ from litellm.llms.moonshot.chat.transformation import MoonshotChatConfig
class TestMoonshotConfig:
"""Test class for Moonshot AI functionality"""
- def test_default_api_base(self):
- """Test that default API base is used when none is provided"""
- config = MoonshotChatConfig()
- headers = {}
- api_key = "fake-moonshot-key"
-
- # Call validate_environment without specifying api_base
- result = config.validate_environment(
- headers=headers,
- model="moonshot-v1-8k",
- messages=[{"role": "user", "content": "Hey"}],
- optional_params={},
- litellm_params={},
- api_key=api_key,
- api_base=None, # Not providing api_base
- )
-
- # Verify headers are still set correctly
- assert result["Authorization"] == f"Bearer {api_key}"
- assert result["Content-Type"] == "application/json"
-
- # We can't directly test the api_base value here since validate_environment
- # only returns the headers, but we can verify it doesn't raise an exception
- # which would happen if api_base handling was incorrect
-
def test_get_supported_openai_params(self):
"""Test that get_supported_openai_params returns correct params"""
config = MoonshotChatConfig()
diff --git a/tests/test_litellm/llms/neosantara/test_neosantara.py b/tests/unit/llms/neosantara/test_neosantara.py
similarity index 100%
rename from tests/test_litellm/llms/neosantara/test_neosantara.py
rename to tests/unit/llms/neosantara/test_neosantara.py
diff --git a/tests/test_litellm/llms/nimble/search/test_nimble_search_transformation.py b/tests/unit/llms/nimble/search/test_nimble_search_transformation.py
similarity index 100%
rename from tests/test_litellm/llms/nimble/search/test_nimble_search_transformation.py
rename to tests/unit/llms/nimble/search/test_nimble_search_transformation.py
diff --git a/tests/test_litellm/llms/novita/chat/test_novita_chat_transformation.py b/tests/unit/llms/novita/chat/test_novita_chat_transformation.py
similarity index 85%
rename from tests/test_litellm/llms/novita/chat/test_novita_chat_transformation.py
rename to tests/unit/llms/novita/chat/test_novita_chat_transformation.py
index 3f2a3f77c41..1381cf95a5d 100644
--- a/tests/test_litellm/llms/novita/chat/test_novita_chat_transformation.py
+++ b/tests/unit/llms/novita/chat/test_novita_chat_transformation.py
@@ -54,12 +54,3 @@ class TestNovitaConfig:
)
assert "Missing Novita AI API Key" in str(excinfo.value)
-
- def test_inheritance(self):
- """Test proper inheritance from OpenAIGPTConfig"""
- config = NovitaConfig()
-
- from litellm.llms.openai.chat.gpt_transformation import OpenAIGPTConfig
-
- assert isinstance(config, OpenAIGPTConfig)
- assert hasattr(config, "get_supported_openai_params")
diff --git a/tests/test_litellm/llms/nscale/chat/test_nscale_chat_transformation.py b/tests/unit/llms/nscale/chat/test_nscale_chat_transformation.py
similarity index 100%
rename from tests/test_litellm/llms/nscale/chat/test_nscale_chat_transformation.py
rename to tests/unit/llms/nscale/chat/test_nscale_chat_transformation.py