diff --git a/ui/litellm-dashboard/src/components/playground/chat_ui/ChatUI.tsx b/ui/litellm-dashboard/src/components/playground/chat_ui/ChatUI.tsx index cee9db74276..9918040ef64 100644 --- a/ui/litellm-dashboard/src/components/playground/chat_ui/ChatUI.tsx +++ b/ui/litellm-dashboard/src/components/playground/chat_ui/ChatUI.tsx @@ -130,6 +130,9 @@ const ChatUI: React.FC = ({ return disabledPersonalKeyCreation ? "custom" : "session"; }); const [apiKey, setApiKey] = useState(() => sessionStorage.getItem("apiKey") || ""); + const [customProxyBaseUrl, setCustomProxyBaseUrl] = useState( + () => sessionStorage.getItem("customProxyBaseUrl") || "" + ); const [inputMessage, setInputMessage] = useState(""); const [chatHistory, setChatHistory] = useState(() => { try { @@ -392,7 +395,7 @@ const ChatUI: React.FC = ({ const loadAgents = async () => { try { - const agents = await fetchAvailableAgents(userApiKey); + const agents = await fetchAvailableAgents(userApiKey, customProxyBaseUrl || undefined); setAgentInfo(agents); // Clear selection if current agent not in list if (selectedAgent && !agents.some((a) => a.agent_name === selectedAgent)) { @@ -404,7 +407,7 @@ const ChatUI: React.FC = ({ }; loadAgents(); - }, [accessToken, apiKeySource, apiKey, endpointType]); + }, [accessToken, apiKeySource, apiKey, endpointType, customProxyBaseUrl, selectedAgent]); useEffect(() => { // Scroll to the bottom of the chat whenever chatHistory updates @@ -900,6 +903,7 @@ const ChatUI: React.FC = ({ useAdvancedParams ? temperature : undefined, useAdvancedParams ? maxTokens : undefined, updateTotalLatency, + customProxyBaseUrl || undefined, mcpServers, mcpServerToolRestrictions, ); @@ -912,6 +916,7 @@ const ChatUI: React.FC = ({ effectiveApiKey, selectedTags, signal, + customProxyBaseUrl || undefined, ); } else if (endpointType === EndpointType.SPEECH) { // For audio speech @@ -923,6 +928,9 @@ const ChatUI: React.FC = ({ effectiveApiKey, selectedTags, signal, + undefined, // responseFormat + undefined, // speed + customProxyBaseUrl || undefined, ); } else if (endpointType === EndpointType.IMAGE_EDITS) { // For image edits @@ -935,6 +943,7 @@ const ChatUI: React.FC = ({ effectiveApiKey, selectedTags, signal, + customProxyBaseUrl || undefined, ); } } else if (endpointType === EndpointType.RESPONSES) { @@ -973,6 +982,7 @@ const ChatUI: React.FC = ({ handleMCPEvent, // Pass MCP event handler codeInterpreter.enabled, // Enable Code Interpreter tool codeInterpreter.setResult, // Handle code interpreter output + customProxyBaseUrl || undefined, mcpServers, mcpServerToolRestrictions, ); @@ -997,6 +1007,8 @@ const ChatUI: React.FC = ({ traceId, selectedVectorStores.length > 0 ? selectedVectorStores : undefined, selectedGuardrails.length > 0 ? selectedGuardrails : undefined, + selectedMCPTools, // Pass the selected tools array + customProxyBaseUrl || undefined, ); } else if (endpointType === EndpointType.EMBEDDINGS) { await makeOpenAIEmbeddingsRequest( @@ -1005,6 +1017,7 @@ const ChatUI: React.FC = ({ selectedModel, effectiveApiKey, selectedTags, + customProxyBaseUrl || undefined, ); } else if (endpointType === EndpointType.TRANSCRIPTION) { // For audio transcriptions @@ -1016,6 +1029,11 @@ const ChatUI: React.FC = ({ effectiveApiKey, selectedTags, signal, + undefined, // language + undefined, // prompt + undefined, // responseFormat + undefined, // temperature + customProxyBaseUrl || undefined, ); } } @@ -1032,6 +1050,7 @@ const ChatUI: React.FC = ({ updateTimingData, updateTotalLatency, updateA2AMetadata, + customProxyBaseUrl || undefined, ); } } catch (error) { @@ -1156,6 +1175,42 @@ const ChatUI: React.FC = ({ )} +
+
+ + Custom Proxy Base URL + + {customProxyBaseUrl && ( + + )} +
+ { + setCustomProxyBaseUrl(value); + sessionStorage.setItem("customProxyBaseUrl", value); + }} + value={customProxyBaseUrl} + icon={ApiOutlined} + /> + {customProxyBaseUrl && ( + + API calls will be sent to: {customProxyBaseUrl} + + )} +
+
Endpoint Type diff --git a/ui/litellm-dashboard/src/components/playground/compareUI/CompareUI.tsx b/ui/litellm-dashboard/src/components/playground/compareUI/CompareUI.tsx index ff35188bbb5..92bcb21c4b5 100644 --- a/ui/litellm-dashboard/src/components/playground/compareUI/CompareUI.tsx +++ b/ui/litellm-dashboard/src/components/playground/compareUI/CompareUI.tsx @@ -106,6 +106,9 @@ export default function CompareUI({ accessToken, disabledPersonalKeyCreation }: ); const [customApiKey, setCustomApiKey] = useState(""); const [debouncedCustomApiKey, setDebouncedCustomApiKey] = useState(""); + const [customProxyBaseUrl] = useState( + () => sessionStorage.getItem("customProxyBaseUrl") || "" + ); useEffect(() => { const timer = setTimeout(() => { setDebouncedCustomApiKey(customApiKey); @@ -171,7 +174,7 @@ export default function CompareUI({ accessToken, disabledPersonalKeyCreation }: } setIsLoadingAgents(true); try { - const agents = await fetchAvailableAgents(effectiveApiKey); + const agents = await fetchAvailableAgents(effectiveApiKey, customProxyBaseUrl || undefined); if (!active) return; setAgentOptions(agents); } catch (error) { @@ -598,6 +601,8 @@ export default function CompareUI({ accessToken, disabledPersonalKeyCreation }: undefined, (time) => updateTimingDataForComparison(prepared.id, time), (latency) => updateTotalLatencyForComparison(prepared.id, latency), + undefined, // onA2AMetadata + customProxyBaseUrl || undefined, ) : makeOpenAIChatCompletionRequest( prepared.apiChatHistory, @@ -618,6 +623,7 @@ export default function CompareUI({ accessToken, disabledPersonalKeyCreation }: useAdvancedParams ? prepared.temperature : undefined, useAdvancedParams ? prepared.maxTokens : undefined, (latency) => updateTotalLatencyForComparison(prepared.id, latency), + customProxyBaseUrl || undefined, ); requestPromise diff --git a/ui/litellm-dashboard/src/components/playground/llm_calls/a2a_send_message.tsx b/ui/litellm-dashboard/src/components/playground/llm_calls/a2a_send_message.tsx index 94206937f02..0654db32920 100644 --- a/ui/litellm-dashboard/src/components/playground/llm_calls/a2a_send_message.tsx +++ b/ui/litellm-dashboard/src/components/playground/llm_calls/a2a_send_message.tsx @@ -113,8 +113,9 @@ export const makeA2ASendMessageRequest = async ( onTimingData?: (timeToFirstToken: number) => void, onTotalLatency?: (totalLatency: number) => void, onA2AMetadata?: (metadata: A2ATaskMetadata) => void, + customBaseUrl?: string, ): Promise => { - const proxyBaseUrl = getProxyBaseUrl(); + const proxyBaseUrl = customBaseUrl || getProxyBaseUrl(); const url = proxyBaseUrl ? `${proxyBaseUrl}/a2a/${agentId}/message/send` : `/a2a/${agentId}/message/send`; @@ -242,8 +243,9 @@ export const makeA2AStreamMessageRequest = async ( onTimingData?: (timeToFirstToken: number) => void, onTotalLatency?: (totalLatency: number) => void, onA2AMetadata?: (metadata: A2ATaskMetadata) => void, + customBaseUrl?: string, ): Promise => { - const proxyBaseUrl = getProxyBaseUrl(); + const proxyBaseUrl = customBaseUrl || getProxyBaseUrl(); const url = proxyBaseUrl ? `${proxyBaseUrl}/a2a/${agentId}` : `/a2a/${agentId}`; diff --git a/ui/litellm-dashboard/src/components/playground/llm_calls/anthropic_messages.tsx b/ui/litellm-dashboard/src/components/playground/llm_calls/anthropic_messages.tsx index 3aef2f2d5ef..2e8b0be88bb 100644 --- a/ui/litellm-dashboard/src/components/playground/llm_calls/anthropic_messages.tsx +++ b/ui/litellm-dashboard/src/components/playground/llm_calls/anthropic_messages.tsx @@ -17,6 +17,8 @@ export async function makeAnthropicMessagesRequest( traceId?: string, vector_store_ids?: string[], guardrails?: string[], + selectedMCPTools?: string[], + customBaseUrl?: string, ) { if (!accessToken) { throw new Error("Virtual Key is required"); @@ -27,7 +29,7 @@ export async function makeAnthropicMessagesRequest( console.log = function () {}; } - const proxyBaseUrl = getProxyBaseUrl(); + const proxyBaseUrl = customBaseUrl || getProxyBaseUrl(); // Prepare headers with tags and trace ID const headers: Record = {}; diff --git a/ui/litellm-dashboard/src/components/playground/llm_calls/audio_speech.tsx b/ui/litellm-dashboard/src/components/playground/llm_calls/audio_speech.tsx index de2bb761012..c5d4ae4d686 100644 --- a/ui/litellm-dashboard/src/components/playground/llm_calls/audio_speech.tsx +++ b/ui/litellm-dashboard/src/components/playground/llm_calls/audio_speech.tsx @@ -13,6 +13,7 @@ export async function makeOpenAIAudioSpeechRequest( signal?: AbortSignal, responseFormat?: string, speed?: number, + customBaseUrl?: string, ) { // base url should be the current base_url const isLocal = process.env.NODE_ENV === "development"; @@ -20,7 +21,7 @@ export async function makeOpenAIAudioSpeechRequest( console.log = function () {}; } console.log("isLocal:", isLocal); - const proxyBaseUrl = getProxyBaseUrl(); + const proxyBaseUrl = customBaseUrl || getProxyBaseUrl(); const client = new openai.OpenAI({ apiKey: accessToken, baseURL: proxyBaseUrl, diff --git a/ui/litellm-dashboard/src/components/playground/llm_calls/audio_transcriptions.tsx b/ui/litellm-dashboard/src/components/playground/llm_calls/audio_transcriptions.tsx index 61460951ec4..cdc512ba2f7 100644 --- a/ui/litellm-dashboard/src/components/playground/llm_calls/audio_transcriptions.tsx +++ b/ui/litellm-dashboard/src/components/playground/llm_calls/audio_transcriptions.tsx @@ -13,6 +13,7 @@ export async function makeOpenAIAudioTranscriptionRequest( prompt?: string, responseFormat?: string, temperature?: number, + customBaseUrl?: string, ) { // base url should be the current base_url const isLocal = process.env.NODE_ENV === "development"; @@ -20,7 +21,7 @@ export async function makeOpenAIAudioTranscriptionRequest( console.log = function () {}; } console.log("isLocal:", isLocal); - const proxyBaseUrl = getProxyBaseUrl(); + const proxyBaseUrl = customBaseUrl || getProxyBaseUrl(); const client = new openai.OpenAI({ apiKey: accessToken, diff --git a/ui/litellm-dashboard/src/components/playground/llm_calls/chat_completion.tsx b/ui/litellm-dashboard/src/components/playground/llm_calls/chat_completion.tsx index 906c72245fd..24112ca1666 100644 --- a/ui/litellm-dashboard/src/components/playground/llm_calls/chat_completion.tsx +++ b/ui/litellm-dashboard/src/components/playground/llm_calls/chat_completion.tsx @@ -24,6 +24,7 @@ export async function makeOpenAIChatCompletionRequest( temperature?: number, max_tokens?: number, onTotalLatency?: (latency: number) => void, + customBaseUrl?: string, mcpServers?: MCPServer[], mcpServerToolRestrictions?: Record, ) { @@ -33,7 +34,7 @@ export async function makeOpenAIChatCompletionRequest( console.log = function () {}; } console.log("isLocal:", isLocal); - const proxyBaseUrl = getProxyBaseUrl(); + const proxyBaseUrl = customBaseUrl || getProxyBaseUrl(); // Prepare headers with tags and trace ID const headers: Record = {}; if (tags && tags.length > 0) { diff --git a/ui/litellm-dashboard/src/components/playground/llm_calls/embeddings_api.tsx b/ui/litellm-dashboard/src/components/playground/llm_calls/embeddings_api.tsx index d0939c00437..84192a1d866 100644 --- a/ui/litellm-dashboard/src/components/playground/llm_calls/embeddings_api.tsx +++ b/ui/litellm-dashboard/src/components/playground/llm_calls/embeddings_api.tsx @@ -7,6 +7,7 @@ export async function makeOpenAIEmbeddingsRequest( selectedModel: string, accessToken: string, tags?: string[], + customBaseUrl?: string, ) { if (!accessToken) { throw new Error("Virtual Key is required"); @@ -18,7 +19,7 @@ export async function makeOpenAIEmbeddingsRequest( console.log = function () {}; } - const proxyBaseUrl = getProxyBaseUrl(); + const proxyBaseUrl = customBaseUrl || getProxyBaseUrl(); // Prepare headers with tags and trace ID const headers: Record = {}; if (tags && tags.length > 0) { diff --git a/ui/litellm-dashboard/src/components/playground/llm_calls/fetch_agents.tsx b/ui/litellm-dashboard/src/components/playground/llm_calls/fetch_agents.tsx index 054e2216b63..889b012c5f7 100644 --- a/ui/litellm-dashboard/src/components/playground/llm_calls/fetch_agents.tsx +++ b/ui/litellm-dashboard/src/components/playground/llm_calls/fetch_agents.tsx @@ -16,9 +16,12 @@ export interface Agent { /** * Fetches available A2A agents from /v1/agents endpoint. */ -export const fetchAvailableAgents = async (accessToken: string): Promise => { +export const fetchAvailableAgents = async ( + accessToken: string, + customBaseUrl?: string, +): Promise => { try { - const proxyBaseUrl = getProxyBaseUrl(); + const proxyBaseUrl = customBaseUrl || getProxyBaseUrl(); const url = proxyBaseUrl ? `${proxyBaseUrl}/v1/agents` : `/v1/agents`; const response = await fetch(url, { diff --git a/ui/litellm-dashboard/src/components/playground/llm_calls/image_edits.tsx b/ui/litellm-dashboard/src/components/playground/llm_calls/image_edits.tsx index 504798ae8b2..233f4201b17 100644 --- a/ui/litellm-dashboard/src/components/playground/llm_calls/image_edits.tsx +++ b/ui/litellm-dashboard/src/components/playground/llm_calls/image_edits.tsx @@ -10,6 +10,7 @@ export async function makeOpenAIImageEditsRequest( accessToken: string, tags?: string[], signal?: AbortSignal, + customBaseUrl?: string, ) { // base url should be the current base_url const isLocal = process.env.NODE_ENV === "development"; @@ -17,7 +18,7 @@ export async function makeOpenAIImageEditsRequest( console.log = function () {}; } console.log("isLocal:", isLocal); - const proxyBaseUrl = getProxyBaseUrl(); + const proxyBaseUrl = customBaseUrl || getProxyBaseUrl(); const client = new openai.OpenAI({ apiKey: accessToken, diff --git a/ui/litellm-dashboard/src/components/playground/llm_calls/image_generation.tsx b/ui/litellm-dashboard/src/components/playground/llm_calls/image_generation.tsx index 4eb8ea1b551..102b26c6d0d 100644 --- a/ui/litellm-dashboard/src/components/playground/llm_calls/image_generation.tsx +++ b/ui/litellm-dashboard/src/components/playground/llm_calls/image_generation.tsx @@ -9,6 +9,7 @@ export async function makeOpenAIImageGenerationRequest( accessToken: string, tags?: string[], signal?: AbortSignal, + customBaseUrl?: string, ) { // base url should be the current base_url const isLocal = process.env.NODE_ENV === "development"; @@ -16,7 +17,7 @@ export async function makeOpenAIImageGenerationRequest( console.log = function () {}; } console.log("isLocal:", isLocal); - const proxyBaseUrl = getProxyBaseUrl(); + const proxyBaseUrl = customBaseUrl || getProxyBaseUrl(); const client = new openai.OpenAI({ apiKey: accessToken, baseURL: proxyBaseUrl, diff --git a/ui/litellm-dashboard/src/components/playground/llm_calls/responses_api.tsx b/ui/litellm-dashboard/src/components/playground/llm_calls/responses_api.tsx index e30c14111fd..b658610a21e 100644 --- a/ui/litellm-dashboard/src/components/playground/llm_calls/responses_api.tsx +++ b/ui/litellm-dashboard/src/components/playground/llm_calls/responses_api.tsx @@ -33,6 +33,7 @@ export async function makeOpenAIResponsesRequest( onMCPEvent?: (event: MCPEvent) => void, codeInterpreterEnabled?: boolean, onCodeInterpreterResult?: (result: CodeInterpreterResult) => void, + customBaseUrl?: string, mcpServers?: MCPServer[], mcpServerToolRestrictions?: Record, ) { @@ -50,7 +51,7 @@ export async function makeOpenAIResponsesRequest( console.log = function () {}; } - const proxyBaseUrl = getProxyBaseUrl(); + const proxyBaseUrl = customBaseUrl || getProxyBaseUrl(); // Prepare headers with tags and trace ID const headers: Record = {}; if (tags && tags.length > 0) {