From e321ba7959d7be947d1b067033b1a5aabf346812 Mon Sep 17 00:00:00 2001
From: Dayuan Jiang <34411969+DayuanJiang@users.noreply.github.com>
Date: Fri, 12 Dec 2025 16:13:06 +0900
Subject: [PATCH] chore: optimize Vercel costs by removing analytics and
configuring functions (#238)
- Create vercel.json with optimized function settings:
- Chat API: 512MB memory, 120s timeout
- Other APIs: 256MB memory, 10s timeout
- Remove @vercel/analytics package and imports
- Reduce chat route maxDuration from 300s to 120s
Expected savings: $2-4/month, keeping costs under $20 included credit
---
app/api/chat/route.ts | 2 +-
app/layout.tsx | 2 --
package-lock.json | 43 ++-----------------------------------------
package.json | 1 -
vercel.json | 12 ++++++++++++
5 files changed, 15 insertions(+), 45 deletions(-)
create mode 100644 vercel.json
diff --git a/app/api/chat/route.ts b/app/api/chat/route.ts
index 58c3826..101d895 100644
--- a/app/api/chat/route.ts
+++ b/app/api/chat/route.ts
@@ -18,7 +18,7 @@ import {
} from "@/lib/langfuse"
import { getSystemPrompt } from "@/lib/system-prompts"
-export const maxDuration = 300
+export const maxDuration = 120
// File upload limits (must match client-side)
const MAX_FILE_SIZE = 2 * 1024 * 1024 // 2MB
diff --git a/app/layout.tsx b/app/layout.tsx
index 19f0134..5abd5ba 100644
--- a/app/layout.tsx
+++ b/app/layout.tsx
@@ -1,5 +1,4 @@
import { GoogleAnalytics } from "@next/third-parties/google"
-import { Analytics } from "@vercel/analytics/react"
import type { Metadata, Viewport } from "next"
import { JetBrains_Mono, Plus_Jakarta_Sans } from "next/font/google"
import { DiagramProvider } from "@/contexts/diagram-context"
@@ -117,7 +116,6 @@ export default function RootLayout({
className={`${plusJakarta.variable} ${jetbrainsMono.variable} antialiased`}
>
{children}
-