From a939ba1f9b6864c3b7b5eb788dc4d606dee6733f Mon Sep 17 00:00:00 2001 From: dongsheng123132 <90887123+dongsheng123132@users.noreply.github.com> Date: Wed, 11 Mar 2026 00:48:21 +0800 Subject: [PATCH] feat: add custom/relay model option for API proxy platforms Supports OpenRouter, API2D, New API, One API and other relay services --- portable/Config.html | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/portable/Config.html b/portable/Config.html index 071552c..5c28e30 100644 --- a/portable/Config.html +++ b/portable/Config.html @@ -209,6 +209,10 @@ pre.config-raw { background: #111; padding: 14px; border-radius: 6px; font-size:
本地运行,完全免费
+兼容 OpenAI 格式的任意平台(OpenRouter、API2D、New API、One API 等中转站)
+ollama run llama3.2',
showBaseUrl: true, showModelName: true, noKey: true
+ },
+ custom: {
+ provider: 'custom', name: '',
+ baseUrl: '',
+ label: 'API Key',
+ hint: '填写你的中转站/代理平台提供的 API Key。常见平台:OpenRouter、API2D、New API、One API 等',
+ showBaseUrl: true, showModelName: true, customMode: true
}
};
@@ -768,6 +779,18 @@ function selectModel(key) {
} else {
document.getElementById('apiKeyGroup').style.display = 'block';
}
+
+ // Custom mode: clear fields, show all, update hints
+ if (m.customMode) {
+ document.getElementById('baseUrl').value = '';
+ document.getElementById('baseUrl').placeholder = '例: https://openrouter.ai/api/v1';
+ document.getElementById('modelName').value = '';
+ document.getElementById('modelName').placeholder = '例: gpt-4o 或 deepseek-chat';
+ document.getElementById('modelNameHint').innerHTML = '填写中转站支持的模型名称,具体看平台文档';
+ } else {
+ document.getElementById('baseUrl').placeholder = 'https://api.deepseek.com/v1';
+ document.getElementById('modelNameHint').innerHTML = '默认已填好,高级用户可修改';
+ }
}
// ====== Save model ======