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
[Feat] UI - Changed API Base from Select to Input in New LLM Credentials (#15987)
yuneng-jiang4ed9c7d7f2d0
diff --git a/ui/litellm-dashboard/package-lock.json b/ui/litellm-dashboard/package-lock.jsonindex 5f59711ab50..7205738a21c 100644--- a/ui/litellm-dashboard/package-lock.json+++ b/ui/litellm-dashboard/package-lock.json@@ -39,6 +39,7 @@},"devDependencies": {"@tailwindcss/forms": "^0.5.7",+ "@testing-library/dom": "^10.4.1","@testing-library/jest-dom": "^6.8.0","@testing-library/react": "^16.3.0","@testing-library/user-event": "^14.6.1",@@ -5356,6 +5357,26 @@"url": "https://github.com/sponsors/tannerlinsley"}},+ "node_modules/@testing-library/dom": {+ "version": "10.4.1",+ "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.1.tgz",+ "integrity": "sha512-o4PXJQidqJl82ckFaXUeoAW+XysPLauYI43Abki5hABd853iMhitooc6znOnczgbTYmEP6U6/y1ZyKAIsvMKGg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@babel/code-frame": "^7.10.4",+ "@babel/runtime": "^7.12.5",+ "@types/aria-query": "^5.0.1",+ "aria-query": "5.3.0",+ "dom-accessibility-api": "^0.5.9",+ "lz-string": "^1.5.0",+ "picocolors": "1.1.1",+ "pretty-format": "^27.0.2"+ },+ "engines": {+ "node": ">=18"+ }+ },"node_modules/@testing-library/jest-dom": {"version": "6.8.0","resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-6.8.0.tgz",@@ -5462,6 +5483,13 @@"node": ">=10.13.0"}},+ "node_modules/@types/aria-query": {+ "version": "5.0.4",+ "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz",+ "integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==",+ "dev": true,+ "license": "MIT"+ },"node_modules/@types/babel__core": {"version": "7.20.5","resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz",@@ -9823,6 +9851,13 @@"node": ">=6.0.0"}},+ "node_modules/dom-accessibility-api": {+ "version": "0.5.16",+ "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz",+ "integrity": "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==",+ "dev": true,+ "license": "MIT"+ },"node_modules/dom-converter": {"version": "0.2.0","resolved": "https://registry.npmjs.org/dom-converter/-/dom-converter-0.2.0.tgz",@@ -14016,6 +14051,16 @@"react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0"}},+ "node_modules/lz-string": {+ "version": "1.5.0",+ "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz",+ "integrity": "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==",+ "dev": true,+ "license": "MIT",+ "bin": {+ "lz-string": "bin/bin.js"+ }+ },"node_modules/magic-string": {"version": "0.30.19","resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.19.tgz",@@ -17956,6 +18001,41 @@"renderkid": "^3.0.0"}},+ "node_modules/pretty-format": {+ "version": "27.5.1",+ "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz",+ "integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "ansi-regex": "^5.0.1",+ "ansi-styles": "^5.0.0",+ "react-is": "^17.0.1"+ },+ "engines": {+ "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"+ }+ },+ "node_modules/pretty-format/node_modules/ansi-styles": {+ "version": "5.2.0",+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz",+ "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"+ }+ },+ "node_modules/pretty-format/node_modules/react-is": {+ "version": "17.0.2",+ "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz",+ "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==",+ "dev": true,+ "license": "MIT"+ },"node_modules/pretty-time": {"version": "1.1.0","resolved": "https://registry.npmjs.org/pretty-time/-/pretty-time-1.1.0.tgz",diff --git a/ui/litellm-dashboard/package.json b/ui/litellm-dashboard/package.jsonindex 4746b893545..102ea91ae17 100644--- a/ui/litellm-dashboard/package.json+++ b/ui/litellm-dashboard/package.json@@ -44,6 +44,7 @@},"devDependencies": {"@tailwindcss/forms": "^0.5.7",+ "@testing-library/dom": "^10.4.1","@testing-library/jest-dom": "^6.8.0","@testing-library/react": "^16.3.0","@testing-library/user-event": "^14.6.1",diff --git a/ui/litellm-dashboard/src/components/add_model/provider_specific_fields.test.tsx b/ui/litellm-dashboard/src/components/add_model/provider_specific_fields.test.tsxnew file mode 100644index 00000000000..4475cd4ca3f--- /dev/null+++ b/ui/litellm-dashboard/src/components/add_model/provider_specific_fields.test.tsx@@ -0,0 +1,47 @@+import { render, waitFor } from "@testing-library/react";+import { describe, it, expect, beforeAll } from "vitest";+import { Form } from "antd";+import { Providers } from "../provider_info_helpers";+import ProviderSpecificFields from "./provider_specific_fields";++// Mock window.matchMedia for Ant Design components+beforeAll(() => {+ Object.defineProperty(window, "matchMedia", {+ writable: true,+ value: (query: string) => ({+ matches: false,+ media: query,+ onchange: null,+ addListener: () => {}, // deprecated+ removeListener: () => {}, // deprecated+ addEventListener: () => {},+ removeEventListener: () => {},+ dispatchEvent: () => false,+ }),+ });+});++describe("ProviderSpecificFields", () => {+ it("should render the provider specific fields for OpenAI", async () => {+ const { getByLabelText, getByPlaceholderText } = render(+ <Form>+ <ProviderSpecificFields selectedProvider={Providers.OpenAI} />+ </Form>,+ );++ await waitFor(() => {+ // Check for the API Base text input+ const apiBaseInput = getByPlaceholderText("https://api.openai.com/v1");+ expect(apiBaseInput).toBeInTheDocument();+ expect(apiBaseInput).toHaveAttribute("type", "text");++ // Check for Organization field+ const orgInput = getByPlaceholderText("[OPTIONAL] my-unique-org");+ expect(orgInput).toBeInTheDocument();++ // Check for API Key field+ const apiKeyLabel = getByLabelText("OpenAI API Key");+ expect(apiKeyLabel).toBeInTheDocument();+ });+ });+});diff --git a/ui/litellm-dashboard/src/components/add_model/provider_specific_fields.tsx b/ui/litellm-dashboard/src/components/add_model/provider_specific_fields.tsxindex 2d11569ab95..e42f1bfba6a 100644--- a/ui/litellm-dashboard/src/components/add_model/provider_specific_fields.tsx+++ b/ui/litellm-dashboard/src/components/add_model/provider_specific_fields.tsx@@ -68,8 +68,9 @@ const PROVIDER_CREDENTIAL_FIELDS: Record<Providers, ProviderCredentialField[]> ={key: "api_base",label: "API Base",- type: "select",- options: ["https://api.openai.com/v1", "https://eu.api.openai.com"],+ type: "text",+ placeholder: "https://api.openai.com/v1",+ tooltip: "Common endpoints: https://api.openai.com/v1, https://eu.api.openai.com, https://us.api.openai.com",defaultValue: "https://api.openai.com/v1",},{@@ -88,8 +89,9 @@ const PROVIDER_CREDENTIAL_FIELDS: Record<Providers, ProviderCredentialField[]> ={key: "api_base",label: "API Base",- type: "select",- options: ["https://api.openai.com/v1", "https://eu.api.openai.com"],+ type: "text",+ placeholder: "https://api.openai.com/v1",+ tooltip: "Common endpoints: https://api.openai.com/v1, https://eu.api.openai.com, https://us.api.openai.com",defaultValue: "https://api.openai.com/v1",},{@@ -651,7 +653,11 @@ const ProviderSpecificFields: React.FC<ProviderSpecificFieldsProps> = ({ selecte<Button2 icon={<UploadOutlined />}>Click to Upload</Button2></Upload>) : (- <TextInput placeholder={field.placeholder} type={field.type === "password" ? "password" : "text"} />+ <TextInput+ placeholder={field.placeholder}+ type={field.type === "password" ? "password" : "text"}+ defaultValue={field.defaultValue}+ />)}</Form.Item>