diff --git a/src/config.js b/src/config.js index 4752849..45bee17 100644 --- a/src/config.js +++ b/src/config.js @@ -83,13 +83,28 @@ export async function getAPIConfig() { const { getSelectedModel } = await import("./models.js"); const selectedModel = getSelectedModel(); - // Check if the selected model has a registered endpoint - use that instead of custom + // Check if the selected model has a registered endpoint const { getSelectedModelEndpoint } = await import("./models.js"); const modelEndpoint = getSelectedModelEndpoint(); - // If model has its own endpoint, use that regardless of custom setting - if (modelEndpoint && modelEndpoint !== customBaseURL) { - console.log("🚀 Model has registered endpoint - using:", modelEndpoint); + // If model endpoint matches custom endpoint, use custom API credentials + if (modelEndpoint === customBaseURL) { + console.log("🔧 Model endpoint matches custom API - using custom credentials"); + return { + isCustom: true, + endpoint: customBaseURL, + apiKey: customAPIKey, + model: selectedModel, + headers: { + "Authorization": `Bearer ${customAPIKey}`, + "Content-Type": "application/json" + } + }; + } + + // If model has built-in endpoint (like Hermes), use that with built-in credentials + if (modelEndpoint && VLLM_ENDPOINTS.some(ep => ep.url === modelEndpoint)) { + console.log("🚀 Model has built-in endpoint - using:", modelEndpoint); return { isCustom: false, endpoint: modelEndpoint,