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]

Option to pre fill custom proxy base URL

yuneng-jiangf434d1c847a9
diff --git a/ui/litellm-dashboard/src/components/playground/chat_ui/ChatUI.test.tsx b/ui/litellm-dashboard/src/components/playground/chat_ui/ChatUI.test.tsx
index d992ff0ecb4..8d64d727189 100644
--- a/ui/litellm-dashboard/src/components/playground/chat_ui/ChatUI.test.tsx
+++ b/ui/litellm-dashboard/src/components/playground/chat_ui/ChatUI.test.tsx
@@ -19,7 +19,7 @@ vi.mock("../networking", () => ({
// Mock scrollIntoView which is not available in jsdom
beforeEach(() => {
- Element.prototype.scrollIntoView = () => {};
+ Element.prototype.scrollIntoView = () => { };
});
describe("ChatUI", () => {
@@ -270,4 +270,43 @@ describe("ChatUI", () => {
expect(mcpSelect).not.toHaveClass("ant-select-disabled");
});
});
+
+ it("should show Fill button and populate customProxyBaseUrl when proxySettings.LITELLM_UI_API_DOC_BASE_URL is provided", async () => {
+ const testProxyUrl = "http://localhost:5000";
+
+ render(
+ <ChatUI
+ accessToken="1234567890"
+ token="1234567890"
+ userRole="user"
+ userID="1234567890"
+ disabledPersonalKeyCreation={false}
+ proxySettings={{
+ LITELLM_UI_API_DOC_BASE_URL: testProxyUrl,
+ }}
+ />,
+ );
+
+ await waitFor(() => {
+ expect(screen.getByText("Test Key")).toBeInTheDocument();
+ });
+
+ const fillButton = screen.getByText("Fill");
+ expect(fillButton).toBeInTheDocument();
+
+ act(() => {
+ fireEvent.click(fillButton);
+ });
+
+ await waitFor(() => {
+ expect(sessionStorage.getItem("customProxyBaseUrl")).toBe(testProxyUrl);
+ });
+
+ await waitFor(() => {
+ expect(screen.queryByText("Fill")).toBeNull();
+ });
+
+ const customProxyInput = screen.getByPlaceholderText("Optional: Enter custom proxy URL (e.g., http://localhost:5000)");
+ expect(customProxyInput).toHaveValue(testProxyUrl);
+ });
});
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 cbdffe46819..801a9b8391f 100644
--- a/ui/litellm-dashboard/src/components/playground/chat_ui/ChatUI.tsx
+++ b/ui/litellm-dashboard/src/components/playground/chat_ui/ChatUI.tsx
@@ -10,6 +10,7 @@ import {
FilePdfOutlined,
InfoCircleOutlined,
KeyOutlined,
+ LinkOutlined,
LoadingOutlined,
PictureOutlined,
RobotOutlined,
@@ -1172,9 +1173,23 @@ const ChatUI: React.FC<ChatUIProps> = ({
<div>
<div className="flex items-center justify-between mb-2">
- <Text className="font-medium text-gray-700 flex items-center">
+ <Text className="ont-medium block text-gray-700 flex items-center">
<SettingOutlined className="mr-2" /> Custom Proxy Base URL
</Text>
+ {proxySettings?.LITELLM_UI_API_DOC_BASE_URL && !customProxyBaseUrl && (
+ <Button
+ type="link"
+ size="small"
+ icon={<LinkOutlined />}
+ onClick={() => {
+ setCustomProxyBaseUrl(proxySettings.LITELLM_UI_API_DOC_BASE_URL || "");
+ sessionStorage.setItem("customProxyBaseUrl", proxySettings.LITELLM_UI_API_DOC_BASE_URL || "");
+ }}
+ className="text-gray-500 hover:text-gray-700"
+ >
+ Fill
+ </Button>
+ )}
{customProxyBaseUrl && (
<Button
type="link"
@@ -1219,7 +1234,7 @@ const ChatUI: React.FC<ChatUIProps> = ({
try {
sessionStorage.removeItem("selectedModel");
sessionStorage.removeItem("selectedAgent");
- } catch {}
+ } catch { }
}}
className="mb-4"
/>
@@ -1575,7 +1590,7 @@ const ChatUI: React.FC<ChatUIProps> = ({
enabled={codeInterpreter.enabled}
onEnabledChange={codeInterpreter.setEnabled}
selectedContainerId={null}
- onContainerChange={() => {}}
+ onContainerChange={() => { }}
selectedModel={selectedModel || ""}
/>
</div>
@@ -2071,11 +2086,10 @@ const ChatUI: React.FC<ChatUIProps> = ({
}
>
<button
- className={`p-1.5 rounded-md transition-colors ${
- codeInterpreter.enabled
- ? "bg-blue-100 text-blue-600"
- : "text-gray-400 hover:text-gray-600 hover:bg-gray-100"
- }`}
+ className={`p-1.5 rounded-md transition-colors ${codeInterpreter.enabled
+ ? "bg-blue-100 text-blue-600"
+ : "text-gray-400 hover:text-gray-600 hover:bg-gray-100"
+ }`}
onClick={() => {
codeInterpreter.toggle();
if (!codeInterpreter.enabled) {
@@ -2096,9 +2110,9 @@ const ChatUI: React.FC<ChatUIProps> = ({
onKeyDown={handleKeyDown}
placeholder={
endpointType === EndpointType.CHAT ||
- endpointType === EndpointType.EMBEDDINGS ||
- endpointType === EndpointType.RESPONSES ||
- endpointType === EndpointType.ANTHROPIC_MESSAGES
+ endpointType === EndpointType.EMBEDDINGS ||
+ endpointType === EndpointType.RESPONSES ||
+ endpointType === EndpointType.ANTHROPIC_MESSAGES
? "Type your message... (Shift+Enter for new line)"
: endpointType === EndpointType.A2A_AGENTS
? "Send a message to the A2A agent..."