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
Merge remote-tracking branch 'origin/main' into litellm_model_access_denied_message
yassin7267c6bed785
diff --cc ui/litellm-dashboard/src/app/(dashboard)/router-settings/_components/general_settings.integration.test.tsxindex d002d7c116f,b4df567e250..2dc6ecf09e5--- a/ui/litellm-dashboard/src/app/(dashboard)/router-settings/_components/general_settings.integration.test.tsx+++ b/ui/litellm-dashboard/src/app/(dashboard)/router-settings/_components/general_settings.integration.test.tsx@@@ -107,56 -108,41 +116,89 @@@ describe("GeneralSettings General tab"expect(deleteConfigFieldSetting).toHaveBeenCalledWith("token", "max_ui_session_budget");expect(numericValueIn(row)).toBe(1);});++ it("saves a typed model_access_denied_message and resets it when cleared", async () => {+ const user = userEvent.setup();+ renderWithProviders(<GeneralSettings accessToken="token" userRole="Admin" userID="user" />);++ await user.click(screen.getByText("General"));+ const row = await settingsRow("model_access_denied_message");+ const input = within(row).getByRole("textbox") as HTMLInputElement;+ expect(input.value).toBe("");++ fireEvent.change(input, { target: { value: "Model `{model}` is unavailable for this key." } });+ await user.click(within(row).getByRole("button", { name: /update/i }));+ expect(updateConfigFieldSetting).toHaveBeenCalledWith(+ "token",+ "model_access_denied_message",+ "Model `{model}` is unavailable for this key.",+ );++ fireEvent.change(input, { target: { value: "" } });+ await user.click(within(row).getByRole("button", { name: /update/i }));+ expect(deleteConfigFieldSetting).toHaveBeenCalledWith("token", "model_access_denied_message");+ expect(vi.mocked(updateConfigFieldSetting).mock.calls).toHaveLength(1);+ });++ it("keeps the stored value visible when the reset request fails", async () => {+ vi.mocked(getGeneralSettingsCall).mockResolvedValue(+ SETTINGS_FIXTURE.map((s) =>+ s.field_name === "model_access_denied_message"+ ? { ...s, field_value: "Model `{model}` is unavailable.", stored_in_db: true }+ : { ...s },+ ),+ );+ vi.mocked(deleteConfigFieldSetting).mockRejectedValueOnce(new Error("proxy unreachable"));+ const user = userEvent.setup();+ renderWithProviders(<GeneralSettings accessToken="token" userRole="Admin" userID="user" />);++ await user.click(screen.getByText("General"));+ const row = await settingsRow("model_access_denied_message");+ const input = within(row).getByRole("textbox") as HTMLInputElement;+ expect(within(row).getByText("In DB")).toBeInTheDocument();++ fireEvent.change(input, { target: { value: "" } });+ await user.click(within(row).getByRole("button", { name: /update/i }));++ expect(deleteConfigFieldSetting).toHaveBeenCalledWith("token", "model_access_denied_message");+ expect(within(row).getByText("In DB")).toBeInTheDocument();+ expect(within(row).queryByText("Not Set")).not.toBeInTheDocument();+ });});+ describe("GeneralSettings Prompt Caching tab", () => {+ beforeEach(() => {+ vi.mocked(getGeneralSettingsCall).mockResolvedValue([...SETTINGS_FIXTURE.map((s) => ({ ...s }))]);+ vi.mocked(updateConfigFieldSetting).mockClear();+ vi.mocked(deleteConfigFieldSetting).mockClear();+ });++ it("persists openai_system_messages_first when its switch is turned on", async () => {+ const user = userEvent.setup();+ renderWithProviders(<GeneralSettings accessToken="token" userRole="Admin" userID="user" />);++ await user.click(await screen.findByRole("tab", { name: "Prompt Caching" }));+ const toggle = await screen.findByRole("switch", { name: "System messages first for OpenAI" });+ expect(toggle).not.toBeChecked();++ await user.click(toggle);++ expect(toggle).toBeChecked();+ expect(updateConfigFieldSetting).toHaveBeenCalledWith("token", "openai_system_messages_first", true);+ expect(deleteConfigFieldSetting).not.toHaveBeenCalled();+ });++ it("keeps the prompt caching rows off the General tab table", async () => {+ const user = userEvent.setup();+ renderWithProviders(<GeneralSettings accessToken="token" userRole="Admin" userID="user" />);++ await user.click(screen.getByText("General"));+ await settingsRow("max_ui_session_budget");++ expect(screen.queryByText("openai_system_messages_first")).not.toBeInTheDocument();+ });+ });+// The five tabs here are proxy-wide settings. Auto-routers moved to Models + Endpoints.describe("GeneralSettings tabs", () => {beforeEach(() => {