fix: make API key optional for ollama-local provider validation (closes #492) (#493)

This commit is contained in:
Anurag Saxena
2026-04-06 15:10:15 +07:00
committed by GitHub
parent ebb8d4eeb6
commit 7db4b9834e
+4 -4
View File
@@ -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;
}