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
more window guards
Achintya Rajan00f61b214c04
diff --git a/ui/litellm-dashboard/src/app/dashboard/virtual-keys/components/VirtualKeysTable/VirtualKeysTable.tsx b/ui/litellm-dashboard/src/app/dashboard/virtual-keys/components/VirtualKeysTable/VirtualKeysTable.tsxindex b7727a299bf..cbf10f97715 100644--- a/ui/litellm-dashboard/src/app/dashboard/virtual-keys/components/VirtualKeysTable/VirtualKeysTable.tsx+++ b/ui/litellm-dashboard/src/app/dashboard/virtual-keys/components/VirtualKeysTable/VirtualKeysTable.tsx@@ -105,18 +105,19 @@ const VirtualKeysTable = ({// Add a useEffect to call refresh when a key is createduseEffect(() => {- if (refresh) {- const handleStorageChange = () => {- refresh();- };+ if (!refresh || typeof window === "undefined") {+ return;+ }+ const handleStorageChange = () => {+ refresh();+ };- // Listen for storage events that might indicate a key was created- window.addEventListener("storage", handleStorageChange);+ // Listen for storage events that might indicate a key was created+ window.addEventListener("storage", handleStorageChange);- return () => {- window.removeEventListener("storage", handleStorageChange);- };- }+ return () => {+ window.removeEventListener("storage", handleStorageChange);+ };}, [refresh]);const columns: ColumnDef<KeyResponse>[] = [diff --git a/ui/litellm-dashboard/src/utils/cookieUtils.ts b/ui/litellm-dashboard/src/utils/cookieUtils.tsindex e477a9f77e0..23682fd6e81 100644--- a/ui/litellm-dashboard/src/utils/cookieUtils.ts+++ b/ui/litellm-dashboard/src/utils/cookieUtils.ts@@ -6,6 +6,10 @@* Clears the token cookie from both root and /ui paths*/export function clearTokenCookies() {+ if (typeof window === "undefined" || typeof document === "undefined") {+ return;+ }+// Get the current domainconst domain = window.location.hostname;