fix(providers): support local OpenAI-style endpoints without auth

Treat LM Studio, vLLM, Llamafile, Triton, Docker Model Runner,
XInference, and oobabooga as managed local providers with default
base URLs and passthrough model discovery.

Avoid sending empty bearer headers during validation, model discovery,
and execution so self-hosted endpoints work without API keys while
still honoring custom base URLs and localized dashboard hints.
This commit is contained in:
diegosouzapw
2026-04-23 16:55:44 -03:00
parent 01dd72cf1f
commit 968cbfeb15
14 changed files with 486 additions and 42 deletions

View File

@@ -1,5 +1,6 @@
import { z } from "zod";
import { SUPPORTED_BATCH_ENDPOINTS } from "@/shared/constants/batchEndpoints";
import { isLocalProvider } from "@/shared/constants/providers";
import { HIDEABLE_SIDEBAR_ITEM_IDS } from "@/shared/constants/sidebarVisibility";
import { isForbiddenUpstreamHeaderName } from "@/shared/constants/upstreamHeaders";
@@ -243,8 +244,8 @@ export const createProviderSchema = z
})
.superRefine((data, ctx) => {
const apiKey = typeof data.apiKey === "string" ? data.apiKey.trim() : "";
const apiKeyOptionalProviders = new Set(["searxng-search", "sdwebui", "comfyui"]);
if (!apiKeyOptionalProviders.has(data.provider) && apiKey.length === 0) {
const apiKeyOptional = data.provider === "searxng-search" || isLocalProvider(data.provider);
if (!apiKeyOptional && apiKey.length === 0) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: "API key is required",