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
(UI) Allow adding models for a Team (#8598) (#8601)
Ishaan Jaff341a63cf8b6f
diff --git a/ui/litellm-dashboard/src/app/page.tsx b/ui/litellm-dashboard/src/app/page.tsxindex d4f99161df3..33d52bc41ad 100644--- a/ui/litellm-dashboard/src/app/page.tsx+++ b/ui/litellm-dashboard/src/app/page.tsx@@ -247,6 +247,7 @@ export default function CreateKeyPage() {modelData={modelData}setModelData={setModelData}premiumUser={premiumUser}+ teams={teams}/>) : page == "llm-playground" ? (<ChatUIdiff --git a/ui/litellm-dashboard/src/components/add_model/advanced_settings.tsx b/ui/litellm-dashboard/src/components/add_model/advanced_settings.tsxindex 3be20d6312e..72c9cdc4a8c 100644--- a/ui/litellm-dashboard/src/components/add_model/advanced_settings.tsx+++ b/ui/litellm-dashboard/src/components/add_model/advanced_settings.tsx@@ -3,16 +3,20 @@ import { Form, Switch, Select, Input } from "antd";import { Text, Button, Accordion, AccordionHeader, AccordionBody, TextInput } from "@tremor/react";import { Row, Col, Typography, Card } from "antd";import TextArea from "antd/es/input/TextArea";+import { Team } from "../key_team_helpers/key_list";+import TeamDropdown from "../common_components/team_dropdown";const { Link } = Typography;interface AdvancedSettingsProps {showAdvancedSettings: boolean;setShowAdvancedSettings: (show: boolean) => void;+ teams?: Team[] | null;}const AdvancedSettings: React.FC<AdvancedSettingsProps> = ({showAdvancedSettings,setShowAdvancedSettings,+ teams,}) => {const [form] = Form.useForm();const [customPricing, setCustomPricing] = React.useState(false);@@ -87,6 +91,14 @@ const AdvancedSettings: React.FC<AdvancedSettingsProps> = ({</AccordionHeader><AccordionBody><div className="bg-white rounded-lg">+ <Form.Item+ label="Team"+ name="team_id"+ className="mb-4"+ >+ <TeamDropdown teams={teams} />+ </Form.Item>+<Form.Itemlabel="Custom Pricing"name="custom_pricing"diff --git a/ui/litellm-dashboard/src/components/add_model/handle_add_model_submit.tsx b/ui/litellm-dashboard/src/components/add_model/handle_add_model_submit.tsxindex f64f6366cdc..4f8a3ae607b 100644--- a/ui/litellm-dashboard/src/components/add_model/handle_add_model_submit.tsx+++ b/ui/litellm-dashboard/src/components/add_model/handle_add_model_submit.tsx@@ -76,6 +76,9 @@ export const handleAddModelSubmit = async (// Add key-value pair to model_info dictionarymodelInfoObj[key] = value;}+ else if (key === "team_id") {+ modelInfoObj["team_id"] = value;+ }else if (key === "custom_model_name") {litellmParamsObj["model"] = value;} else if (key == "litellm_extra_params") {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 f48763a6f49..f23bf1e0156 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@@ -24,7 +24,7 @@ const ProviderSpecificFields: React.FC<ProviderSpecificFieldsProps> = ({return (<>{selectedProviderEnum === Providers.OpenAI && (- <Form.Item label="Organization ID" name="organization">+ <Form.Item label="OpenAI Organization ID" name="organization"><TextInput placeholder="[OPTIONAL] my-unique-org" /></Form.Item>)}diff --git a/ui/litellm-dashboard/src/components/common_components/team_dropdown.tsx b/ui/litellm-dashboard/src/components/common_components/team_dropdown.tsxnew file mode 100644index 00000000000..313c0cd7722--- /dev/null+++ b/ui/litellm-dashboard/src/components/common_components/team_dropdown.tsx@@ -0,0 +1,35 @@+import React from "react";+import { Select } from "antd";+import { Team } from "../key_team_helpers/key_list";++interface TeamDropdownProps {+ teams?: Team[] | null;+ value?: string;+ onChange?: (value: string) => void;+}++const TeamDropdown: React.FC<TeamDropdownProps> = ({ teams, value, onChange }) => {+ return (+ <Select+ showSearch+ placeholder="Search or select a team"+ value={value}+ onChange={onChange}+ filterOption={(input, option) => {+ if (!option) return false;+ const teamAlias = option.children?.[0]?.props?.children || '';+ return teamAlias.toLowerCase().includes(input.toLowerCase());+ }}+ optionFilterProp="children"+ >+ {teams?.map((team) => (+ <Select.Option key={team.team_id} value={team.team_id}>+ <span className="font-medium">{team.team_alias}</span>{" "}+ <span className="text-gray-500">({team.team_id})</span>+ </Select.Option>+ ))}+ </Select>+ );+};++export default TeamDropdown;\ No newline at end of filediff --git a/ui/litellm-dashboard/src/components/create_key_button.tsx b/ui/litellm-dashboard/src/components/create_key_button.tsxindex 387e83d9f28..14c7fedce91 100644--- a/ui/litellm-dashboard/src/components/create_key_button.tsx+++ b/ui/litellm-dashboard/src/components/create_key_button.tsx@@ -31,6 +31,7 @@ import {getGuardrailsList,} from "./networking";import { Team } from "./key_team_helpers/key_list";+import TeamDropdown from "./common_components/team_dropdown";import { InfoCircleOutlined } from '@ant-design/icons';import { Tooltip } from 'antd';@@ -292,28 +293,7 @@ const CreateKey: React.FC<CreateKeyProps> = ({initialValue={team ? team.team_id : null}className="mt-8">- <Select- showSearch- placeholder="Search or select a team"- onChange={(value) => {- form.setFieldValue('team_id', value);- const selectedTeam = teams?.find(team => team.team_id === value);- setSelectedCreateKeyTeam(selectedTeam || null);- }}- filterOption={(input, option) => {- if (!option) return false;- const optionValue = option.children?.toString() || '';- return optionValue.toLowerCase().includes(input.toLowerCase());- }}- optionFilterProp="children"- >- {teams?.map((team) => (- <Select.Option key={team.team_id} value={team.team_id}>- <span className="font-medium">{team.team_alias}</span>{" "}- <span className="text-gray-500">({team.team_id})</span>- </Select.Option>- ))}- </Select>+ <TeamDropdown teams={teams} /></Form.Item><Form.Itemdiff --git a/ui/litellm-dashboard/src/components/model_dashboard.tsx b/ui/litellm-dashboard/src/components/model_dashboard.tsxindex 6ffb934f24a..96be0e640d9 100644--- a/ui/litellm-dashboard/src/components/model_dashboard.tsx+++ b/ui/litellm-dashboard/src/components/model_dashboard.tsx@@ -100,7 +100,10 @@ import { Upload } from "antd";import TimeToFirstToken from "./model_metrics/time_to_first_token";import DynamicFields from "./model_add/dynamic_form";import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";+import { Team } from "./key_team_helpers/key_list";+import TeamInfoView from "./team/team_info";import { Providers, provider_map, providerLogoMap, getProviderLogoAndName, getPlaceholder, getProviderModels } from "./provider_info_helpers";+import ModelInfoView from "./model_info_view";interface ModelDashboardProps {accessToken: string | null;@@ -111,6 +114,7 @@ interface ModelDashboardProps {keys: any[] | null;setModelData: any;premiumUser: boolean;+ teams: Team[] | null;}interface EditModelModalProps {@@ -164,6 +168,7 @@ const ModelDashboard: React.FC<ModelDashboardProps> = ({keys,setModelData,premiumUser,+ teams,}) => {const [pendingRequests, setPendingRequests] = useState<any[]>([]);const [form] = Form.useForm();@@ -182,7 +187,6 @@ const ModelDashboard: React.FC<ModelDashboardProps> = ({const [selectedProvider, setSelectedProvider] = useState<Providers>(Providers.OpenAI);const [healthCheckResponse, setHealthCheckResponse] = useState<string>("");const [editModalVisible, setEditModalVisible] = useState<boolean>(false);- const [infoModalVisible, setInfoModalVisible] = useState<boolean>(false);const [selectedModel, setSelectedModel] = useState<any>(null);const [availableModelGroups, setAvailableModelGroups] = useState<@@ -227,6 +231,12 @@ const ModelDashboard: React.FC<ModelDashboardProps> = ({// Add state for advanced settings visibilityconst [showAdvancedSettings, setShowAdvancedSettings] = useState<boolean>(false);+ // Add these state variables+ const [selectedModelId, setSelectedModelId] = useState<string | null>(null);+ const [editModel, setEditModel] = useState<boolean>(false);++ const [selectedTeamId, setSelectedTeamId] = useState<string | null>(null);+const setProviderModelsFn = (provider: Providers) => {const _providerModels = getProviderModels(provider, modelMap);setProviderModels(_providerModels);@@ -1057,99 +1067,99 @@ const ModelDashboard: React.FC<ModelDashboardProps> = ({);}+ // If a team is selected, render TeamInfoView in full page layout+ if (selectedTeamId) {+ return (+ <div className="w-full h-full">+ <TeamInfoView+ teamId={selectedTeamId}+ onClose={() => setSelectedTeamId(null)}+ accessToken={accessToken}+ is_team_admin={userRole === "Admin"}+ is_proxy_admin={userRole === "Proxy Admin"}+ userModels={all_models_on_proxy}+ editTeam={false}+ />+ </div>+ );+ }+return (<div style={{ width: "100%", height: "100%" }}>- <TabGroup className="gap-2 p-8 h-[75vh] w-full mt-2">- <TabList className="flex justify-between mt-2 w-full items-center">- <div className="flex">- <Tab>All Models</Tab>- <Tab>Add Model</Tab>- <Tab>- <pre>/health Models</pre>- </Tab>- <Tab>Model Analytics</Tab>- <Tab>Model Retry Settings</Tab>- </div>-- <div className="flex items-center space-x-2">- {lastRefreshed && <Text>Last Refreshed: {lastRefreshed}</Text>}- <Icon- icon={RefreshIcon} // Modify as necessary for correct icon name- variant="shadow"- size="xs"- className="self-center"- onClick={handleRefreshClick}- />- </div>- </TabList>- <TabPanels>- <TabPanel>- <Grid>- <div className="flex items-center">- <Text>Filter by Public Model Name</Text>- <Select- className="mb-4 mt-2 ml-2 w-50"- defaultValue={- selectedModelGroup- ? selectedModelGroup- : undefined- }- onValueChange={(value) =>- setSelectedModelGroup(value === "all" ? "all" : value)- }- value={- selectedModelGroup- ? selectedModelGroup- : undefined- }- >- <SelectItem value={"all"}>All Models</SelectItem>- {availableModelGroups.map((group, idx) => (- <SelectItem- key={idx}- value={group}- onClick={() => setSelectedModelGroup(group)}- >- {group}- </SelectItem>- ))}- </Select>- </div>- <Card>- <Table style={{ maxWidth: "1500px", width: "100%" }}>- <TableHead>- <TableRow>- <TableHeaderCell- style={{- maxWidth: "150px",- whiteSpace: "normal",- wordBreak: "break-word",- fontSize: "11px",- }}- >- Public Model Name- </TableHeaderCell>- <TableHeaderCell- style={{- maxWidth: "100px",- whiteSpace: "normal",- wordBreak: "break-word",- fontSize: "11px",- }}- >- Provider- </TableHeaderCell>- <TableHeaderCell- style={{- maxWidth: "150px",- whiteSpace: "normal",- wordBreak: "break-word",- fontSize: "11px",- }}+ {selectedModelId ? (+ <ModelInfoView+ modelId={selectedModelId}+ editModel={true}+ onClose={() => {+ setSelectedModelId(null);+ setEditModel(false);+ }}+ modelData={modelData.data.find((model: any) => model.model_info.id === selectedModelId)}+ accessToken={accessToken}+ userID={userID}+ userRole={userRole}+ />+ ) : (+ <TabGroup className="gap-2 p-8 h-[75vh] w-full mt-2">+ <TabList className="flex justify-between mt-2 w-full items-center">+ <div className="flex">+ <Tab>All Models</Tab>+ <Tab>Add Model</Tab>+ <Tab>+ <pre>/health Models</pre>+ </Tab>+ <Tab>Model Analytics</Tab>+ <Tab>Model Retry Settings</Tab>+ </div>++ <div className="flex items-center space-x-2">+ {lastRefreshed && <Text>Last Refreshed: {lastRefreshed}</Text>}+ <Icon+ icon={RefreshIcon} // Modify as necessary for correct icon name+ variant="shadow"+ size="xs"+ className="self-center"+ onClick={handleRefreshClick}+ />+ </div>+ </TabList>+ <TabPanels>+ <TabPanel>+ <Grid>+ <div className="flex items-center">+ <Text>Filter by Public Model Name</Text>+ <Select+ className="mb-4 mt-2 ml-2 w-50"+ defaultValue={+ selectedModelGroup+ ? selectedModelGroup+ : undefined+ }+ onValueChange={(value) =>+ setSelectedModelGroup(value === "all" ? "all" : value)+ }+ value={+ selectedModelGroup+ ? selectedModelGroup+ : undefined+ }+ >+ <SelectItem value={"all"}>All Models</SelectItem>+ {availableModelGroups.map((group, idx) => (+ <SelectItem+ key={idx}+ value={group}+ onClick={() => setSelectedModelGroup(group)}>- LiteLLM Model- </TableHeaderCell>- {userRole === "Admin" && (+ {group}+ </SelectItem>+ ))}+ </Select>+ </div>+ <Card>+ <Table style={{ maxWidth: "1500px", width: "100%" }}>+ <TableHead>+ <TableRow><TableHeaderCellstyle={{maxWidth: "150px",@@ -1158,116 +1168,187 @@ const ModelDashboard: React.FC<ModelDashboardProps> = ({fontSize: "11px",}}>- API Base+ Public Model Name</TableHeaderCell>- )}- <TableHeaderCell- style={{- maxWidth: "85px",- whiteSpace: "normal",- wordBreak: "break-word",- fontSize: "11px",- }}- >- Input Price{" "}- <p style={{ fontSize: "10px", color: "gray" }}>- /1M Tokens ($)- </p>- </TableHeaderCell>- <TableHeaderCell- style={{- maxWidth: "85px",- whiteSpace: "normal",- wordBreak: "break-word",- fontSize: "11px",- }}- >- Output Price{" "}- <p style={{ fontSize: "10px", color: "gray" }}>- /1M Tokens ($)- </p>- </TableHeaderCell>-- <TableHeaderCell- style={{- maxWidth: "100px",- whiteSpace: "normal",- wordBreak: "break-word",- fontSize: "11px",- }}- >- {premiumUser ? (- "Created At"- ) : (- <a- href="https://forms.gle/W3U4PZpJGFHWtHyA9"- target="_blank"- style={{ color: "#72bcd4" }}- >- {" "}- ✨ Created At- </a>- )}- </TableHeaderCell>- <TableHeaderCell- style={{- maxWidth: "100px",- whiteSpace: "normal",- wordBreak: "break-word",- fontSize: "11px",- }}- >- {premiumUser ? (- "Created By"- ) : (- <a- href="https://forms.gle/W3U4PZpJGFHWtHyA9"- target="_blank"- style={{ color: "#72bcd4" }}- >- {" "}- ✨ Created By- </a>- )}- </TableHeaderCell>- <TableHeaderCell- style={{- maxWidth: "50px",- whiteSpace: "normal",- wordBreak: "break-word",- fontSize: "11px",- }}- >- Status- </TableHeaderCell>- <TableHeaderCell></TableHeaderCell>- </TableRow>- </TableHead>- <TableBody>- {modelData.data- .filter(- (model: any) =>- selectedModelGroup === "all" ||- model.model_name === selectedModelGroup ||- selectedModelGroup === null ||- selectedModelGroup === undefined ||- selectedModelGroup === ""- )- .map((model: any, index: number) => (- <TableRow- key={index}- style={{ maxHeight: "1px", minHeight: "1px" }}+ <TableHeaderCell+ style={{+ maxWidth: "100px",+ whiteSpace: "normal",+ wordBreak: "break-word",+ fontSize: "11px",+ }}+ >+ Model ID+ </TableHeaderCell>+ <TableHeaderCell+ style={{+ maxWidth: "100px",+ whiteSpace: "normal",+ wordBreak: "break-word",+ fontSize: "11px",+ }}+ >+ Provider+ </TableHeaderCell>+ <TableHeaderCell+ style={{+ maxWidth: "150px",+ whiteSpace: "normal",+ wordBreak: "break-word",+ fontSize: "11px",+ }}>- <TableCell+ LiteLLM Model+ </TableHeaderCell>+ {userRole === "Admin" && (+ <TableHeaderCellstyle={{- maxWidth: "100px",+ maxWidth: "150px",whiteSpace: "normal",wordBreak: "break-word",+ fontSize: "11px",}}>- <p className="text-xs">{model.model_name || "-"}</p>- </TableCell>- <TableCell+ API Base+ </TableHeaderCell>+ )}+ <TableHeaderCell+ style={{+ maxWidth: "85px",+ whiteSpace: "normal",+ wordBreak: "break-word",+ fontSize: "11px",+ }}+ >+ Input Price{" "}+ <p style={{ fontSize: "10px", color: "gray" }}>+ /1M Tokens ($)+ </p>+ </TableHeaderCell>+ <TableHeaderCell+ style={{+ maxWidth: "85px",+ whiteSpace: "normal",+ wordBreak: "break-word",+ fontSize: "11px",+ }}+ >+ Output Price{" "}+ <p style={{ fontSize: "10px", color: "gray" }}>+ /1M Tokens ($)+ </p>+ </TableHeaderCell>++ <TableHeaderCell+ style={{+ maxWidth: "100px",+ whiteSpace: "normal",+ wordBreak: "break-word",+ fontSize: "11px",+ }}+ >+ {premiumUser ? (+ "Created At"+ ) : (+ <a+ href="https://forms.gle/W3U4PZpJGFHWtHyA9"+ target="_blank"+ style={{ color: "#72bcd4" }}+ >+ {" "}+ ✨ Created At+ </a>+ )}+ </TableHeaderCell>+ <TableHeaderCell+ style={{+ maxWidth: "100px",+ whiteSpace: "normal",+ wordBreak: "break-word",+ fontSize: "11px",+ }}+ >+ {premiumUser ? (+ "Created By"+ ) : (+ <a+ href="https://forms.gle/W3U4PZpJGFHWtHyA9"+ target="_blank"+ style={{ color: "#72bcd4" }}+ >+ {" "}+ ✨ Created By+ </a>+ )}+ </TableHeaderCell>+ <TableHeaderCell+ style={{+ maxWidth: "100px",+ whiteSpace: "normal",+ wordBreak: "break-word",+ fontSize: "11px",+ }}+ >+ Team ID+ </TableHeaderCell>+ <TableHeaderCell+ style={{+ maxWidth: "50px",+ whiteSpace: "normal",+ wordBreak: "break-word",+ fontSize: "11px",+ }}+ >+ Status+ </TableHeaderCell>+ <TableHeaderCell></TableHeaderCell>+ </TableRow>+ </TableHead>+ <TableBody>+ {modelData.data+ .filter(+ (model: any) =>+ selectedModelGroup === "all" ||+ model.model_name === selectedModelGroup ||+ selectedModelGroup === null ||+ selectedModelGroup === undefined ||+ selectedModelGroup === ""+ )+ .map((model: any, index: number) => (+ <TableRow+ key={index}+ style={{ maxHeight: "1px", minHeight: "1px" }}+ >+ <TableCell+ style={{+ maxWidth: "100px",+ whiteSpace: "normal",+ wordBreak: "break-word",+ }}+ >+ <p className="text-xs">{model.model_name || "-"}</p>+ </TableCell>+ <TableCell+ style={{+ maxWidth: "100px",+ whiteSpace: "normal",+ wordBreak: "break-word",+ }}+ >+ <div className="overflow-hidden">+ <Tooltip title={model.model_info.id}>+ <Button+ size="xs"+ variant="light"+ className="font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate max-w-[200px]"+ onClick={() => setSelectedModelId(model.model_info.id)}+ >+ {model.model_info.id.slice(0, 7)}...+ </Button>+ </Tooltip>+ </div>+ </TableCell>+ <TableCellstyle={{maxWidth: "100px",whiteSpace: "normal",@@ -1295,320 +1376,573 @@ const ModelDashboard: React.FC<ModelDashboardProps> = ({)}<p className="text-xs">{model.provider || "-"}</p></div>- </TableCell>-- <TableCell- style={{- maxWidth: "100px",- whiteSpace: "normal",- wordBreak: "break-word",- }}- >- <Tooltip title={model && model.litellm_model_name}>- <pre- style={{- maxWidth: "150px",- whiteSpace: "normal",- wordBreak: "break-word",- }}- className="text-xs"- title={- model && model.litellm_model_name- ? model.litellm_model_name- : ""- }- >- {model && model.litellm_model_name- ? model.litellm_model_name.slice(0, 20) + (model.litellm_model_name.length > 20 ? "..." : "")- : "-"}- </pre>- </Tooltip>+ </TableCell>- </TableCell>- {userRole === "Admin" && (<TableCellstyle={{- maxWidth: "150px",+ maxWidth: "100px",+ whiteSpace: "normal",+ wordBreak: "break-word",+ }}+ >+ <Tooltip title={model && model.litellm_model_name}>+ <pre+ style={{+ maxWidth: "150px",+ whiteSpace: "normal",+ wordBreak: "break-word",+ }}+ className="text-xs"+ title={+ model && model.litellm_model_name+ ? model.litellm_model_name+ : ""+ }+ >+ {model && model.litellm_model_name+ ? model.litellm_model_name.slice(0, 20) + (model.litellm_model_name.length > 20 ? "..." : "")+ : "-"}+ </pre>+ </Tooltip>++ </TableCell>+ {userRole === "Admin" && (+ <TableCell+ style={{+ maxWidth: "150px",+ whiteSpace: "normal",+ wordBreak: "break-word",+ }}+ >+ <Tooltip title={model && model.api_base}>+ <pre+ style={{+ maxWidth: "150px",+ whiteSpace: "normal",+ wordBreak: "break-word",+ }}+ className="text-xs"+ title={+ model && model.api_base+ ? model.api_base+ : ""+ }+ >+ {model && model.api_base+ ? model.api_base.slice(0, 20)+ : "-"}+ </pre>+ </Tooltip>+ </TableCell>+ )}+ <TableCell+ style={{+ maxWidth: "80px",whiteSpace: "normal",wordBreak: "break-word",}}>- <Tooltip title={model && model.api_base}>- <pre- style={{- maxWidth: "150px",- whiteSpace: "normal",- wordBreak: "break-word",+ <pre className="text-xs">+ {model.input_cost+ ? model.input_cost+ : model.litellm_params.input_cost_per_token != null && model.litellm_params.input_cost_per_token != undefined+ ? (+ Number(+ model.litellm_params+ .input_cost_per_token+ ) * 1000000+ ).toFixed(2)+ : null}+ </pre>+ </TableCell>+ <TableCell+ style={{+ maxWidth: "80px",+ whiteSpace: "normal",+ wordBreak: "break-word",+ }}+ >+ <pre className="text-xs">+ {model.output_cost+ ? model.output_cost+ : model.litellm_params.output_cost_per_token+ ? (+ Number(+ model.litellm_params+ .output_cost_per_token+ ) * 1000000+ ).toFixed(2)+ : null}+ </pre>+ </TableCell>+ <TableCell>+ <p className="text-xs">+ {premiumUser+ ? formatCreatedAt(+ model.model_info.created_at+ ) || "-"+ : "-"}+ </p>+ </TableCell>+ <TableCell>+ <p className="text-xs">+ {premiumUser+ ? model.model_info.created_by || "-"+ : "-"}+ </p>+ </TableCell>+ <TableCell+ style={{+ maxWidth: "100px",+ whiteSpace: "normal",+ wordBreak: "break-word",+ }}+ >+ <div className="overflow-hidden">+ {model.model_info.team_id ? (+ <Tooltip title={model.model_info.team_id}>+ <Button+ size="xs"+ variant="light"+ className="font-mono text-purple-500 bg-purple-50 hover:bg-purple-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate max-w-[200px]"+ onClick={() => {+ setSelectedTeamId(model.model_info.team_id);}}- className="text-xs"- title={- model && model.api_base- ? model.api_base- : ""- }>- {model && model.api_base- ? model.api_base.slice(0, 20)- : "-"}- </pre>+ {model.model_info.team_id.slice(0, 7)}...+ </Button></Tooltip>+ ) : (+ "-"+ )}+++ </div></TableCell>- )}- <TableCell- style={{- maxWidth: "80px",- whiteSpace: "normal",- wordBreak: "break-word",- }}- >- <pre className="text-xs">- {model.input_cost- ? model.input_cost- : model.litellm_params.input_cost_per_token != null && model.litellm_params.input_cost_per_token != undefined- ? (- Number(- model.litellm_params- .input_cost_per_token- ) * 1000000- ).toFixed(2)- : null}- </pre>- </TableCell>- <TableCell- style={{- maxWidth: "80px",- whiteSpace: "normal",- wordBreak: "break-word",- }}- >- <pre className="text-xs">- {model.output_cost- ? model.output_cost- : model.litellm_params.output_cost_per_token- ? (- Number(- model.litellm_params- .output_cost_per_token- ) * 1000000- ).toFixed(2)- : null}- </pre>- </TableCell>- <TableCell>- <p className="text-xs">- {premiumUser- ? formatCreatedAt(- model.model_info.created_at- ) || "-"- : "-"}- </p>- </TableCell>- <TableCell>- <p className="text-xs">- {premiumUser- ? model.model_info.created_by || "-"- : "-"}- </p>- </TableCell>- <TableCell- style={{- maxWidth: "100px",- whiteSpace: "normal",- wordBreak: "break-word",- }}- >- {model.model_info.db_model ? (- <Badge size="xs" className="text-white">- <p className="text-xs">DB Model</p>- </Badge>- ) : (- <Badge size="xs" className="text-black">- <p className="text-xs">Config Model</p>- </Badge>- )}- </TableCell>- <TableCell- style={{- maxWidth: "150px",- whiteSpace: "normal",- wordBreak: "break-word",- }}+ <TableCell+ style={{+ maxWidth: "100px",+ whiteSpace: "normal",+ wordBreak: "break-word",+ }}+ >+ {model.model_info.db_model ? (+ <Badge size="xs" className="text-white">+ <p className="text-xs">DB Model</p>+ </Badge>+ ) : (+ <Badge size="xs" className="text-black">+ <p className="text-xs">Config Model</p>+ </Badge>+ )}+ </TableCell>+ <TableCell+ style={{+ maxWidth: "150px",+ whiteSpace: "normal",+ wordBreak: "break-word",+ }}+ >+ <Grid numItems={3}>+ <Col>+ <Icon+ icon={InformationCircleIcon}+ size="sm"+ onClick={() => handleInfoClick(model)}+ />+ </Col>+ <Col>+ <Icon+ icon={PencilAltIcon}+ size="sm"+ onClick={() => handleEditClick(model)}+ />+ </Col>++ <Col>+ <DeleteModelButton+ modelID={model.model_info.id}+ accessToken={accessToken}+ callback={handleRefreshClick}+ />+ </Col>+ </Grid>+ </TableCell>+ </TableRow>+ ))}+ </TableBody>+ </Table>+ </Card>+ </Grid>+ <EditModelModal+ visible={editModalVisible}+ onCancel={handleEditCancel}+ model={selectedModel}+ onSubmit={handleEditSubmit}+ />+ </TabPanel>+ <TabPanel className="h-full">+ <Title2 level={2}>Add new model</Title2>+ <Card>+ <Form+ form={form}+ onFinish={handleOk}+ labelCol={{ span: 10 }}+ wrapperCol={{ span: 16 }}+ labelAlign="left"+ >+ <>+ {/* Provider Selection */}+ <Form.Item+ rules={[{ required: true, message: "Required" }]}+ label="Provider:"+ name="custom_llm_provider"+ tooltip="E.g. OpenAI, Azure OpenAI, Anthropic, Bedrock, etc."+ labelCol={{ span: 10 }}+ labelAlign="left"+ >+ <AntdSelect+ showSearch={true}+ value={selectedProvider}+ onChange={(value) => {+ setSelectedProvider(value);+ setProviderModelsFn(value);+ form.setFieldsValue({+ model: [],+ model_name: undefined+ });+ }}+ >+ {Object.entries(Providers).map(([providerEnum, providerDisplayName]) => (+ <AntdSelect.Option+ key={providerEnum}+ value={providerEnum}>- <Grid numItems={3}>- <Col>- <Icon- icon={InformationCircleIcon}- size="sm"- onClick={() => handleInfoClick(model)}- />- </Col>- <Col>- <Icon- icon={PencilAltIcon}- size="sm"- onClick={() => handleEditClick(model)}- />- </Col>+ <div className="flex items-center space-x-2">+ <img+ src={providerLogoMap[providerDisplayName]}+ alt={`${providerEnum} logo`}+ className="w-5 h-5"+ onError={(e) => {+ // Create a div with provider initial as fallback+ const target = e.target as HTMLImageElement;+ const parent = target.parentElement;+ if (parent) {+ const fallbackDiv = document.createElement('div');+ fallbackDiv.className = 'w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs';+ fallbackDiv.textContent = providerDisplayName.charAt(0);+ parent.replaceChild(fallbackDiv, target);+ }+ }}+ />+ <span>{providerDisplayName}</span>+ </div>+ </AntdSelect.Option>+ ))}+ </AntdSelect>+ </Form.Item>+ <LiteLLMModelNameField+ selectedProvider={selectedProvider}+ providerModels={providerModels}+ getPlaceholder={getPlaceholder}+ />++ {/* Conditionally Render "Public Model Name" */}+ <ConditionalPublicModelName />- <Col>- <DeleteModelButton- modelID={model.model_info.id}- accessToken={accessToken}- callback={handleRefreshClick}- />- </Col>- </Grid>- </TableCell>- </TableRow>- ))}- </TableBody>- </Table>+ <ProviderSpecificFields+ selectedProvider={selectedProvider}+ uploadProps={uploadProps}+ />+ <AdvancedSettings+ showAdvancedSettings={showAdvancedSettings}+ setShowAdvancedSettings={setShowAdvancedSettings}+ teams={teams}+ />+++ <div className="flex justify-between items-center mb-4">+ <Tooltip title="Get help on our github">+ <Typography.Link href="https://github.com/BerriAI/litellm/issues">+ Need Help?+ </Typography.Link>+ </Tooltip>+ <Button2 htmlType="submit">Add Model</Button2>+ </div>+ </>+ </Form>+ </Card>+ </TabPanel>+ <TabPanel>+ <Card>+ <Text>+ `/health` will run a very small request through your models+ configured on litellm+ </Text>++ <Button onClick={runHealthCheck}>Run `/health`</Button>+ {healthCheckResponse && (+ <pre>{JSON.stringify(healthCheckResponse, null, 2)}</pre>+ )}</Card>- </Grid>- <EditModelModal- visible={editModalVisible}- onCancel={handleEditCancel}- model={selectedModel}- onSubmit={handleEditSubmit}- />- <Modal- title={selectedModel && selectedModel.model_name}- visible={infoModalVisible}- width={800}- footer={null}- onCancel={handleInfoCancel}- >- <Title>Model Info</Title>- <SyntaxHighlighter language="json">- {selectedModel && JSON.stringify(selectedModel, null, 2)}- </SyntaxHighlighter>- </Modal>- </TabPanel>- <TabPanel className="h-full">- <Title2 level={2}>Add new model</Title2>- <Card>- <Form- form={form}- onFinish={handleOk}- labelCol={{ span: 10 }}- wrapperCol={{ span: 16 }}- labelAlign="left"- >- <>- {/* Provider Selection */}- <Form.Item- rules={[{ required: true, message: "Required" }]}- label="Provider:"- name="custom_llm_provider"- tooltip="E.g. OpenAI, Azure OpenAI, Anthropic, Bedrock, etc."- labelCol={{ span: 10 }}- labelAlign="left"+ </TabPanel>+ <TabPanel>+ <Grid numItems={4} className="mt-2 mb-2">+ <Col>+ <Text>Select Time Range</Text>+ <DateRangePicker+ enableSelect={true}+ value={dateValue}+ className="mr-2"+ onValueChange={(value) => {+ setDateValue(value);+ updateModelMetrics(+ selectedModelGroup,+ value.from,+ value.to+ ); // Call updateModelMetrics with the new date range+ }}+ />+ </Col>+ <Col className="ml-2">+ <Text>Select Model Group</Text>+ <Select+ defaultValue={+ selectedModelGroup+ ? selectedModelGroup+ : availableModelGroups[0]+ }+ value={+ selectedModelGroup+ ? selectedModelGroup+ : availableModelGroups[0]+ }>- <AntdSelect- showSearch={true}- value={selectedProvider}- onChange={(value) => {- setSelectedProvider(value);- setProviderModelsFn(value);- form.setFieldsValue({- model: [],- model_name: undefined- });- }}- >- {Object.entries(Providers).map(([providerEnum, providerDisplayName]) => (- <AntdSelect.Option- key={providerEnum}- value={providerEnum}- >- <div className="flex items-center space-x-2">- <img- src={providerLogoMap[providerDisplayName]}- alt={`${providerEnum} logo`}- className="w-5 h-5"- onError={(e) => {- // Create a div with provider initial as fallback- const target = e.target as HTMLImageElement;- const parent = target.parentElement;- if (parent) {- const fallbackDiv = document.createElement('div');- fallbackDiv.className = 'w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs';- fallbackDiv.textContent = providerDisplayName.charAt(0);- parent.replaceChild(fallbackDiv, target);- }- }}+ {availableModelGroups.map((group, idx) => (+ <SelectItem+ key={idx}+ value={group}+ onClick={() =>+ updateModelMetrics(group, dateValue.from, dateValue.to)+ }+ >+ {group}+ </SelectItem>+ ))}+ </Select>+ </Col>+ <Col>+ <Popover+ trigger="click" content={FilterByContent}+ overlayStyle={{+ width: "20vw"+ }}+ >+ <Button+ icon={FilterIcon}+ size="md"+ variant="secondary"+ className="mt-4 ml-2"+ style={{+ border: "none",+ }}+ onClick={() => setShowAdvancedFilters(true)}+ >+ </Button>+ </Popover>+ </Col>++ </Grid>+++ <Grid numItems={2}>+ <Col>+ <Card className="mr-2 max-h-[400px] min-h-[400px]">+ <TabGroup>+ <TabList variant="line" defaultValue="1">+ <Tab value="1">Avg. Latency per Token</Tab>+ <Tab value="2">✨ Time to first token</Tab>+ </TabList>+ <TabPanels>+ <TabPanel>+ <p className="text-gray-500 italic"> (seconds/token)</p>+ <Text className="text-gray-500 italic mt-1 mb-1">+ average Latency for successfull requests divided by+ the total tokens+ </Text>+ {modelMetrics && modelMetricsCategories && (+ <AreaChart+ title="Model Latency"+ className="h-72"+ data={modelMetrics}+ showLegend={false}+ index="date"+ categories={modelMetricsCategories}+ connectNulls={true}+ customTooltip={customTooltip}/>- <span>{providerDisplayName}</span>- </div>- </AntdSelect.Option>- ))}- </AntdSelect>- </Form.Item>- <LiteLLMModelNameField- selectedProvider={selectedProvider}- providerModels={providerModels}- getPlaceholder={getPlaceholder}+ )}+ </TabPanel>+ <TabPanel>+ <TimeToFirstToken+ modelMetrics={streamingModelMetrics}+ modelMetricsCategories={+ streamingModelMetricsCategories+ }+ customTooltip={customTooltip}+ premiumUser={premiumUser}+ />+ </TabPanel>+ </TabPanels>+ </TabGroup>+ </Card>+ </Col>+ <Col>+ <Card className="ml-2 max-h-[400px] min-h-[400px] overflow-y-auto">+ <Table>+ <TableHead>+ <TableRow>+ <TableHeaderCell>Deployment</TableHeaderCell>+ <TableHeaderCell>Success Responses</TableHeaderCell>+ <TableHeaderCell>+ Slow Responses <p>Success Responses taking 600+s</p>+ </TableHeaderCell>+ </TableRow>+ </TableHead>+ <TableBody>+ {slowResponsesData.map((metric, idx) => (+ <TableRow key={idx}>+ <TableCell>{metric.api_base}</TableCell>+ <TableCell>{metric.total_count}</TableCell>+ <TableCell>{metric.slow_count}</TableCell>+ </TableRow>+ ))}+ </TableBody>+ </Table>+ </Card>+ </Col>+ </Grid>+ <Grid numItems={1} className="gap-2 w-full mt-2">+ <Card>++ <Title>All Exceptions for {selectedModelGroup}</Title>++ <BarChart+ className="h-60"+ data={modelExceptions}+ index="model"+ categories={allExceptions}+ stack={true}++ yAxisWidth={30}+ />+ </Card>++ </Grid>+++ <Grid numItems={1} className="gap-2 w-full mt-2">+ <Card>+ <Title>All Up Rate Limit Errors (429) for {selectedModelGroup}</Title>+ <Grid numItems={1}>+ <Col>+ <Subtitle style={{ fontSize: "15px", fontWeight: "normal", color: "#535452"}}>Num Rate Limit Errors { (globalExceptionData.sum_num_rate_limit_exceptions)}</Subtitle>+ <BarChart+ className="h-40"+ data={globalExceptionData.daily_data}+ index="date"+ colors={['rose']}+ categories={['num_rate_limit_exceptions']}+ onValueChange={(v) => console.log(v)}/>-- {/* Conditionally Render "Public Model Name" */}- <ConditionalPublicModelName />+ </Col>+ <Col>- <ProviderSpecificFields- selectedProvider={selectedProvider}- uploadProps={uploadProps}- />- <AdvancedSettings- showAdvancedSettings={showAdvancedSettings}- setShowAdvancedSettings={setShowAdvancedSettings}- />+++ </Col>++ </Grid>- <div className="flex justify-between items-center mb-4">- <Tooltip title="Get help on our github">- <Typography.Link href="https://github.com/BerriAI/litellm/issues">- Need Help?- </Typography.Link>- </Tooltip>- <Button2 htmlType="submit">Add Model</Button2>- </div>- </>- </Form>- </Card>- </TabPanel>- <TabPanel>- <Card>- <Text>- `/health` will run a very small request through your models- configured on litellm- </Text>+ </Card>++ {+ premiumUser ? (+ <>+ {globalExceptionPerDeployment.map((globalActivity, index) => (+ <Card key={index}>+ <Title>{globalActivity.api_base ? globalActivity.api_base : "Unknown API Base"}</Title>+ <Grid numItems={1}>+ <Col>+ <Subtitle style={{ fontSize: "15px", fontWeight: "normal", color: "#535452"}}>Num Rate Limit Errors (429) {(globalActivity.sum_num_rate_limit_exceptions)}</Subtitle>+ <BarChart+ className="h-40"+ data={globalActivity.daily_data}+ index="date"+ colors={['rose']}+ categories={['num_rate_limit_exceptions']}++ onValueChange={(v) => console.log(v)}+ />++ </Col>+ </Grid>+ </Card>+ ))}+ </>+ ) :+ <>+ {globalExceptionPerDeployment && globalExceptionPerDeployment.length > 0 &&+ globalExceptionPerDeployment.slice(0, 1).map((globalActivity, index) => (+ <Card key={index}>+ <Title>✨ Rate Limit Errors by Deployment</Title>+ <p className="mb-2 text-gray-500 italic text-[12px]">Upgrade to see exceptions for all deployments</p>+ <Button variant="primary" className="mb-2">+ <a href="https://forms.gle/W3U4PZpJGFHWtHyA9" target="_blank">+ Get Free Trial+ </a>+ </Button>+ <Card>+ <Title>{globalActivity.api_base}</Title>+ <Grid numItems={1}>+ <Col>+ <Subtitle+ style={{+ fontSize: "15px",+ fontWeight: "normal",+ color: "#535452",+ }}+ >+ Num Rate Limit Errors {(globalActivity.sum_num_rate_limit_exceptions)}+ </Subtitle>+ <BarChart+ className="h-40"+ data={globalActivity.daily_data}+ index="date"+ colors={['rose']}+ categories={['num_rate_limit_exceptions']}++ onValueChange={(v) => console.log(v)}+ />+ </Col>+++ </Grid>+ </Card>+ </Card>+ ))}+ </>+ }+ </Grid>++ </TabPanel>+ <TabPanel>+ <div className="flex items-center">+ <Text>Filter by Public Model Name</Text>- <Button onClick={runHealthCheck}>Run `/health`</Button>- {healthCheckResponse && (- <pre>{JSON.stringify(healthCheckResponse, null, 2)}</pre>- )}- </Card>- </TabPanel>- <TabPanel>- <Grid numItems={4} className="mt-2 mb-2">- <Col>- <Text>Select Time Range</Text>- <DateRangePicker- enableSelect={true}- value={dateValue}- className="mr-2"- onValueChange={(value) => {- setDateValue(value);- updateModelMetrics(- selectedModelGroup,- value.from,- value.to- ); // Call updateModelMetrics with the new date range- }}- />- </Col>- <Col className="ml-2">- <Text>Select Model Group</Text><Select+ className="mb-4 mt-2 ml-2 w-50"defaultValue={selectedModelGroup? selectedModelGroup@@ -1619,319 +1953,84 @@ const ModelDashboard: React.FC<ModelDashboardProps> = ({? selectedModelGroup: availableModelGroups[0]}+ onValueChange={(value) => setSelectedModelGroup(value)}>{availableModelGroups.map((group, idx) => (<SelectItemkey={idx}value={group}- onClick={() =>- updateModelMetrics(group, dateValue.from, dateValue.to)- }+ onClick={() => setSelectedModelGroup(group)}>{group}</SelectItem>))}</Select>- </Col>- <Col>- <Popover- trigger="click" content={FilterByContent}- overlayStyle={{- width: "20vw"- }}- >- <Button- icon={FilterIcon}- size="md"- variant="secondary"- className="mt-4 ml-2"- style={{- border: "none",- }}- onClick={() => setShowAdvancedFilters(true)}- >- </Button>- </Popover>- </Col>-- </Grid>--- <Grid numItems={2}>- <Col>- <Card className="mr-2 max-h-[400px] min-h-[400px]">- <TabGroup>- <TabList variant="line" defaultValue="1">- <Tab value="1">Avg. Latency per Token</Tab>- <Tab value="2">✨ Time to first token</Tab>- </TabList>- <TabPanels>- <TabPanel>- <p className="text-gray-500 italic"> (seconds/token)</p>- <Text className="text-gray-500 italic mt-1 mb-1">- average Latency for successfull requests divided by- the total tokens- </Text>- {modelMetrics && modelMetricsCategories && (- <AreaChart- title="Model Latency"- className="h-72"- data={modelMetrics}- showLegend={false}- index="date"- categories={modelMetricsCategories}- connectNulls={true}- customTooltip={customTooltip}- />- )}- </TabPanel>- <TabPanel>- <TimeToFirstToken- modelMetrics={streamingModelMetrics}- modelMetricsCategories={- streamingModelMetricsCategories- }- customTooltip={customTooltip}- premiumUser={premiumUser}- />- </TabPanel>- </TabPanels>- </TabGroup>- </Card>- </Col>- <Col>- <Card className="ml-2 max-h-[400px] min-h-[400px] overflow-y-auto">- <Table>- <TableHead>- <TableRow>- <TableHeaderCell>Deployment</TableHeaderCell>- <TableHeaderCell>Success Responses</TableHeaderCell>- <TableHeaderCell>- Slow Responses <p>Success Responses taking 600+s</p>- </TableHeaderCell>- </TableRow>- </TableHead>- <TableBody>- {slowResponsesData.map((metric, idx) => (- <TableRow key={idx}>- <TableCell>{metric.api_base}</TableCell>- <TableCell>{metric.total_count}</TableCell>- <TableCell>{metric.slow_count}</TableCell>- </TableRow>- ))}- </TableBody>- </Table>- </Card>- </Col>- </Grid>- <Grid numItems={1} className="gap-2 w-full mt-2">- <Card>-- <Title>All Exceptions for {selectedModelGroup}</Title>-- <BarChart- className="h-60"- data={modelExceptions}- index="model"- categories={allExceptions}- stack={true}-- yAxisWidth={30}- />- </Card>-- </Grid>--- <Grid numItems={1} className="gap-2 w-full mt-2">- <Card>- <Title>All Up Rate Limit Errors (429) for {selectedModelGroup}</Title>- <Grid numItems={1}>- <Col>- <Subtitle style={{ fontSize: "15px", fontWeight: "normal", color: "#535452"}}>Num Rate Limit Errors { (globalExceptionData.sum_num_rate_limit_exceptions)}</Subtitle>- <BarChart- className="h-40"- data={globalExceptionData.daily_data}- index="date"- colors={['rose']}- categories={['num_rate_limit_exceptions']}- onValueChange={(v) => console.log(v)}- />- </Col>- <Col>---- </Col>-- </Grid>-+ </div>- </Card>+ <Title>Retry Policy for {selectedModelGroup}</Title>+ <Text className="mb-6">+ How many retries should be attempted based on the Exception+ </Text>+ {retry_policy_map && (+ <table>+ <tbody>+ {Object.entries(retry_policy_map).map(+ ([exceptionType, retryPolicyKey], idx) => {+ let retryCount =+ modelGroupRetryPolicy?.[selectedModelGroup!]?.[+ retryPolicyKey+ ];+ if (retryCount == null) {+ retryCount = defaultRetry;+ }- {- premiumUser ? (- <>- {globalExceptionPerDeployment.map((globalActivity, index) => (- <Card key={index}>- <Title>{globalActivity.api_base ? globalActivity.api_base : "Unknown API Base"}</Title>- <Grid numItems={1}>- <Col>- <Subtitle style={{ fontSize: "15px", fontWeight: "normal", color: "#535452"}}>Num Rate Limit Errors (429) {(globalActivity.sum_num_rate_limit_exceptions)}</Subtitle>- <BarChart- className="h-40"- data={globalActivity.daily_data}- index="date"- colors={['rose']}- categories={['num_rate_limit_exceptions']}-- onValueChange={(v) => console.log(v)}- />-- </Col>- </Grid>- </Card>- ))}- </>- ) :- <>- {globalExceptionPerDeployment && globalExceptionPerDeployment.length > 0 &&- globalExceptionPerDeployment.slice(0, 1).map((globalActivity, index) => (- <Card key={index}>- <Title>✨ Rate Limit Errors by Deployment</Title>- <p className="mb-2 text-gray-500 italic text-[12px]">Upgrade to see exceptions for all deployments</p>- <Button variant="primary" className="mb-2">- <a href="https://forms.gle/W3U4PZpJGFHWtHyA9" target="_blank">- Get Free Trial- </a>- </Button>- <Card>- <Title>{globalActivity.api_base}</Title>- <Grid numItems={1}>- <Col>- <Subtitle- style={{- fontSize: "15px",- fontWeight: "normal",- color: "#535452",- }}- >- Num Rate Limit Errors {(globalActivity.sum_num_rate_limit_exceptions)}- </Subtitle>- <BarChart- className="h-40"- data={globalActivity.daily_data}- index="date"- colors={['rose']}- categories={['num_rate_limit_exceptions']}-- onValueChange={(v) => console.log(v)}+ return (+ <tr+ key={idx}+ className="flex justify-between items-center mt-2"+ >+ <td>+ <Text>{exceptionType}</Text>+ </td>+ <td>+ <InputNumber+ className="ml-5"+ value={retryCount}+ min={0}+ step={1}+ onChange={(value) => {+ setModelGroupRetryPolicy(+ (prevModelGroupRetryPolicy) => {+ const prevRetryPolicy =+ prevModelGroupRetryPolicy?.[+ selectedModelGroup!+ ] ?? {};+ return {+ ...(prevModelGroupRetryPolicy ?? {}),+ [selectedModelGroup!]: {+ ...prevRetryPolicy,+ [retryPolicyKey!]: value,+ },+ } as RetryPolicyObject;+ }+ );+ }}/>- </Col>--- </Grid>- </Card>- </Card>- ))}- </>- }- </Grid>-- </TabPanel>- <TabPanel>- <div className="flex items-center">- <Text>Filter by Public Model Name</Text>-- <Select- className="mb-4 mt-2 ml-2 w-50"- defaultValue={- selectedModelGroup- ? selectedModelGroup- : availableModelGroups[0]- }- value={- selectedModelGroup- ? selectedModelGroup- : availableModelGroups[0]- }- onValueChange={(value) => setSelectedModelGroup(value)}- >- {availableModelGroups.map((group, idx) => (- <SelectItem- key={idx}- value={group}- onClick={() => setSelectedModelGroup(group)}- >- {group}- </SelectItem>- ))}- </Select>- </div>-- <Title>Retry Policy for {selectedModelGroup}</Title>- <Text className="mb-6">- How many retries should be attempted based on the Exception- </Text>- {retry_policy_map && (- <table>- <tbody>- {Object.entries(retry_policy_map).map(- ([exceptionType, retryPolicyKey], idx) => {- let retryCount =- modelGroupRetryPolicy?.[selectedModelGroup!]?.[- retryPolicyKey- ];- if (retryCount == null) {- retryCount = defaultRetry;+ </td>+ </tr>+ );}-- return (- <tr- key={idx}- className="flex justify-between items-center mt-2"- >- <td>- <Text>{exceptionType}</Text>- </td>- <td>- <InputNumber- className="ml-5"- value={retryCount}- min={0}- step={1}- onChange={(value) => {- setModelGroupRetryPolicy(- (prevModelGroupRetryPolicy) => {- const prevRetryPolicy =- prevModelGroupRetryPolicy?.[- selectedModelGroup!- ] ?? {};- return {- ...(prevModelGroupRetryPolicy ?? {}),- [selectedModelGroup!]: {- ...prevRetryPolicy,- [retryPolicyKey!]: value,- },- } as RetryPolicyObject;- }- );- }}- />- </td>- </tr>- );- }- )}- </tbody>- </table>- )}- <Button className="mt-6 mr-8" onClick={handleSaveRetrySettings}>- Save- </Button>- </TabPanel>- </TabPanels>- </TabGroup>+ )}+ </tbody>+ </table>+ )}+ <Button className="mt-6 mr-8" onClick={handleSaveRetrySettings}>+ Save+ </Button>+ </TabPanel>+ </TabPanels>+ </TabGroup>+ )}</div>);};diff --git a/ui/litellm-dashboard/src/components/model_info_view.tsx b/ui/litellm-dashboard/src/components/model_info_view.tsxnew file mode 100644index 00000000000..ece453e0414--- /dev/null+++ b/ui/litellm-dashboard/src/components/model_info_view.tsx@@ -0,0 +1,333 @@+import React, { useState, useEffect } from "react";+import {+ Card,+ Title,+ Text,+ Tab,+ TabList,+ TabGroup,+ TabPanel,+ TabPanels,+ Grid,+ Badge,+ Button as TremorButton,+} from "@tremor/react";+import { ArrowLeftIcon, TrashIcon } from "@heroicons/react/outline";+import { modelDeleteCall, modelUpdateCall } from "./networking";+import { Button, Form, Input, InputNumber, message, Select } from "antd";+import EditModelModal from "./edit_model/edit_model_modal";+import { getProviderLogoAndName } from "./provider_info_helpers";++interface ModelInfoViewProps {+ modelId: string;+ onClose: () => void;+ modelData: any;+ accessToken: string | null;+ userID: string | null;+ userRole: string | null;+ editModel: boolean;+}++export default function ModelInfoView({+ modelId,+ onClose,+ modelData,+ accessToken,+ userID,+ userRole,+ editModel+}: ModelInfoViewProps) {+ const [isEditing, setIsEditing] = useState(false);+ const [form] = Form.useForm();+ const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);++ const canEditModel = userRole === "Admin";++ if (!modelData) {+ return (+ <div className="p-4">+ <Button+ icon={ArrowLeftIcon}+ onClick={onClose}+ className="mb-4"+ >+ Back to Models+ </Button>+ <Text>Model not found</Text>+ </div>+ );+ }++ const handleDelete = async () => {+ try {+ if (!accessToken) return;+ await modelDeleteCall(accessToken, modelId);+ message.success("Model deleted successfully");+ onClose();+ } catch (error) {+ console.error("Error deleting the model:", error);+ message.error("Failed to delete model");+ }+ };++ const handleModelUpdate = async (values: any) => {+ try {+ if (!accessToken) return;++ let payload = {+ litellm_params: Object.keys(values.litellm_params).length > 0 ? values.litellm_params : undefined,+ model_info: values.model_info ? {+ id: values.model_info.id,+ } : undefined,+ };++ await modelUpdateCall(accessToken, payload);+ message.success("Model updated successfully");+ setIsEditing(false);+ } catch (error) {+ console.error("Error updating model:", error);+ message.error("Failed to update model");+ }+ };++ return (+ <div className="p-4">+ <div className="flex justify-between items-center mb-6">+ <div>+ <Button onClick={onClose} className="mb-4">← Back</Button>+ <Title>{modelData.model_name}</Title>+ <Text className="text-gray-500 font-mono">{modelData.model_info.id}</Text>+ </div>+ {canEditModel && (+ <div className="flex gap-2">+ <TremorButton+ onClick={() => setIsDeleteModalOpen(true)}+ color="red"+ >+ Delete Model+ </TremorButton>+ </div>+ )}+ </div>++ <TabGroup>+ <TabList className="mb-6">+ <Tab>Overview</Tab>+ <Tab>Raw JSON</Tab>+ </TabList>++ <TabPanels>+ <TabPanel>+ {/* Overview Grid */}+ <Grid numItems={1} numItemsSm={2} numItemsLg={3} className="gap-6 mb-6">+ <Card>+ <Text>Provider</Text>+ <div className="mt-2 flex items-center space-x-2">+ {modelData.provider && (+ <img+ src={getProviderLogoAndName(modelData.provider).logo}+ alt={`${modelData.provider} logo`}+ className="w-4 h-4"+ onError={(e) => {+ // Create a div with provider initial as fallback+ const target = e.target as HTMLImageElement;+ const parent = target.parentElement;+ if (parent) {+ const fallbackDiv = document.createElement('div');+ fallbackDiv.className = 'w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs';+ fallbackDiv.textContent = modelData.provider?.charAt(0) || '-';+ parent.replaceChild(fallbackDiv, target);+ }+ }}+ />+ )}+ <Title>{modelData.provider || "Not Set"}</Title>+ </div>+ </Card>+ <Card>+ <Text>LiteLLM Model</Text>+ <pre>+ <Title>{modelData.litellm_model_name || "Not Set"}</Title>+ </pre>+ </Card>+ <Card>+ <Text>Pricing</Text>+ <div className="mt-2">+ <Text>Input: ${modelData.input_cost}/1M tokens</Text>+ <Text>Output: ${modelData.output_cost}/1M tokens</Text>+ </div>+ </Card>+ </Grid>++ {/* Settings Card */}+ <Card>+ <div className="flex justify-between items-center mb-4">+ <Title>Model Settings</Title>+ {(canEditModel && !isEditing) && (+ <TremorButton+ onClick={() => setIsEditing(true)}+ >+ Edit Settings+ </TremorButton>+ )}+ </div>++ {isEditing ? (+ <EditModelModal+ visible={isEditing}+ onCancel={() => setIsEditing(false)}+ model={modelData}+ onSubmit={handleModelUpdate}+ />+ ) : (+ <div className="space-y-4">+ <div>+ <Text className="font-medium">Model ID</Text>+ <div className="font-mono">{modelData.model_info.id}</div>+ </div>++ <div>+ <Text className="font-medium">Public Model Name</Text>+ <div>{modelData.model_name}</div>+ </div>++ <div>+ <Text className="font-medium">LiteLLM Model Name</Text>+ <div>{modelData.litellm_model_name}</div>+ </div>++ <div>+ <Text className="font-medium">Input Cost (per 1M tokens)</Text>+ <div>{modelData.litellm_params?.input_cost_per_token ? (modelData.litellm_params.input_cost_per_token * 1_000_000).toFixed(4) : "Not Set"}</div>+ </div>++ <div>+ <Text className="font-medium">Output Cost (per 1M tokens)</Text>+ <div>{modelData.litellm_params?.output_cost_per_token ? (modelData.litellm_params.output_cost_per_token * 1_000_000).toFixed(4) : "Not Set"}</div>+ </div>++ <div>+ <Text className="font-medium">API Base</Text>+ <div>{modelData.litellm_params?.api_base || "Not Set"}</div>+ </div>++ <div>+ <Text className="font-medium">Custom LLM Provider</Text>+ <div>{modelData.litellm_params?.custom_llm_provider || "Not Set"}</div>+ </div>++ <div>+ <Text className="font-medium">Model</Text>+ <div>{modelData.litellm_params?.model || "Not Set"}</div>+ </div>++ <div>+ <Text className="font-medium">Organization</Text>+ <div>{modelData.litellm_params?.organization || "Not Set"}</div>+ </div>++ <div>+ <Text className="font-medium">TPM (Tokens per Minute)</Text>+ <div>{modelData.litellm_params?.tpm || "Not Set"}</div>+ </div>++ <div>+ <Text className="font-medium">RPM (Requests per Minute)</Text>+ <div>{modelData.litellm_params?.rpm || "Not Set"}</div>+ </div>++ <div>+ <Text className="font-medium">Max Retries</Text>+ <div>{modelData.litellm_params?.max_retries || "Not Set"}</div>+ </div>++ <div>+ <Text className="font-medium">Timeout (seconds)</Text>+ <div>{modelData.litellm_params?.timeout || "Not Set"}</div>+ </div>++ <div>+ <Text className="font-medium">Stream Timeout (seconds)</Text>+ <div>{modelData.litellm_params?.stream_timeout || "Not Set"}</div>+ </div>++ <div>+ <Text className="font-medium">Team ID</Text>+ <div>{modelData.model_info.team_id || "Not Set"}</div>+ </div>++ <div>+ <Text className="font-medium">Created At</Text>+ <div>{modelData.model_info.created_at ? new Date(modelData.model_info.created_at).toLocaleString() : "Not Set"}</div>+ </div>++ <div>+ <Text className="font-medium">Created By</Text>+ <div>{modelData.model_info.created_by || "Not Set"}</div>+ </div>++ <div>+ <Text className="font-medium">LiteLLM Parameters</Text>+ <pre className="bg-gray-100 p-2 rounded text-xs overflow-auto mt-1">+ {JSON.stringify(modelData.cleanedLitellmParams, null, 2)}+ </pre>+ </div>+ </div>+ )}+ </Card>+ </TabPanel>++ <TabPanel>+ <Card>+ <pre className="bg-gray-100 p-4 rounded text-xs overflow-auto">+ {JSON.stringify(modelData, null, 2)}+ </pre>+ </Card>+ </TabPanel>+ </TabPanels>+ </TabGroup>++ {/* Delete Confirmation Modal */}+ {isDeleteModalOpen && (+ <div className="fixed z-10 inset-0 overflow-y-auto">+ <div className="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">+ <div className="fixed inset-0 transition-opacity" aria-hidden="true">+ <div className="absolute inset-0 bg-gray-500 opacity-75"></div>+ </div>++ <span className="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">​</span>++ <div className="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full">+ <div className="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">+ <div className="sm:flex sm:items-start">+ <div className="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left">+ <h3 className="text-lg leading-6 font-medium text-gray-900">+ Delete Model+ </h3>+ <div className="mt-2">+ <p className="text-sm text-gray-500">+ Are you sure you want to delete this model?+ </p>+ </div>+ </div>+ </div>+ </div>+ <div className="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">+ <Button+ onClick={handleDelete}+ className="ml-2"+ danger+ >+ Delete+ </Button>+ <Button onClick={() => setIsDeleteModalOpen(false)}>+ Cancel+ </Button>+ </div>+ </div>+ </div>+ </div>+ )}+ </div>+ );+}\ No newline at end of file