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: stabilize 5 CI test failures
Cursor Agent177edb06ae41
diff --git a/litellm/proxy/_experimental/mcp_server/rest_endpoints.py b/litellm/proxy/_experimental/mcp_server/rest_endpoints.pyindex 28c95e67550..f681b17815d 100644--- a/litellm/proxy/_experimental/mcp_server/rest_endpoints.py+++ b/litellm/proxy/_experimental/mcp_server/rest_endpoints.py@@ -905,6 +905,12 @@ if MCP_AVAILABLE:try:client_id, client_secret, scopes = _extract_credentials(request)+ _oauth2_flow = (+ "client_credentials"+ if client_id and client_secret and request.token_url+ else None+ )+server_model = MCPServer(server_id=request.server_id or "",name=request.alias or request.server_name or "",@@ -922,6 +928,7 @@ if MCP_AVAILABLE:scopes=scopes,authorization_url=request.authorization_url,registration_url=request.registration_url,+ oauth2_flow=_oauth2_flow,)stdio_env = global_mcp_server_manager._build_stdio_env(diff --git a/tests/litellm_utils_tests/test_health_check.py b/tests/litellm_utils_tests/test_health_check.pyindex 963fe4f5b9f..b048590d51a 100644--- a/tests/litellm_utils_tests/test_health_check.py+++ b/tests/litellm_utils_tests/test_health_check.py@@ -83,6 +83,7 @@ async def test_openai_img_gen_health_check():# asyncio.run(test_openai_img_gen_health_check())[email protected](reason="Azure DALL-E 3 model deployment is deprecated (410 ModelDeprecated)")@pytest.mark.asyncioasync def test_azure_img_gen_health_check():"""diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_rest_endpoints.py b/tests/test_litellm/proxy/_experimental/mcp_server/test_rest_endpoints.pyindex 1d296f0440c..3acbe5465f2 100644--- a/tests/test_litellm/proxy/_experimental/mcp_server/test_rest_endpoints.py+++ b/tests/test_litellm/proxy/_experimental/mcp_server/test_rest_endpoints.py@@ -759,12 +759,14 @@ class TestCallToolRestAPI:return ["server-1"]class StubServer:+ server_id = "server-1"alias = "server-1"server_name = "server-1"name = "stub"allowed_tools = Nonemcp_info = {"server_name": "stub"}available_on_public_internet = True+ auth_type = Nonestub_server = StubServer()diff --git a/tests/test_litellm/proxy/management_endpoints/test_team_endpoints.py b/tests/test_litellm/proxy/management_endpoints/test_team_endpoints.pyindex 1aee1d49658..41a724c271d 100644--- a/tests/test_litellm/proxy/management_endpoints/test_team_endpoints.py+++ b/tests/test_litellm/proxy/management_endpoints/test_team_endpoints.py@@ -6142,8 +6142,18 @@ async def test_list_team_v1_batches_key_queries():new_callable=AsyncMock,return_value=[],):- mock_find_many = AsyncMock(return_value=[key1, key2, key3])- mock_prisma_client.db.litellm_verificationtoken.find_many = mock_find_many+ async def filtered_find_many(**kwargs):+ where = kwargs.get("where", {})+ tid = where.get("team_id")+ if tid == "team-1":+ return [key1, key2]+ elif tid == "team-2":+ return [key3]+ return [key1, key2, key3]++ mock_prisma_client.db.litellm_verificationtoken.find_many = AsyncMock(+ side_effect=filtered_find_many+ )result = await list_team(http_request=mock_request,diff --git a/tests/test_litellm/proxy/pass_through_endpoints/test_vertex_ai_batch_passthrough.py b/tests/test_litellm/proxy/pass_through_endpoints/test_vertex_ai_batch_passthrough.pyindex 41a573689f2..602daf1e6ce 100644--- a/tests/test_litellm/proxy/pass_through_endpoints/test_vertex_ai_batch_passthrough.py+++ b/tests/test_litellm/proxy/pass_through_endpoints/test_vertex_ai_batch_passthrough.py@@ -395,7 +395,7 @@ class TestVertexAIBatchCostCalculation:]total_cost, usage = calculate_vertex_ai_batch_cost_and_usage(- responses, model_name="gemini-1.5-flash-001"+ responses, model_name="gemini-2.0-flash-001")assert usage.prompt_tokens == 18@@ -430,7 +430,7 @@ class TestVertexAIBatchCostCalculation:]total_cost, usage = calculate_vertex_ai_batch_cost_and_usage(- responses, model_name="gemini-1.5-flash-001"+ responses, model_name="gemini-2.0-flash-001")assert usage.prompt_tokens == 18@@ -443,7 +443,7 @@ class TestVertexAIBatchCostCalculation:from litellm.batches.batch_utils import calculate_vertex_ai_batch_cost_and_usagetotal_cost, usage = calculate_vertex_ai_batch_cost_and_usage(- [], model_name="gemini-1.5-flash-001"+ [], model_name="gemini-2.0-flash-001")assert total_cost == 0.0@@ -460,7 +460,7 @@ class TestVertexAIBatchCostCalculation:]total_cost, usage = calculate_vertex_ai_batch_cost_and_usage(- responses, model_name="gemini-1.5-flash-001"+ responses, model_name="gemini-2.0-flash-001")assert usage.prompt_tokens == 0