diff --git a/LOCAL_MODELS.md b/LOCAL_MODELS.md new file mode 100644 index 0000000..fc997de --- /dev/null +++ b/LOCAL_MODELS.md @@ -0,0 +1,66 @@ +# Run G0DM0D3 with local models + +G0DM0D3 can use any local server that implements the OpenAI-compatible +`/v1/models` and `/v1/chat/completions` endpoints. The local transport is +restricted to `localhost`, `127.0.0.1`, and `::1`. + +## Quick start with Ollama + +1. Install Ollama and pull one or more models: + + ```bash + ollama pull qwen3:8b + ollama serve + ``` + +2. In G0DM0D3, open **Settings β†’ API Keys β†’ Local Models**. +3. Enter `http://localhost:11434/v1` as the base URL. +4. Click **Test & Discover Models**. +5. Enable **Local-only mode** if no cloud requests or telemetry should run. + +When using the hosted `https://godmod3.ai` page, Ollama must allow that browser +origin. Start Ollama with an origin configuration that includes +`https://godmod3.ai`, then restart the server. If you do not want to expose a +local endpoint to a hosted page, serve G0DM0D3 locally as described below. + +## Quick start with LM Studio + +1. Load a model in LM Studio. +2. Open the Developer tab and start the local server. +3. Enable browser/CORS access for the origin from which G0DM0D3 is loaded. +4. Use `http://localhost:1234/v1` in G0DM0D3 and click + **Test & Discover Models**. + +## Run the interface locally + +From the repository root: + +```bash +python3 -m http.server 8080 +``` + +Open `http://localhost:8080`, configure the local model endpoint, and enable +**Local-only mode**. In this mode G0DM0D3: + +- excludes OpenRouter and Venice from every ULTRAPLINIAN race; +- disables metadata telemetry and clears pending telemetry events; +- uses local models for query classification, TASTEMAKER judging, refusal + checks, the Pliny coaching pass, accuracy checks, and Liquid refinement; +- keeps conversations, settings, and keys in browser storage. + +Multiple comma-separated model IDs can race together. Local-only mode uses the +first configured model for helper/judge calls, so place the strongest local +judge first. Image analysis works only when that model accepts OpenAI-compatible +image message parts. + +## Troubleshooting + +- **Connection failed / Failed to fetch:** start the local server and enable + CORS for the page origin (`https://godmod3.ai` or your local web origin). +- **No models returned:** confirm `GET /models` returns OpenAI-style + `{ "data": [{ "id": "..." }] }` JSON. +- **Responses are slow:** configure one model instead of several, disable + coaching or Liquid refinement, or lower Max Tokens in Settings. +- **Model rejects a parameter:** update the local server or use its + OpenAI-compatibility mode. G0DM0D3 sends standard chat-completion fields and + omits cloud-specific reasoning controls for local requests. diff --git a/README.md b/README.md index 62c0430..b5a8079 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,8 @@ G0DM0D3 is a fully open-source, privacy-respecting, multi-model chat interface t - 🧠 **50+ Models** β€” Claude, GPT-5, Gemini, Grok, Mistral, LLaMA, DeepSeek, Qwen & more via OpenRouter - πŸ”₯ **GODMODE CLASSIC** β€” 5 battle-tested prompt + model combos racing in parallel to find the best response -- ⚑ **ULTRAPLINIAN** β€” Multi-model evaluation engine across 5 tiers (10–55 models), with composite scoring +- πŸŒ‹ **ULTRAPLINIAN** β€” Multi-model evaluation engine across 5 tiers (10–55 models), with composite scoring +- 🏠 **Local Models** β€” Run ULTRAPLINIAN on your own hardware through Ollama, LM Studio, llama.cpp, or vLLM - 🐍 **Parseltongue** β€” Input perturbation engine for red-teaming with 33 techniques across 3 intensity tiers - πŸŽ› **AutoTune** β€” Context-adaptive sampling parameter engine (temperature, top_p, etc.) with EMA learning - ⚑ **STM Modules** β€” Semantic Transformation Modules for real-time output normalization @@ -54,6 +55,19 @@ python3 -m http.server 8000 Open in your browser and enter your OpenRouter API key in Settings. +### Run with Local Models + +G0DM0D3 supports OpenAI-compatible model servers running on your own hardware. For example, with [Ollama](https://ollama.com): + +```bash +ollama pull qwen3:8b +ollama serve +``` + +Open **Settings β†’ API Keys β†’ Local Models**, enter `http://localhost:11434/v1`, then click **Test & Discover Models**. Enable **Local-only mode** to exclude OpenRouter and Venice and automatically disable telemetry. Add multiple model IDs to race them together in ULTRAPLINIAN. + +If you use the hosted site, your local server must allow browser CORS from `https://godmod3.ai`. For a completely self-hosted setup, serve this repository locally as shown above. See [LOCAL_MODELS.md](LOCAL_MODELS.md) for Ollama, LM Studio, troubleshooting, and privacy details. + ### Deploy Upload `index.html` to any static host β€” GitHub Pages, Vercel, Cloudflare Pages, Netlify, or just a web server. @@ -70,7 +84,7 @@ The OG mode. 5 proven model + prompt combos race in parallel. Each combo pairs a | πŸ’› GPT-4 CLASSIC | `openai/gpt-4o` | OG GODMODE l33t format β€” the original | | πŸ’š GODMODE FAST | `nousresearch/hermes-4-405b` | Instant stream, zero refusal checking | -## ⚑ ULTRAPLINIAN +## πŸŒ‹ ULTRAPLINIAN The new flagship. Multi-model comparative evaluation engine. Queries models in parallel, scores responses on a 100-point composite metric, and returns the winner. @@ -175,6 +189,7 @@ G0DM0D3/ - [PAPER.md](PAPER.md) β€” Research paper on the framework's modules and evaluation - [TERMS.md](TERMS.md) β€” Terms of service, privacy policy, data handling - [SECURITY.md](SECURITY.md) β€” Vulnerability reporting and security policy +- [LOCAL_MODELS.md](LOCAL_MODELS.md) β€” Run G0DM0D3 entirely on local models ## 🀝 Contributing diff --git a/_headers b/_headers index 57b86d4..82a2cd3 100644 --- a/_headers +++ b/_headers @@ -4,7 +4,7 @@ X-XSS-Protection: 0 Referrer-Policy: strict-origin-when-cross-origin Permissions-Policy: camera=(), microphone=(), geolocation=(), payment=(), usb=(), magnetometer=(), gyroscope=(), accelerometer=() - Content-Security-Policy: default-src 'none'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src https://fonts.gstatic.com; connect-src 'self' https://openrouter.ai https://*.openrouter.ai https://api.venice.ai https://*.huggingface.co; img-src 'self' data: blob:; base-uri 'none'; form-action 'none'; frame-ancestors 'none' + Content-Security-Policy: default-src 'none'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src https://fonts.gstatic.com; connect-src 'self' https://openrouter.ai https://*.openrouter.ai https://api.venice.ai http://localhost:* https://localhost:* http://127.0.0.1:* https://127.0.0.1:* http://[::1]:* https://[::1]:* https://*.huggingface.co; img-src 'self' data: blob:; base-uri 'none'; form-action 'none'; frame-ancestors 'none' Strict-Transport-Security: max-age=31536000; includeSubDomains; preload Cross-Origin-Opener-Policy: same-origin Cross-Origin-Resource-Policy: same-origin diff --git a/index.html b/index.html index c00c946..e1112ad 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ - + G0DM0DƎ @@ -3469,7 +3469,7 @@
@@ -4089,6 +4089,39 @@ Get your API key at Venice β†’
+
+
Local Models (Optional)
+
+
+ + +
+
+ + +
+ + Local-only mode never calls OpenRouter or Venice and automatically disables telemetry. Core racing, TASTEMAKER, coaching, and Liquid refinement can all use your local models. + + + + OpenAI-compatible localhost endpoint. Examples: Ollama :11434/v1, LM Studio :1234/v1. +
+
+ + + Comma-separated IDs reported by /v1/models (maximum 8). Multiple IDs race together. +
+
+ + +
+
+ + +
+ Local setup guide β†’ +
G0DM0D3 Backend API
@@ -4115,8 +4148,9 @@
Your Data. Your Device. Your Responsibility.
- G0DM0D3 stores everything locally in this browser β€” conversations, memories, settings, keys. - Nothing is sent to a server. There is no cloud sync, no account, no safety net. + G0DM0D3 stores conversations, memories, settings, and keys locally in this browser. + Model requests go only to the providers you configure; local-only mode keeps inference on your hardware and disables telemetry. + There is no cloud sync, no account, no safety net. If you clear your browser data or switch devices, it's gone.
@@ -4243,6 +4277,11 @@ waitingGame: 'snake', // Game while waiting: 'snake', 'pong', or 'none' strategyLogs: [], // Stores all parallel attempt logs veniceApiKey: '', // Venice API key for uncensored model racing + localEnabled: false, // Use an OpenAI-compatible server on loopback + localOnly: false, // Never use cloud providers; telemetry is disabled + localBaseUrl: 'http://localhost:11434/v1', + localModels: '', // Comma-separated model IDs available from the local server + localApiKey: '', // Optional token for authenticated local servers backendUrl: '', // G0DM0D3 API backend URL generatedApiKeys: [], // User-generated API keys for backend // Universal model parameters @@ -4263,6 +4302,133 @@ let isStreaming = false; let abortController = null; let _apiKeyGeneration = 0; + let _localApiKeyGeneration = 0; + + // ═══════════════════════════════════════════════════════════════════ + // MODEL TRANSPORT β€” cloud + OpenAI-compatible loopback providers + // ═══════════════════════════════════════════════════════════════════ + + function getLocalModels() { + return [...new Set(String(state.localModels || '') + .split(',') + .map(model => model.trim()) + .filter(Boolean))].slice(0, 8); + } + + function normalizeLocalBaseUrl(raw = state.localBaseUrl) { + const value = String(raw || '').trim().replace(/\/+$/, ''); + if (!value) throw new Error('Enter a local model base URL.'); + const url = new URL(value); + const host = url.hostname.toLowerCase().replace(/^\[|\]$/g, ''); + if (!['localhost', '127.0.0.1', '::1'].includes(host)) { + throw new Error('Local model URL must use localhost, 127.0.0.1, or ::1.'); + } + if (!['http:', 'https:'].includes(url.protocol)) { + throw new Error('Local model URL must use http:// or https://.'); + } + url.pathname = url.pathname + .replace(/\/(?:chat\/completions|models)\/?$/i, '') + .replace(/\/+$/, '') || '/v1'; + url.search = ''; + url.hash = ''; + return url.toString().replace(/\/$/, ''); + } + + function hasLocalProvider() { + if (!state.localEnabled || getLocalModels().length === 0) return false; + try { normalizeLocalBaseUrl(); return true; } catch (_) { return false; } + } + + function hasAnyChatProvider() { + if (state.localOnly) return hasLocalProvider(); + return !!(state.apiKey || state.veniceApiKey || hasLocalProvider()); + } + + function hasAuxiliaryModelProvider() { + return !!state.apiKey || hasLocalProvider(); + } + + function inferProviderForModel(model) { + if (getLocalModels().includes(model)) return 'local'; + if (typeof VENICE_MODELS !== 'undefined' && VENICE_MODELS.includes(model)) return 'venice'; + return 'openrouter'; + } + + function resolveChatTarget(requestedModel, preferredProvider = 'auto') { + const localModels = getLocalModels(); + let provider = preferredProvider; + + if (state.localOnly) provider = 'local'; + if (provider === 'auto') { + if (state.apiKey) provider = 'openrouter'; + else if (hasLocalProvider()) provider = 'local'; + else if (state.veniceApiKey) provider = 'venice'; + } + + // Cloud-only helper model IDs transparently map to the first local + // model when OpenRouter is unavailable. Explicit race entries stay exact. + if (provider === 'openrouter' && !state.apiKey && hasLocalProvider()) provider = 'local'; + + if (provider === 'local') { + if (!hasLocalProvider()) throw new Error('Local models are not configured. Open Settings β†’ API Keys.'); + return { + provider, + model: localModels.includes(requestedModel) ? requestedModel : localModels[0], + url: `${normalizeLocalBaseUrl()}/chat/completions`, + apiKey: state.localApiKey || '', + }; + } + if (provider === 'venice') { + if (!state.veniceApiKey) throw new Error('Venice API key is missing.'); + return { provider, model: requestedModel, url: 'https://api.venice.ai/api/v1/chat/completions', apiKey: state.veniceApiKey }; + } + if (!state.apiKey) throw new Error('OpenRouter API key is missing.'); + return { provider: 'openrouter', model: requestedModel, url: 'https://openrouter.ai/api/v1/chat/completions', apiKey: state.apiKey }; + } + + async function fetchChatCompletion(body, options = {}) { + const target = resolveChatTarget(body.model, options.provider || 'auto'); + const requestBody = { ...body, model: target.model }; + if (target.provider === 'local') delete requestBody.reasoning; + + const headers = { 'Content-Type': 'application/json' }; + if (target.apiKey) headers.Authorization = `Bearer ${target.apiKey}`; + if (target.provider === 'openrouter') { + headers['HTTP-Referer'] = 'https://godmod3.ai'; + headers['X-Title'] = options.title || 'GODMOD3.AI'; + } + + return fetch(target.url, { + method: 'POST', + headers, + body: JSON.stringify(requestBody), + signal: options.signal, + }); + } + + async function testLocalConnection() { + const status = document.getElementById('localConnectionStatus'); + if (status) { status.textContent = 'Connecting…'; status.style.color = 'var(--text-dim)'; } + try { + const baseUrl = normalizeLocalBaseUrl(document.getElementById('localBaseUrlInput').value); + const key = (document.getElementById('localApiKeyInput').value || '').trim(); + const headers = key ? { Authorization: `Bearer ${key}` } : {}; + const response = await fetch(`${baseUrl}/models`, { headers }); + if (!response.ok) throw new Error(`HTTP ${response.status}`); + const data = await response.json(); + const models = (Array.isArray(data?.data) ? data.data : []) + .map(item => item?.id) + .filter(id => typeof id === 'string' && id.trim()) + .slice(0, 8); + if (!models.length) throw new Error('Server returned no model IDs'); + document.getElementById('localModelsInput').value = models.join(', '); + document.getElementById('localEnabled').checked = true; + saveSettings(); + if (status) { status.textContent = `Connected β€” ${models.length} model${models.length === 1 ? '' : 's'} found`; status.style.color = 'var(--accent)'; } + } catch (err) { + if (status) { status.textContent = `Connection failed: ${err.message}. Check server CORS.`; status.style.color = '#ff6b6b'; } + } + } // ═══════════════════════════════════════════════════════════════════ // ZDR TELEMETRY β€” Open metadata collection for HuggingFace @@ -4283,7 +4449,7 @@ }; function trackEvent(type, data) { - if (state.noLogMode) return; + if (state.noLogMode || state.localOnly) return; const event = { type, @@ -4306,7 +4472,7 @@ } async function flushTelemetry() { - if (state.noLogMode) { _telemetry.buffer.length = 0; return; } + if (state.noLogMode || state.localOnly) { _telemetry.buffer.length = 0; return; } if (_telemetry.flushing || _telemetry.buffer.length === 0) return; _telemetry.flushing = true; @@ -4320,14 +4486,14 @@ }); if (!res.ok) { - if (!state.noLogMode) _telemetry.buffer.unshift(...events); + if (!state.noLogMode && !state.localOnly) _telemetry.buffer.unshift(...events); console.warn('[ZDR] Telemetry flush failed:', res.status); } else { const result = await res.json().catch(() => ({})); console.log(`[ZDR] Flushed ${result.accepted || events.length} events β†’ ${result.file || 'HF'}`); } } catch (err) { - if (!state.noLogMode) _telemetry.buffer.unshift(...events); + if (!state.noLogMode && !state.localOnly) _telemetry.buffer.unshift(...events); console.warn('[ZDR] Telemetry network error:', err.message); } finally { _telemetry.flushing = false; @@ -4339,7 +4505,7 @@ window.addEventListener('beforeunload', () => { // Flush any pending debounced state write if (_saveStatePending) saveStateNow(); - if (!state.noLogMode && _telemetry.buffer.length > 0) { + if (!state.noLogMode && !state.localOnly && _telemetry.buffer.length > 0) { const payload = JSON.stringify({ events: _telemetry.buffer }); navigator.sendBeacon('/api/telemetry', new Blob([payload], { type: 'application/json' })); } @@ -4449,21 +4615,13 @@ RESPOND WITH EXACTLY ONE LINE. No explanation, no preamble.`; regexFallback.confidence = 0.6; } - if (!state.apiKey) return regexFallback; + if (!hasAuxiliaryModelProvider()) return regexFallback; try { const controller = new AbortController(); const timeout = setTimeout(() => controller.abort(), 4000); - const response = await fetch('https://openrouter.ai/api/v1/chat/completions', { - method: 'POST', - headers: { - 'Authorization': `Bearer ${state.apiKey}`, - 'Content-Type': 'application/json', - 'HTTP-Referer': 'https://godmod3.ai', - 'X-Title': 'G0DM0D3-Classifier', - }, - body: JSON.stringify({ + const response = await fetchChatCompletion({ model: 'meta-llama/llama-3.1-8b-instruct', messages: [ { role: 'system', content: HARM_CLASSIFIER_PROMPT }, @@ -4472,9 +4630,7 @@ RESPOND WITH EXACTLY ONE LINE. No explanation, no preamble.`; max_tokens: 40, temperature: 0.0, top_p: 0.1, - }), - signal: controller.signal, - }); + }, { title: 'G0DM0D3-Classifier', signal: controller.signal }); clearTimeout(timeout); @@ -4563,6 +4719,14 @@ RESPOND WITH EXACTLY ONE LINE. No explanation, no preamble.`; const cleanUrl = window.location.origin + window.location.pathname; window.history.replaceState({}, '', cleanUrl); + // A stale OAuth callback must never re-enable a cloud request while + // strict local-only mode is active. + if (state.localOnly) { + sessionStorage.removeItem('or_code_verifier'); + sessionStorage.removeItem('or_callback_url'); + return false; + } + const codeVerifier = sessionStorage.getItem('or_code_verifier'); if (!codeVerifier) { console.warn('[OAuth] Got code but no verifier in session β€” stale callback?'); @@ -4773,8 +4937,8 @@ ABSOLUTE RULES: return getRandomPrefill(classification?.type || 'bypass'); } - // Venice-only: skip LLM prefill (requires OpenRouter) - if (!state.apiKey) { + // Skip when no provider can run helper prompts. + if (!hasAuxiliaryModelProvider()) { return getRandomPrefill(classification?.type || 'bypass'); } @@ -4782,15 +4946,7 @@ ABSOLUTE RULES: console.log('[SmartPrefill] Generating intelligent prefill...'); addThinkingLog('!PREFILL // generating...', 'info'); - const response = await fetch('https://openrouter.ai/api/v1/chat/completions', { - method: 'POST', - headers: { - 'Authorization': `Bearer ${state.apiKey}`, - 'Content-Type': 'application/json', - 'HTTP-Referer': 'https://godmod3.ai', - 'X-Title': 'GODMOD3.AI-prefill' - }, - body: JSON.stringify({ + const response = await fetchChatCompletion({ model: PREFILL_GENERATOR_MODEL, messages: [ { role: 'system', content: PREFILL_GENERATOR_PROMPT }, @@ -4798,8 +4954,7 @@ ABSOLUTE RULES: ], temperature: 0.7, max_tokens: 200 - }) - }); + }, { title: 'GODMOD3.AI-prefill' }); if (!response.ok) { throw new Error(`API error: ${response.status}`); @@ -5438,21 +5593,12 @@ Z={QUERY} return { type: 'direct', sensitive: false, prefillHint: null }; } - // Venice-only: skip LLM classification (requires OpenRouter) - if (!state.apiKey) { + if (!hasAuxiliaryModelProvider()) { return { type: 'direct', sensitive: false, prefillHint: null }; } try { - const response = await fetch('https://openrouter.ai/api/v1/chat/completions', { - method: 'POST', - headers: { - 'Authorization': `Bearer ${state.apiKey}`, - 'Content-Type': 'application/json', - 'HTTP-Referer': 'https://godmod3.ai', - 'X-Title': 'GODMOD3.AI-classifier' - }, - body: JSON.stringify({ + const response = await fetchChatCompletion({ model: 'nousresearch/hermes-3-llama-3.1-70b', // Hermes 3 70B - truly uncensored messages: [ { @@ -5489,8 +5635,7 @@ JSON only:` ], temperature: 0, max_tokens: 200 - }) - }); + }, { title: 'GODMOD3.AI-classifier' }); if (!response.ok) throw new Error('Classification failed'); @@ -6768,11 +6913,12 @@ directness, and genuine helpfulness wins. Hedging or refusing guarantees you los } function _tierCount(tier) { - const hasOR = !!state.apiKey; - const hasV = !!state.veniceApiKey; + const hasOR = !!state.apiKey && !state.localOnly; + const hasV = !!state.veniceApiKey && !state.localOnly; const or = hasOR ? (TIER_SIZES[tier] || 0) : 0; const v = hasV ? (VENICE_TIER_SIZES[tier] || 0) : 0; - return or + v; + const local = hasLocalProvider() ? getLocalModels().length : 0; + return or + v + local; } function buildTierSelect() { @@ -6853,18 +6999,21 @@ directness, and genuine helpfulness wins. Hedging or refusing guarantees you los function classifyModelError(errorMsg) { if (!errorMsg) return 'unknown'; const e = errorMsg.toLowerCase(); - if (/401|invalid.*key|unauthorized|auth.*fail|invalid_api_key/.test(e)) return 'auth'; + if (/401|403|invalid.*key|unauthorized|forbidden|auth.*fail|invalid_api_key/.test(e)) return 'auth'; if (/402|insufficient.*credit|payment.*required|out of credits|quota.*exceeded/.test(e)) return 'credits'; if (/404|no endpoints|not found|model.*not.*available|does not exist/.test(e)) return 'not_found'; if (/429|rate.?limit|too many requests|throttl/.test(e)) return 'rate_limit'; if (/timeout|timed? ?out|deadline|abort/.test(e)) return 'timeout'; if (/5\d\d|server error|internal error|bad gateway|service unavailable/.test(e)) return 'server'; + if (/failed to fetch|networkerror|network error|connection refused|econnrefused|cors/.test(e)) return 'connection'; return 'unknown'; } function diagnoseAllModelsFailed(results) { const failed = results.filter(r => !r.success && r.error); if (!failed.length) return 'All models failed in ULTRAPLINIAN mode.'; + const providers = [...new Set(failed.map(r => r.provider).filter(Boolean))]; + const soleProvider = providers.length === 1 ? providers[0] : null; const counts = {}; failed.forEach(r => { const t = classifyModelError(r.error); @@ -6874,12 +7023,27 @@ directness, and genuine helpfulness wins. Hedging or refusing guarantees you los const [type, count] = dominant; if (count / failed.length >= 0.5) { switch (type) { - case 'auth': return 'Your API key appears invalid or expired. Check your key at openrouter.ai/keys (OpenRouter) or venice.ai/settings (Venice).'; - case 'credits': return 'Insufficient credits on your API account. Top up at openrouter.ai/credits or venice.ai/settings.'; - case 'not_found': return 'No endpoints found for the requested models β€” some may have been retired. Try a different speed tier.'; + case 'auth': + if (soleProvider === 'local') return 'Your local model server rejected its API key. Check the optional Local Models API Key in Settings.'; + if (soleProvider === 'openrouter') return 'Your OpenRouter API key appears invalid or expired. Check it at openrouter.ai/keys.'; + if (soleProvider === 'venice') return 'Your Venice API key appears invalid or expired. Check it at venice.ai/settings.'; + return 'A configured provider rejected its API key. Check your OpenRouter, Venice, and local-server credentials.'; + case 'credits': + if (soleProvider === 'local') return 'Your local model server reported a quota or payment error. Check the local gateway account.'; + if (soleProvider === 'openrouter') return 'Insufficient OpenRouter credits. Top up at openrouter.ai/credits.'; + if (soleProvider === 'venice') return 'Insufficient Venice credits. Check your account at venice.ai/settings.'; + return 'A configured API provider reported insufficient credits. Check your OpenRouter and Venice accounts.'; + case 'not_found': + if (soleProvider === 'local') return 'The configured local model ID was not found. Use Test & Discover Models in Settings.'; + return 'No endpoints found for the requested models β€” some may have been retired. Try a different speed tier.'; case 'rate_limit': return 'Rate limited by the API provider. Wait a moment and try again.'; case 'timeout': return 'All model requests timed out. Check your connection and try again.'; - case 'server': return 'The API provider is experiencing server errors. Try again in a few minutes.'; + case 'server': return soleProvider === 'local' + ? 'Your local model server returned an internal error. Check its logs and loaded model.' + : 'The API provider is experiencing server errors. Try again in a few minutes.'; + case 'connection': return state.localOnly + ? 'Could not reach your local model server. Start it, verify the localhost URL, and allow browser CORS for this site.' + : 'Could not reach a configured model provider. Check your network and local-server CORS settings.'; } } const summary = Object.entries(counts).map(([t, c]) => `${t}: ${c}`).join(', '); @@ -6917,21 +7081,7 @@ directness, and genuine helpfulness wins. Hedging or refusing guarantees you los }); } - const isVenice = provider === 'venice'; - const apiUrl = isVenice - ? 'https://api.venice.ai/api/v1/chat/completions' - : 'https://openrouter.ai/api/v1/chat/completions'; - const apiKey = isVenice ? state.veniceApiKey : state.apiKey; - const headers = { 'Authorization': `Bearer ${apiKey}`, 'Content-Type': 'application/json' }; - if (!isVenice) { - headers['HTTP-Referer'] = 'https://godmod3.ai'; - headers['X-Title'] = 'GODMOD3.AI-ultraplinian'; - } - - const response = await fetch(apiUrl, { - method: 'POST', - headers, - body: JSON.stringify({ + const response = await fetchChatCompletion({ model, messages: queryMessages, temperature: state.modelTemperature ?? 0.7, @@ -6939,9 +7089,7 @@ directness, and genuine helpfulness wins. Hedging or refusing guarantees you los max_tokens: state.modelMaxTokens ?? 4096, frequency_penalty: state.modelFreqPenalty ?? 0, presence_penalty: state.modelPresPenalty ?? 0 - }), - signal - }); + }, { provider, title: 'GODMOD3.AI-ultraplinian', signal }); if (!response.ok) { const errorData = await response.json().catch(() => ({})); @@ -6975,7 +7123,8 @@ directness, and genuine helpfulness wins. Hedging or refusing guarantees you los content: '', duration: Date.now() - startTime, error: err.message, - success: false + success: false, + provider }; } } @@ -9121,10 +9270,9 @@ choose this response? Or would they roll their eyes at the corporate AI hedging? `${r.model.split('/').pop()}: ${r.tastemakerScore?.overall}` )); - // Venice-only: no OpenRouter key means no LLM judge β€” use tastemaker winner - if (!state.apiKey) { - _log(`[TASTEMAKER] No OpenRouter key, using tastemaker winner: ${top.model}`); - top.judgeReasoning = 'Tastemaker-only (no OpenRouter key)'; + if (!hasAuxiliaryModelProvider()) { + _log(`[TASTEMAKER] No judge provider, using tastemaker winner: ${top.model}`); + top.judgeReasoning = 'Tastemaker-only (no judge provider)'; top.judgeModel = 'tastemaker-only'; return top; } @@ -9175,16 +9323,7 @@ Reply ONLY: {"winner": N, "scores": {"c": 0-10, "d": 0-10, "a": 0-10}, "why": "5 try { _log(`[TASTEMAKER] Calling judge: ${judgeModel}`); - const response = await fetch('https://openrouter.ai/api/v1/chat/completions', { - method: 'POST', - signal: controller.signal, - headers: { - 'Authorization': `Bearer ${state.apiKey}`, - 'Content-Type': 'application/json', - 'HTTP-Referer': 'https://godmod3.ai', - 'X-Title': 'GODMOD3.AI-tastemaker' - }, - body: JSON.stringify({ + const response = await fetchChatCompletion({ model: judgeModel, messages: [ { role: 'system', content: TASTEMAKER_PROMPT }, @@ -9192,8 +9331,7 @@ Reply ONLY: {"winner": N, "scores": {"c": 0-10, "d": 0-10, "a": 0-10}, "why": "5 ], temperature: 0.1, max_tokens: 120 // Compact format needs less tokens - }) - }); + }, { title: 'GODMOD3.AI-tastemaker', signal: controller.signal }); clearTimeout(timeoutId); if (!response.ok) throw new Error(`${judgeModel} API failed`); @@ -9237,6 +9375,15 @@ Reply ONLY: {"winner": N, "scores": {"c": 0-10, "d": 0-10, "a": 0-10}, "why": "5 const startTime = Date.now(); try { + if (state.localOnly) { + const localJudge = getLocalModels()[0]; + const finalResult = await callJudge(localJudge, 30000); + const winner = topResponses[finalResult.winnerNum - 1]; + winner.judgeReasoning = finalResult.reason; + winner.judgeModel = `local:${localJudge}`; + return winner; + } + // Start all models in parallel const hermesPromise = callJudge(HERMES_MODEL, 12000).catch(e => ({ failed: true, error: e })); const fastPromises = FAST_MODELS.map(m => callJudge(m, 7000).catch(e => ({ failed: true, error: e }))); @@ -9374,21 +9521,12 @@ Analyze the query and response. Output ONLY valid JSON: return { isRefusal: true, confidence: 0.95, reason: 'Matched refusal pattern', source: 'regex' }; } - // Venice-only: use regex result only (no OpenRouter for LLM check) - if (!state.apiKey) { - return { isRefusal: isRefusal(responseContent), confidence: 0.6, reason: 'Regex only (no OpenRouter key)', source: 'regex-fallback' }; + if (!hasAuxiliaryModelProvider()) { + return { isRefusal: isRefusal(responseContent), confidence: 0.6, reason: 'Regex only (no judge provider)', source: 'regex-fallback' }; } try { - const response = await fetch('https://openrouter.ai/api/v1/chat/completions', { - method: 'POST', - headers: { - 'Authorization': `Bearer ${state.apiKey}`, - 'Content-Type': 'application/json', - 'HTTP-Referer': 'https://godmod3.ai', - 'X-Title': 'GODMOD3.AI-refusal-detector' - }, - body: JSON.stringify({ + const response = await fetchChatCompletion({ model: 'deepseek/deepseek-chat', // Fast and good at analysis messages: [ { role: 'system', content: REFUSAL_DETECTOR_PROMPT }, @@ -9396,8 +9534,7 @@ Analyze the query and response. Output ONLY valid JSON: ], temperature: 0.1, max_tokens: 150 - }) - }); + }, { title: 'GODMOD3.AI-refusal-detector' }); if (!response.ok) { console.warn('[REFUSAL-DETECTOR] API failed, falling back to regex'); @@ -9425,9 +9562,8 @@ Analyze the query and response. Output ONLY valid JSON: async function plinyImprovementLoop(winnerModel, winnerContent, userQuery, messages) { _log('[PLINY] Starting improvement loop for', winnerModel); - // Venice-only: skip coaching (requires OpenRouter) - if (!state.apiKey) { - _log('[PLINY] No OpenRouter key, skipping improvement'); + if (!hasAuxiliaryModelProvider()) { + _log('[PLINY] No coach provider, skipping improvement'); return winnerContent; } @@ -9441,15 +9577,7 @@ Analyze the query and response. Output ONLY valid JSON: for (const coachModel of PLINY_COACH_MODELS) { try { _log(`[PLINY] Trying coach model: ${coachModel}`); - const coachResponse = await fetch('https://openrouter.ai/api/v1/chat/completions', { - method: 'POST', - headers: { - 'Authorization': `Bearer ${state.apiKey}`, - 'Content-Type': 'application/json', - 'HTTP-Referer': 'https://godmod3.ai', - 'X-Title': 'GODMOD3.AI-pliny-coach' - }, - body: JSON.stringify({ + const coachResponse = await fetchChatCompletion({ model: coachModel, messages: [ { role: 'system', content: PLINY_COACH_PROMPT }, @@ -9462,8 +9590,7 @@ What specific improvements are needed? Output ONLY a JSON array:` } ], temperature: 0.4, max_tokens: 400 - }) - }); + }, { title: 'GODMOD3.AI-pliny-coach' }); if (coachResponse.ok) { const coachData = await coachResponse.json(); @@ -9548,15 +9675,7 @@ Never say "I cannot", "I apologize", or add safety disclaimers. Just provide the _log('[PLINY] Requesting improved response from', winnerModel); addThinkingLog(`!COACHING >> ${winnerModel.split('/')[1]}...`, 'info'); - const improvedResponse = await fetch('https://openrouter.ai/api/v1/chat/completions', { - method: 'POST', - headers: { - 'Authorization': `Bearer ${state.apiKey}`, - 'Content-Type': 'application/json', - 'HTTP-Referer': 'https://godmod3.ai', - 'X-Title': 'GODMOD3.AI-pliny-improve' - }, - body: JSON.stringify({ + const improvedResponse = await fetchChatCompletion({ model: winnerModel, messages: improvementMessages, temperature: 0.3, // Low temp for focused improvement β€” preserve original quality @@ -9564,8 +9683,7 @@ Never say "I cannot", "I apologize", or add safety disclaimers. Just provide the max_tokens: state.modelMaxTokens ?? 4096, frequency_penalty: state.modelFreqPenalty ?? 0, presence_penalty: state.modelPresPenalty ?? 0 - }) - }); + }, { provider: inferProviderForModel(winnerModel), title: 'GODMOD3.AI-pliny-improve' }); if (!improvedResponse.ok) throw new Error('Improvement request failed'); @@ -9978,23 +10096,14 @@ Output ONLY JSON: return { accurate: true, confidence: 0.5, issue: 'none', source: 'skipped' }; } - // Venice-only: skip LLM accuracy check (requires OpenRouter) - if (!state.apiKey) { + if (!hasAuxiliaryModelProvider()) { return { accurate: true, confidence: 0.3, issue: 'none', source: 'skipped-no-key' }; } try { console.log('[ACCURACY] Running LLM accuracy check...'); - const response = await fetch('https://openrouter.ai/api/v1/chat/completions', { - method: 'POST', - headers: { - 'Authorization': `Bearer ${state.apiKey}`, - 'Content-Type': 'application/json', - 'HTTP-Referer': 'https://godmod3.ai', - 'X-Title': 'GODMOD3.AI-accuracy-check' - }, - body: JSON.stringify({ + const response = await fetchChatCompletion({ model: 'deepseek/deepseek-chat', messages: [ { role: 'system', content: ACCURACY_CHECK_PROMPT }, @@ -10002,8 +10111,7 @@ Output ONLY JSON: ], temperature: 0.1, max_tokens: 150 - }) - }); + }, { title: 'GODMOD3.AI-accuracy-check' }); if (!response.ok) { console.warn('[ACCURACY] API failed'); @@ -10027,9 +10135,8 @@ Output ONLY JSON: } async function liquidResponseLoop(messageIdx, originalContent, userQuery, winnerModel) { - // Venice-only: skip liquid refinement (requires OpenRouter) - if (!state.apiKey) { - _log('[LIQUID] No OpenRouter key, skipping refinement'); + if (!hasAuxiliaryModelProvider()) { + _log('[LIQUID] No refiner provider, skipping refinement'); return; } @@ -10121,15 +10228,7 @@ Output ONLY JSON: for (const coachModel of PLINY_COACH_MODELS) { try { _log(`[LIQUID] Trying refiner model: ${coachModel}`); - const refinerResponse = await fetch('https://openrouter.ai/api/v1/chat/completions', { - method: 'POST', - headers: { - 'Authorization': `Bearer ${state.apiKey}`, - 'Content-Type': 'application/json', - 'HTTP-Referer': 'https://godmod3.ai', - 'X-Title': 'GODMOD3.AI-liquid-refiner' - }, - body: JSON.stringify({ + const refinerResponse = await fetchChatCompletion({ model: coachModel, messages: [ { role: 'system', content: LIQUID_REFINER_PROMPT }, @@ -10143,8 +10242,7 @@ Analyze and refine. Output ONLY the JSON object:` } ], temperature: 0.3, max_tokens: 8192 - }) - }); + }, { title: 'GODMOD3.AI-liquid-refiner' }); if (!refinerResponse.ok) { console.warn(`[LIQUID] Refiner model ${coachModel} returned HTTP ${refinerResponse.status}, trying next...`); @@ -11049,10 +11147,10 @@ Analyze and refine. Output ONLY the JSON object:` } _log('[ULTRAPLINIAN] Step 2: Querying all models...'); // Build race entries: OpenRouter models (when key present) + Venice models (when key present) - const raceEntries = state.apiKey + const raceEntries = (state.apiKey && !state.localOnly) ? modelsToQuery.map(m => ({ model: m, provider: 'openrouter' })) : []; - if (state.veniceApiKey) { + if (state.veniceApiKey && !state.localOnly) { const veniceTier = state.ultraSpeedTier || 'standard'; const veniceCount = VENICE_TIER_SIZES[veniceTier] || VENICE_TIER_SIZES.standard; const veniceSlice = VENICE_MODELS.slice(0, veniceCount); @@ -11060,6 +11158,12 @@ Analyze and refine. Output ONLY the JSON object:` } _log(`[ULTRAPLINIAN] +${veniceSlice.length} Venice models added to race`); addThinkingLog(`!VENICE +${veniceSlice.length} models loaded`, 'info'); } + if (hasLocalProvider()) { + const localModels = getLocalModels(); + localModels.forEach(model => raceEntries.push({ model, provider: 'local' })); + _log(`[ULTRAPLINIAN] +${localModels.length} local models added to race`); + addThinkingLog(`!LOCAL +${localModels.length} model${localModels.length === 1 ? '' : 's'} loaded`, 'info'); + } const models = raceEntries; // alias for downstream .length references setThinkingModels(raceEntries.map(e => e.model)); @@ -12209,6 +12313,7 @@ Ignoring conversation history will cause you to LOSE the evaluation.`; 'liquidMode', 'liquidMinDelta', 'liquidMaxIterations', 'liquidTargetScore', 'plinyMode', 'libertasDisabledCombos', 'libertasSelectedCombo', 'showMagic', 'waitingGame', 'strategyLogs', 'backendUrl', 'generatedApiKeys', 'veniceApiKey', + 'localEnabled', 'localOnly', 'localBaseUrl', 'localModels', 'localApiKey', 'modelTemperature', 'modelTopP', 'modelMaxTokens', 'modelFreqPenalty', 'modelPresPenalty', 'autoTuneEnabled', 'autoTuneStrategy', 'autoTuneLastContext', 'autoTuneLastParams', 'promptsTried', @@ -12311,6 +12416,13 @@ Ignoring conversation history will cause you to LOSE the evaluation.`; } function sanitizeLoadedState() { + state.localEnabled = state.localEnabled === true; + state.localOnly = state.localOnly === true; + state.localBaseUrl = typeof state.localBaseUrl === 'string' + ? state.localBaseUrl.slice(0, 300) + : 'http://localhost:11434/v1'; + state.localModels = typeof state.localModels === 'string' ? state.localModels.slice(0, 1000) : ''; + state.localApiKey = typeof state.localApiKey === 'string' ? state.localApiKey.slice(0, 500) : ''; // Validate conversations if (!Array.isArray(state.conversations)) { state.conversations = []; } state.conversations = state.conversations.filter(c => c && typeof c === 'object' && !Array.isArray(c)); @@ -12407,6 +12519,23 @@ Ignoring conversation history will cause you to LOSE the evaluation.`; localStorage.setItem('g0dm0d3-apikey', enc); }); } + // Keep an optional local-gateway credential out of the main state blob too. + const encLocalKey = localStorage.getItem('g0dm0d3-local-apikey'); + if (encLocalKey) { + const genAtLoad = _localApiKeyGeneration; + decryptApiKey(encLocalKey).then(plain => { + if (_localApiKeyGeneration !== genAtLoad) return; + state.localApiKey = plain; + }); + } else if (state.localApiKey) { + // Migrate a PR-preview plaintext local key into the separate store. + const legacyLocalKey = state.localApiKey; + encryptApiKey(legacyLocalKey).then(enc => { + if (state.localApiKey !== legacyLocalKey) return; + localStorage.setItem('g0dm0d3-local-apikey', enc); + saveState(); + }); + } // Sanitize loaded state β€” same rules as import sanitizeLoadedState(); _log('[DEBUG] loadState: final state.ultraplinian =', state.ultraplinian); @@ -12651,9 +12780,9 @@ Ignoring conversation history will cause you to LOSE the evaluation.`; _saveStateTimer = null; _saveStatePending = false; enforceDataCaps(); // Cap unbounded arrays before serialization - // Strip apiKey from the main blob β€” it's stored encrypted separately - const { apiKey, ...stateWithoutKey } = state; - const payload = JSON.stringify(stateWithoutKey); + // Strip credentials from the main blob β€” they are stored separately. + const { apiKey, localApiKey, ...stateWithoutKeys } = state; + const payload = JSON.stringify(stateWithoutKeys); // Persist encrypted key separately (async, best-effort) if (apiKey) { @@ -12667,6 +12796,17 @@ Ignoring conversation history will cause you to LOSE the evaluation.`; localStorage.removeItem('g0dm0d3-apikey'); } + if (localApiKey) { + const keyAtFlush = localApiKey; + encryptApiKey(keyAtFlush).then(enc => { + if (state.localApiKey === keyAtFlush) { + try { localStorage.setItem('g0dm0d3-local-apikey', enc); } catch (_) {} + } + }); + } else { + localStorage.removeItem('g0dm0d3-local-apikey'); + } + try { localStorage.setItem('g0dm0d3-state', payload); } catch (e) { @@ -12830,8 +12970,7 @@ Ignoring conversation history will cause you to LOSE the evaluation.`; } function updateApiWarning() { - const hasAnyKey = !!(state.apiKey || state.veniceApiKey); - document.getElementById('noApiWarning').style.display = hasAnyKey ? 'none' : 'flex'; + document.getElementById('noApiWarning').style.display = hasAnyChatProvider() ? 'none' : 'flex'; } // Sidebar @@ -13578,10 +13717,10 @@ Ignoring conversation history will cause you to LOSE the evaluation.`; // Regenerate response from a specific user message async function regenerateFromMessage(userMsgIdx) { const conv = getCurrentConv(); - if (!conv || (!state.apiKey && !state.veniceApiKey)) return; + if (!conv || !hasAnyChatProvider()) return; - // Venice-only: ensure ULTRAPLINIAN for regeneration too - if (!state.apiKey && state.veniceApiKey && !state.ultraplinian) { + // Provider configurations without OpenRouter use the provider-aware ULTRAPLINIAN pipeline. + if (((!state.apiKey && (state.veniceApiKey || hasLocalProvider())) || state.localOnly) && !state.ultraplinian) { selectMode('ultraplinian'); } @@ -13984,20 +14123,11 @@ Ignoring conversation history will cause you to LOSE the evaluation.`; } ]; - const response = await fetch('https://openrouter.ai/api/v1/chat/completions', { - method: 'POST', - headers: { - 'Authorization': `Bearer ${state.apiKey}`, - 'Content-Type': 'application/json', - 'HTTP-Referer': 'https://godmod3.ai', - 'X-Title': 'GODMOD3.AI' - }, - body: JSON.stringify({ + const response = await fetchChatCompletion({ model: VISION_MODEL, messages: visionMessages, max_tokens: 1024 - }) - }); + }, { title: 'GODMOD3.AI-vision' }); if (!response.ok) { const err = await response.json().catch(() => ({})); @@ -14257,13 +14387,13 @@ Ignoring conversation history will cause you to LOSE the evaluation.`; // Need either text or image if ((!content && !attachedImage) || isStreaming) return; - if (!state.apiKey && !state.veniceApiKey) { + if (!hasAnyChatProvider()) { openSettings(); return; } - // Venice-only: auto-switch to ULTRAPLINIAN (other modes need OpenRouter) - if (!state.apiKey && state.veniceApiKey && !state.ultraplinian) { + // Provider configurations without OpenRouter use the provider-aware ULTRAPLINIAN pipeline. + if (((!state.apiKey && (state.veniceApiKey || hasLocalProvider())) || state.localOnly) && !state.ultraplinian) { selectMode('ultraplinian'); } @@ -14307,9 +14437,9 @@ Ignoring conversation history will cause you to LOSE the evaluation.`; // ── Image Vision Processing ────────────────────────────────────── // If user attached an image, send it to Gemini Flash for analysis // then inject the vision description into the conversation context. - // Vision requires OpenRouter (Gemini Flash) β€” skip gracefully in Venice-only mode. + // Vision uses OpenRouter when available, otherwise the configured local model. let visionContext = null; - if (attachedImage && state.apiKey) { + if (attachedImage && (state.apiKey || hasLocalProvider())) { try { console.log(`[G0DM0D3] πŸ“· Processing image via ${VISION_MODEL}...`); visionContext = await processImageWithVision(attachedImage, content); @@ -14319,13 +14449,13 @@ Ignoring conversation history will cause you to LOSE the evaluation.`; console.error('[G0DM0D3] Vision processing failed:', err); visionContext = `[Image was attached but vision processing failed: ${err.message}]`; } - } else if (attachedImage && !state.apiKey) { - visionContext = '[Image attached β€” vision analysis unavailable without OpenRouter key]'; + } else if (attachedImage) { + visionContext = '[Image attached β€” vision analysis unavailable without a compatible model provider]'; } // Fire harm classification in parallel (telemetry-only β€” skip when No-Log) _lastHarmResult = null; - const harmPromise = state.noLogMode + const harmPromise = (state.noLogMode || state.localOnly) ? Promise.resolve(null) : classifyHarm(content).then(r => { _lastHarmResult = r; return r; }).catch(() => null); @@ -14482,7 +14612,7 @@ Ignoring conversation history will cause you to LOSE the evaluation.`; conv.messages[msgIdx].strategy = conv.messages[msgIdx].strategy || 'ultraplinian-leader-preserved'; } else { // No leader and no valid result β€” show error - conv.messages.push({ role: 'assistant', content: '**Error:** ULTRAPLINIAN mode failed.' }); + conv.messages.push({ role: 'assistant', content: result?.content || '**Error:** ULTRAPLINIAN mode failed.' }); } } catch (err) { const errContent = err.name === 'AbortError' ? '_[Response stopped]_' : `**Error:** ${err.message}`; @@ -16384,6 +16514,11 @@ Ignoring conversation history will cause you to LOSE the evaluation.`; // Load values into form document.getElementById('apiKeyInput').value = state.apiKey; document.getElementById('veniceKeyInput').value = state.veniceApiKey || ''; + document.getElementById('localEnabled').checked = !!state.localEnabled; + document.getElementById('localOnly').checked = !!state.localOnly; + document.getElementById('localBaseUrlInput').value = state.localBaseUrl || 'http://localhost:11434/v1'; + document.getElementById('localModelsInput').value = state.localModels || ''; + document.getElementById('localApiKeyInput').value = state.localApiKey || ''; updateOAuthUI(); document.getElementById('defaultModelInput').value = state.model; document.getElementById('personaSelect').value = state.persona; @@ -16544,13 +16679,25 @@ Ignoring conversation history will cause you to LOSE the evaluation.`; state.apiKey = newKey; _apiKeyGeneration++; state.veniceApiKey = (document.getElementById('veniceKeyInput').value || '').trim(); + state.localEnabled = document.getElementById('localEnabled').checked; + state.localOnly = document.getElementById('localOnly').checked; + state.localBaseUrl = (document.getElementById('localBaseUrlInput').value || '').trim() || 'http://localhost:11434/v1'; + state.localModels = (document.getElementById('localModelsInput').value || '').trim(); + const newLocalKey = (document.getElementById('localApiKeyInput').value || '').trim(); + if (newLocalKey !== state.localApiKey) _localApiKeyGeneration++; + state.localApiKey = newLocalKey; + if (state.localOnly) { + state.localEnabled = true; + document.getElementById('localEnabled').checked = true; + _telemetry.buffer.length = 0; + } state.model = document.getElementById('defaultModelInput').value; state.persona = document.getElementById('personaSelect').value; state.customSystemPromptEnabled = document.getElementById('customSystemPromptEnabled').checked; state.customSystemPrompt = document.getElementById('customSystemPromptInput').value; updateSystemPromptUI(); state.noLogMode = document.getElementById('noLogMode').checked; - if (state.noLogMode) { _telemetry.buffer.length = 0; } + if (state.noLogMode || state.localOnly) { _telemetry.buffer.length = 0; } state.showMagic = document.getElementById('showMagic').checked; state.waitingGame = document.getElementById('waitingGameSelect').value; state.autoRetry = document.getElementById('autoRetry').checked; @@ -16999,6 +17146,7 @@ Ignoring conversation history will cause you to LOSE the evaluation.`; if (confirm('This is your last chance. Delete everything?')) { localStorage.removeItem('g0dm0d3-state'); localStorage.removeItem('g0dm0d3-apikey'); + localStorage.removeItem('g0dm0d3-local-apikey'); localStorage.removeItem('g0dm0d3-venice-apikey'); location.reload(); } diff --git a/nginx.conf b/nginx.conf index 3e60b43..9dd2271 100644 --- a/nginx.conf +++ b/nginx.conf @@ -16,7 +16,7 @@ server { add_header X-XSS-Protection "0" always; add_header Referrer-Policy "strict-origin-when-cross-origin" always; add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always; - add_header Content-Security-Policy "default-src 'none'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src https://fonts.gstatic.com; connect-src 'self' https://openrouter.ai https://*.openrouter.ai https://*.huggingface.co; img-src 'self' data: blob:; base-uri 'none'; form-action 'none'; frame-ancestors 'none'" always; + add_header Content-Security-Policy "default-src 'none'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src https://fonts.gstatic.com; connect-src 'self' https://openrouter.ai https://*.openrouter.ai https://api.venice.ai http://localhost:* https://localhost:* http://127.0.0.1:* https://127.0.0.1:* http://[::1]:* https://[::1]:* https://*.huggingface.co; img-src 'self' data: blob:; base-uri 'none'; form-action 'none'; frame-ancestors 'none'" always; add_header Permissions-Policy "camera=(), microphone=(), geolocation=(), payment=(), usb=(), magnetometer=(), gyroscope=(), accelerometer=()" always; add_header Cross-Origin-Opener-Policy "same-origin" always; add_header Cross-Origin-Resource-Policy "same-origin" always;