- setIsModalVisible(true)}>
+ setIsModalVisible(true)}>
+ Invite User
= ({ userID, accessToken, teams }) =
onOk={handleOk}
onCancel={handleCancel}
>
- Invite a user to login to the Admin UI and create Keys
- Note: SSO Setup Required for this
+
+ Invite a user to login to the Admin UI and create Keys
+
+
+ Note: SSO Setup Required for this
+
-
)}
diff --git a/ui/litellm-dashboard/src/components/leftnav.tsx b/ui/litellm-dashboard/src/components/leftnav.tsx
index c4296f18e..ec2f6b478 100644
--- a/ui/litellm-dashboard/src/components/leftnav.tsx
+++ b/ui/litellm-dashboard/src/components/leftnav.tsx
@@ -1,7 +1,7 @@
import { Layout, Menu } from "antd";
import Link from "next/link";
import { List } from "postcss/lib/list";
-import { Text } from "@tremor/react"
+import { Text } from "@tremor/react";
const { Sider } = Layout;
@@ -54,88 +54,61 @@ const Sidebar: React.FC = ({
style={{ height: "100%", borderRight: 0 }}
>
setPage("api-keys")}>
-
- API Keys
-
+ API Keys setPage("llm-playground")}>
-
- Test Key
-
+ Test Key
-
-
- {
- userRole == "Admin" ? (
- setPage("models")}>
-
- Models
-
-
- ) : null
- }
- {
- userRole == "Admin" ? (
- setPage("usage")}>
-
- Usage
-
+ {userRole == "Admin" ? (
+ setPage("models")}>
+ Models
-
- ) : null
- }
+ ) : null}
+ {userRole == "Admin" ? (
+ setPage("usage")}>
+ Usage
+
+ ) : null}
{userRole == "Admin" ? (
setPage("teams")}>
-
- Teams
-
+ Teams
) : null}
-
-
- {userRole == "Admin" ? (
- setPage("users")}>
-
- Users
-
-
- ) : null}
-
- {
- userRole == "Admin" ? (
- setPage("settings")}>
-
- Logging & Alerts
-
-
- ) : null
- }
-
- {
- userRole == "Admin" ? (
- setPage("general-settings")}>
-
- Router Settings
-
-
- ) : null
- }
-
{userRole == "Admin" ? (
- setPage("admin-panel")}>
-
- Admin
-
+ setPage("users")}>
+ Users
) : null}
- setPage("api_ref")}>
-
- API Reference
-
-
+
+ {userRole == "Admin" ? (
+ setPage("settings")}>
+ Logging & Alerts
+
+ ) : null}
+
+ {userRole == "Admin" ? (
+ setPage("budgets")}>
+ Rate Limits
+
+ ) : null}
+
+ {userRole == "Admin" ? (
+ setPage("general-settings")}>
+ Router Settings
+
+ ) : null}
+
+ {userRole == "Admin" ? (
+ setPage("admin-panel")}>
+ Admin
+
+ ) : null}
+ setPage("api_ref")}>
+ API Reference
+
diff --git a/ui/litellm-dashboard/src/components/networking.tsx b/ui/litellm-dashboard/src/components/networking.tsx
index 56131f4f8..b5aa79065 100644
--- a/ui/litellm-dashboard/src/components/networking.tsx
+++ b/ui/litellm-dashboard/src/components/networking.tsx
@@ -97,6 +97,82 @@ export const modelDeleteCall = async (
}
};
+export const budgetDeleteCall = async (
+ accessToken: string | null,
+ budget_id: string
+) => {
+ console.log(`budget_id in budget delete call: ${budget_id}`);
+
+ if (accessToken == null) {
+ return;
+ }
+
+ try {
+ const url = proxyBaseUrl
+ ? `${proxyBaseUrl}/budget/delete`
+ : `/budget/delete`;
+ const response = await fetch(url, {
+ method: "POST",
+ headers: {
+ Authorization: `Bearer ${accessToken}`,
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify({
+ id: budget_id,
+ }),
+ });
+
+ if (!response.ok) {
+ const errorData = await response.text();
+ message.error("Failed to create key: " + errorData, 10);
+ console.error("Error response from the server:", errorData);
+ throw new Error("Network response was not ok");
+ }
+ const data = await response.json();
+ console.log("API Response:", data);
+ return data;
+ } catch (error) {
+ console.error("Failed to create key:", error);
+ throw error;
+ }
+};
+
+export const budgetCreateCall = async (
+ accessToken: string,
+ formValues: Record // Assuming formValues is an object
+) => {
+ try {
+ console.log("Form Values in budgetCreateCall:", formValues); // Log the form values before making the API call
+
+ console.log("Form Values after check:", formValues);
+ const url = proxyBaseUrl ? `${proxyBaseUrl}/budget/new` : `/budget/new`;
+ const response = await fetch(url, {
+ method: "POST",
+ headers: {
+ Authorization: `Bearer ${accessToken}`,
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify({
+ ...formValues, // Include formValues in the request body
+ }),
+ });
+
+ if (!response.ok) {
+ const errorData = await response.text();
+ message.error("Failed to create key: " + errorData, 10);
+ console.error("Error response from the server:", errorData);
+ throw new Error("Network response was not ok");
+ }
+
+ const data = await response.json();
+ console.log("API Response:", data);
+ return data;
+ // Handle success - you might want to update some state or UI based on the created key
+ } catch (error) {
+ console.error("Failed to create key:", error);
+ throw error;
+ }
+};
export const keyCreateCall = async (
accessToken: string,
userID: string,
@@ -1421,6 +1497,71 @@ export const serviceHealthCheck = async (
}
};
+export const getBudgetList = async (accessToken: String) => {
+ /**
+ * Get all configurable params for setting a budget
+ */
+ try {
+ let url = proxyBaseUrl ? `${proxyBaseUrl}/budget/list` : `/budget/list`;
+
+ //message.info("Requesting model data");
+ const response = await fetch(url, {
+ method: "GET",
+ headers: {
+ Authorization: `Bearer ${accessToken}`,
+ "Content-Type": "application/json",
+ },
+ });
+
+ if (!response.ok) {
+ const errorData = await response.text();
+ message.error(errorData, 10);
+ throw new Error("Network response was not ok");
+ }
+
+ const data = await response.json();
+ //message.info("Received model data");
+ return data;
+ // Handle success - you might want to update some state or UI based on the created key
+ } catch (error) {
+ console.error("Failed to get callbacks:", error);
+ throw error;
+ }
+};
+export const getBudgetSettings = async (accessToken: String) => {
+ /**
+ * Get all configurable params for setting a budget
+ */
+ try {
+ let url = proxyBaseUrl
+ ? `${proxyBaseUrl}/budget/settings`
+ : `/budget/settings`;
+
+ //message.info("Requesting model data");
+ const response = await fetch(url, {
+ method: "GET",
+ headers: {
+ Authorization: `Bearer ${accessToken}`,
+ "Content-Type": "application/json",
+ },
+ });
+
+ if (!response.ok) {
+ const errorData = await response.text();
+ message.error(errorData, 10);
+ throw new Error("Network response was not ok");
+ }
+
+ const data = await response.json();
+ //message.info("Received model data");
+ return data;
+ // Handle success - you might want to update some state or UI based on the created key
+ } catch (error) {
+ console.error("Failed to get callbacks:", error);
+ throw error;
+ }
+};
+
export const getCallbacksCall = async (
accessToken: String,
userID: String,
diff --git a/ui/litellm-dashboard/src/components/view_users.tsx b/ui/litellm-dashboard/src/components/view_users.tsx
index 41c15be9c..3faf4c026 100644
--- a/ui/litellm-dashboard/src/components/view_users.tsx
+++ b/ui/litellm-dashboard/src/components/view_users.tsx
@@ -19,7 +19,7 @@ import {
TabPanel,
Select,
SelectItem,
- Dialog,
+ Dialog,
DialogPanel,
Icon,
TextInput,
@@ -82,8 +82,6 @@ const ViewUserDashboard: React.FC = ({
if (accessToken && token && userRole && userID) {
fetchData();
}
-
-
}, [accessToken, token, userRole, userID, currentPage]);
if (!userData) {
@@ -102,7 +100,7 @@ const ViewUserDashboard: React.FC = ({
return (
- Showing Page {currentPage+1} of {totalPages}
+ Showing Page {currentPage + 1} of {totalPages}