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]

Remove limit from admin UI numerical input fix (#15991)

yuneng-jiang64167b7e34e8
diff --git a/ui/litellm-dashboard/src/components/templates/KeyInfoView.handleKeyUpdate.test.tsx b/ui/litellm-dashboard/src/components/templates/KeyInfoView.handleKeyUpdate.test.tsx
index 4b5ed6ae2f9..8257cd62880 100644
--- a/ui/litellm-dashboard/src/components/templates/KeyInfoView.handleKeyUpdate.test.tsx
+++ b/ui/litellm-dashboard/src/components/templates/KeyInfoView.handleKeyUpdate.test.tsx
@@ -332,3 +332,25 @@ describe("KeyInfoView handleKeyUpdate premium guard", () => {
expect(sentPayload.key).toBe("tok_123");
});
});
+
+describe("KeyInfoView handleKeyUpdate empty strings", () => {
+ ["tpm_limit", "rpm_limit", "max_parallel_requests", "max_budget"].forEach((limit) => {
+ it(`maps empty strings to null for ${limit}`, async () => {
+ renderView(true); // premiumUser = true
+
+ fireEvent.click(screen.getByText("Edit Settings"));
+ (globalThis as any).__TEST_FORM_VALUES = {
+ token: "tok_123",
+ [limit]: "",
+ };
+
+ fireEvent.click(screen.getByText("Mock Submit"));
+
+ await waitFor(() => expect(keyUpdateCallMock).toHaveBeenCalled());
+
+ const [sentAccessToken, sentPayload] = keyUpdateCallMock.mock.calls[0];
+ expect(sentAccessToken).toBe("access_abc");
+ expect(sentPayload[limit]).toBeNull();
+ });
+ });
+});
diff --git a/ui/litellm-dashboard/src/components/templates/key_info_view.tsx b/ui/litellm-dashboard/src/components/templates/key_info_view.tsx
index 425b863ff79..9e0c95900f8 100644
--- a/ui/litellm-dashboard/src/components/templates/key_info_view.tsx
+++ b/ui/litellm-dashboard/src/components/templates/key_info_view.tsx
@@ -144,10 +144,10 @@ export default function KeyInfoView({
delete formValues.mcp_tool_permissions;
}
- // Handle max_budget empty string
- if (formValues.max_budget === "") {
- formValues.max_budget = null;
- }
+ formValues.max_budget = mapEmptyStringToNull(formValues.max_budget);
+ formValues.tpm_limit = mapEmptyStringToNull(formValues.tpm_limit);
+ formValues.rpm_limit = mapEmptyStringToNull(formValues.rpm_limit);
+ formValues.max_parallel_requests = mapEmptyStringToNull(formValues.max_parallel_requests);
// Convert metadata back to an object if it exists and is a string
if (formValues.metadata && typeof formValues.metadata === "string") {