From 7db4b9834e830a803ca8a52538ffd722b07c7032 Mon Sep 17 00:00:00 2001 From: Anurag Saxena Date: Mon, 6 Apr 2026 04:10:15 -0400 Subject: [PATCH] fix: make API key optional for ollama-local provider validation (closes #492) (#493) --- src/app/api/providers/validate/route.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/api/providers/validate/route.js b/src/app/api/providers/validate/route.js index f1cc3df..0247a8a 100644 --- a/src/app/api/providers/validate/route.js +++ b/src/app/api/providers/validate/route.js @@ -9,7 +9,7 @@ export async function POST(request) { const body = await request.json(); const { provider, apiKey } = body; - if (!provider || !apiKey) { + if (!provider || (!apiKey && provider !== "ollama-local")) { return NextResponse.json({ error: "Provider and API key required" }, { status: 400 }); } @@ -189,9 +189,9 @@ export async function POST(request) { chutes: "https://llm.chutes.ai/v1/models", nvidia: "https://integrate.api.nvidia.com/v1/models" }; - const res = await fetch(endpoints[provider], { - headers: { "Authorization": `Bearer ${apiKey}` }, - }); + const headers = {}; + if (apiKey) headers["Authorization"] = `Bearer ${apiKey}`; + const res = await fetch(endpoints[provider], { headers }); isValid = res.ok; break; }