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 endpoint
Ishaan Jaffd67fc03e2056
diff --git a/litellm/proxy/health_endpoints/_health_endpoints.py b/litellm/proxy/health_endpoints/_health_endpoints.pyindex 3383fa753bb..c9b954280d8 100644--- a/litellm/proxy/health_endpoints/_health_endpoints.py+++ b/litellm/proxy/health_endpoints/_health_endpoints.py@@ -613,7 +613,6 @@ async def health_liveliness_options():)async def test_model_connection(request: Request,- model: str = fastapi.Body(..., description="The model to test connection with"),mode: Optional[Literal["chat",@@ -657,7 +656,7 @@ async def test_model_connection("""try:# Create basic params for the model- model_params = {"model": model}+ model_params = await request.json()# Run the health check with timeoutresult = await run_with_timeout(diff --git a/ui/litellm-dashboard/src/components/add_model/handle_add_model_submit.tsx b/ui/litellm-dashboard/src/components/add_model/handle_add_model_submit.tsxindex 4a19653a6ab..e9ea366e87e 100644--- a/ui/litellm-dashboard/src/components/add_model/handle_add_model_submit.tsx+++ b/ui/litellm-dashboard/src/components/add_model/handle_add_model_submit.tsx@@ -1,7 +1,8 @@import { message } from "antd";import { provider_map, Providers } from "../provider_info_helpers";-import { modelCreateCall, Model } from "../networking";-+import { modelCreateCall, Model, testConnectionRequest } from "../networking";+import React, { useState } from 'react';+import ConnectionErrorDisplay from './ConnectionErrorDisplay';export const prepareModelAddRequest = async (formValues: Record<string, any>,@@ -175,4 +176,60 @@ export const handleAddModelSubmit = async (}};+export const testModelConnection = async (+ formValues: Record<string, any>,+ accessToken: string,+ testMode: string,+ setConnectionError?: (error: Error | string | null) => void+) => {+ try {+ // Prepare the model data using the existing function+ const result = await prepareModelAddRequest(formValues, accessToken, null);++ if (!result) {+ throw new Error("Failed to prepare model data");+ }++ const { litellmParamsObj, modelInfoObj } = result;++ // Create the request body for the test connection+ const requestBody = {+ ...litellmParamsObj, // Unfurl the parameters directly+ mode: testMode+ };++ // Call the test connection endpoint+ const response = await testConnectionRequest(accessToken, requestBody);++ if (response.status === "success") {+ message.success("Connection test successful!");+ // Clear any previous error when successful+ if (setConnectionError) {+ setConnectionError(null);+ }+ } else {+ // Set the error for ConnectionErrorDisplay instead of showing a message+ const errorMessage = response.message || "Unknown error";+ if (setConnectionError) {+ setConnectionError(errorMessage);+ } else {+ message.error("Connection test failed: " + errorMessage);+ }+ }++ return response;+ } catch (error) {+ console.error("Test connection error:", error);++ // Set the error for ConnectionErrorDisplay+ if (setConnectionError) {+ setConnectionError(error);+ } else {+ message.error("Test connection failed: " + error, 10);+ }++ throw error;+ }+};+