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]

fix(key_edit_view.tsx): allow setting allowed pass through routes by key on key update, on the ui

Krrish Dholakiace8c481431a2
diff --git a/ui/litellm-dashboard/src/components/templates/key_edit_view.tsx b/ui/litellm-dashboard/src/components/templates/key_edit_view.tsx
index b24075f3a44..04dbee673b4 100644
--- a/ui/litellm-dashboard/src/components/templates/key_edit_view.tsx
+++ b/ui/litellm-dashboard/src/components/templates/key_edit_view.tsx
@@ -3,7 +3,7 @@ import { Form, Input, Select, Button as AntdButton, Tooltip } from "antd";
import { Button as TremorButton, TextInput } from "@tremor/react";
import { KeyResponse } from "../key_team_helpers/key_list";
import { fetchTeamModels } from "../organisms/create_key_button";
-import { modelAvailableCall, getPromptsList } from "../networking";
+import { modelAvailableCall, getPromptsList, getPassThroughEndpointsCall } from "../networking";
import NumericalInput from "../shared/numerical_input";
import VectorStoreSelector from "../vector_store_management/VectorStoreSelector";
import MCPServerSelector from "../mcp_server_management/MCPServerSelector";
@@ -59,6 +59,7 @@ export function KeyEditView({
const [form] = Form.useForm();
const [userModels, setUserModels] = useState<string[]>([]);
const [promptsList, setPromptsList] = useState<string[]>([]);
+ const [passThroughRoutesList, setPassThroughRoutesList] = useState<string[]>([]);
const team = teams?.find((team) => team.team_id === keyData.team_id);
const [availableModels, setAvailableModels] = useState<string[]>([]);
const [mcpAccessGroups, setMcpAccessGroups] = useState<string[]>([]);
@@ -113,8 +114,19 @@ export function KeyEditView({
}
};
+ const fetchPassThroughRoutes = async () => {
+ if (!accessToken) return;
+ try {
+ const response = await getPassThroughEndpointsCall(accessToken);
+ setPassThroughRoutesList(response.endpoints.map((route: { path: string }) => route.path));
+ } catch (error) {
+ console.error("Failed to fetch pass through routes:", error);
+ }
+ };
+
fetchPrompts();
fetchModels();
+ fetchPassThroughRoutes();
}, [userID, userRole, accessToken, team, keyData.team_id]);
// Sync disabled callbacks with form when component mounts
@@ -276,6 +288,24 @@ export function KeyEditView({
</Tooltip>
</Form.Item>
+ <Form.Item label="Allowed Pass Through Routes" name="allowed_passthrough_routes">
+ <Tooltip title={!premiumUser ? "Setting allowed pass through routes by key is a premium feature" : ""} placement="top">
+ <Select
+ mode="tags"
+ style={{ width: "100%" }}
+ disabled={!premiumUser}
+ placeholder={
+ !premiumUser
+ ? "Premium feature - Upgrade to set allowed pass through routes by key"
+ : Array.isArray(keyData.metadata?.allowed_passthrough_routes) && keyData.metadata.allowed_passthrough_routes.length > 0
+ ? `Current: ${keyData.metadata.allowed_passthrough_routes.join(", ")}`
+ : "Select or enter allowed pass through routes"
+ }
+ options={passThroughRoutesList.map((name) => ({ value: name, label: name }))}
+ />
+ </Tooltip>
+ </Form.Item>
+
<Form.Item label="Vector Stores" name="vector_stores">
<VectorStoreSelector
onChange={(values: string[]) => form.setFieldValue("vector_stores", values)}
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 e6ae7e6639e..1d1b472dd1f 100644
--- a/ui/litellm-dashboard/src/components/templates/key_info_view.tsx
+++ b/ui/litellm-dashboard/src/components/templates/key_info_view.tsx
@@ -642,6 +642,19 @@ export default function KeyInfoView({
</Text>
</div>
+ <div>
+ <Text className="font-medium">Allowed Pass Through Routes</Text>
+ <Text>
+ {Array.isArray(currentKeyData.metadata?.allowed_passthrough_routes) && currentKeyData.metadata.allowed_passthrough_routes.length > 0
+ ? currentKeyData.metadata.allowed_passthrough_routes.map((route, index) => (
+ <span key={index} className="px-2 mr-2 py-1 bg-blue-100 rounded text-xs">
+ {route}
+ </span>
+ ))
+ : "No pass through routes specified"}
+ </Text>
+ </div>
+
<div>
<Text className="font-medium">Models</Text>
<div className="flex flex-wrap gap-2 mt-1">