From cdaf7caea8f195150bbdc4d5ba6ad96b7bc0ee4d Mon Sep 17 00:00:00 2001 From: shrimbly Date: Fri, 27 Feb 2026 23:51:00 +1300 Subject: [PATCH] fix: remove API key from Veo video URL response The MAX_BASE64_SIZE check was returning the video URL with the API key appended as a query parameter to the browser client for videos over 20MB. Always encode to base64 instead since the buffer is already downloaded. Co-Authored-By: Claude Opus 4.6 --- src/app/api/generate/providers/gemini.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/app/api/generate/providers/gemini.ts b/src/app/api/generate/providers/gemini.ts index ae00c4ce..5950f190 100644 --- a/src/app/api/generate/providers/gemini.ts +++ b/src/app/api/generate/providers/gemini.ts @@ -320,16 +320,6 @@ export async function generateWithGeminiVideo( const videoSizeMB = (videoBuffer.byteLength / (1024 * 1024)).toFixed(2); console.log(`[API:${requestId}] Video downloaded: ${videoSizeMB}MB`); - // Convert to base64 data URL if small enough, otherwise return URL - const MAX_BASE64_SIZE = 20 * 1024 * 1024; // 20MB - if (videoBuffer.byteLength > MAX_BASE64_SIZE) { - console.log(`[API:${requestId}] Video too large for base64 (${videoSizeMB}MB), returning URL`); - return { - success: true, - outputs: [{ type: "video", data: "", url: videoUrl }], - }; - } - const base64Video = Buffer.from(videoBuffer).toString("base64"); const dataUrl = `data:video/mp4;base64,${base64Video}`;