You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature]: Allow to use user set API endpoint instead of only Ollama #1722
As the title described.
Allow changes,and warn user for privacy related issues.
Why / when would you use it?
Ollama is infamous for its sha256-decyrpted filenames,and it's not as fast as native llama.cpp.
So I use llama.cpp for local AI,and end up finding nowhere to change the link(and had no idea about where's “设置→引擎”).
Really hope you can free the translator API endpoint.
Thanks for the suggestion, @yzc3582, and for sharing the workaround!
How it works today: Filee's translator talks to Ollama's API (/api/tags, /api/show, /api/generate), not to an OpenAI-compatible /v1 API. Since 2.5.0, Filee reads the OLLAMA_HOST variable, so the server doesn't have to be on port 11434 (#1364):
For example, set OLLAMA_HOST=127.0.0.1:9931 and start Filee again.
That works when the server on that port answers those Ollama endpoints. Your llama.cpp on --port 11434 works, so it answers them, and another port with OLLAMA_HOST should work too.
An OpenAI-compatible endpoint (/v1): a fair request, and I'm keeping this open for it. One thing won't change: Filee only connects to a server on this computer. An OLLAMA_HOST that points to another machine is ignored on purpose, so the documents being translated stay here. A /v1 setting would also be limited to local addresses such as localhost.
Then what I said last time was wrong: changing the port (or setting OLLAMA_HOST) doesn't let Filee use llama.cpp.
Filee needs the server to answer /api/tags (the model list), /api/show and /api/generatein Ollama's format.
Filee sends no API key, so with a key set in llama.cpp the requests are refused.
Without the key no models showed up either, so its answers aren't in the Ollama format Filee expects.
The compatibility layer you mention (on this computer, passing Ollama's endpoints on to /v1), together with OLLAMA_HOST, can work in the meantime. The request for an OpenAI-compatible endpoint (/v1) stays open, limited to local addresses as before.
@KnifeLemon I've assigned myself to this one. Here's the plan; I'll start building once you OK it.
Plan: OpenAI-compatible local server (/v1)
New setting: "AI server", Ollama (default) or OpenAI-compatible, plus the base URL.
Local only: the URL is limited to local addresses, like OllamaEndpoint today: localhost, 127.0.0.1, ::1.
OpenAI-compatible mode:TranslationService uses
GET /v1/models instead of /api/tags;
POST /v1/chat/completions (non-streaming) instead of /api/generate, with the same prompt as system + user messages.
/api/show: it has no /v1 equivalent, so the context size falls back to a fixed safe chunk size.
API key: optional. It's stored with the other secrets and sent as Authorization: Bearer only to that local URL.
Engines page: the Ollama card shows which mode is on. Manage Ollama shows only in Ollama mode.
Settings schema: new settings fields are probably one step with a default (Ollama), so nothing changes for anyone who doesn't switch. Please say if you'd rather have it differently.
Tests
Fake local server:HttpListener plays llama.cpp's /v1 answers. The checks cover the model list, a translation, a key sent only when set, and a non-local URL refused.
@cre8ive-marketing OK, go ahead. The default stays exactly today's Ollama behaviour. Nothing changes for anyone who doesn't switch.
Settings schema: no step needed. A new AppSettings property with a default (Ollama) reads as that default from an older settings.json. CurrentSchemaVersion only moves with a migration of existing values, and it also moves the gallery's settingsSchema range, so leave it.
Local only, as said above in this thread: follow the rule in OllamaEndpoint.Parse. localhost becomes the loopback address with no DNS lookup, and an IP must be loopback (0.0.0.0 / :: map to loopback). Anything else is refused and shown, never silently replaced (IgnoredValue). One difference: Parse drops the path, but a /v1 base needs its path kept (http://localhost:9931/v1).
No proxy:TranslationService builds its clients with UseProxy = false. Keep that for /v1, because a proxy would carry the text off the computer.
API key: there's no secrets store on main yet. Keep the key out of settings.json, logs, history and exports. Before you build it, propose in the PR how to store it. One option is an environment variable, like OLLAMA_HOST. Another is the OS key store. On Windows that's DPAPI, which needs the System.Security.Cryptography.ProtectedData package, a new dependency, so ask first.
Texts:error.translation_needs_engine and the Engines card talk about Ollama, so the /v1 mode needs its own wording. New strings go in all 23 i18n files.
Models:Translate.Model and PreferredOllamaModel hold Ollama names. When a preset's model isn't on the /v1 list, handle it the same way as a missing Ollama model today.
Activity
yzc3582 commentedon Nov 21, 2026
Note:as this left unsolved,we can use --port 11434 to disguise llama.cpp as Ollama.
KnifeLemon commentedon Nov 21, 2026
谢谢建议,@yzc3582,也谢谢分享变通方法!
现在是怎样的: Filee 的翻译用的是 Ollama 的接口(
/api/tags、/api/show、/api/generate),不是 OpenAI 兼容的/v1接口。从 2.5.0 起,Filee 会读取OLLAMA_HOST环境变量,所以服务不一定要在 11434 端口(#1364):OLLAMA_HOST=127.0.0.1:9931,然后重新启动 Filee。--port 11434能用,说明它回答了这些接口,那么换成其他端口加OLLAMA_HOST也应该可以。OpenAI 兼容接口(
/v1): 这是合理的请求,我保留这个 issue。有一点不会变:Filee 只连接本机上的服务。OLLAMA_HOST指向其他电脑时会被有意忽略,因为要翻译的文档应该只留在这台电脑上。所以将来支持/v1时,也只会是localhost这样的本机地址。Thanks for the suggestion, @yzc3582, and for sharing the workaround!
How it works today: Filee's translator talks to Ollama's API (
/api/tags,/api/show,/api/generate), not to an OpenAI-compatible/v1API. Since 2.5.0, Filee reads theOLLAMA_HOSTvariable, so the server doesn't have to be on port 11434 (#1364):OLLAMA_HOST=127.0.0.1:9931and start Filee again.--port 11434works, so it answers them, and another port withOLLAMA_HOSTshould work too.An OpenAI-compatible endpoint (
/v1): a fair request, and I'm keeping this open for it. One thing won't change: Filee only connects to a server on this computer. AnOLLAMA_HOSTthat points to another machine is ignored on purpose, so the documents being translated stay here. A/v1setting would also be limited to local addresses such aslocalhost.yzc3582 commentedon Nov 22, 2026
抱歉,我没有及时把实际测试结果反馈来。
实际情况是:(在llama.cpp路由模式下)直接使用11434进行欺骗的话,我并没有看到他能识别出预设模型。
也就是说,直接欺骗实际上是没有用的。
新过渡方案(不应是最终解决方案):想办法写个兼容层转一下接口
yzc3582 commentedon Nov 22, 2026
Filee的确会尝试向该端点发送请求,它会被手动设置的API key拦下来,llama.cpp会打印“API key无效”的消息。但由于我在看到该消息后立即作出了变通可用性判断,故最终使判断错误。
对于错误的实验结果,深感抱歉。
KnifeLemon commentedon Nov 24, 2026
谢谢你更正测试结果,@yzc3582!
那我上次说的就不对了:只换端口(或设置
OLLAMA_HOST)不能让 Filee 用上 llama.cpp。/api/tags(模型列表)、/api/show和/api/generate。你说的兼容层(在本机把 Ollama 的接口转到
/v1),配合OLLAMA_HOST,可以作为过渡办法。直接支持 OpenAI 兼容接口(/v1)的请求继续保留,同样只限本机地址。Thanks for correcting the test result, @yzc3582!
Then what I said last time was wrong: changing the port (or setting
OLLAMA_HOST) doesn't let Filee use llama.cpp./api/tags(the model list),/api/showand/api/generatein Ollama's format.The compatibility layer you mention (on this computer, passing Ollama's endpoints on to
/v1), together withOLLAMA_HOST, can work in the meantime. The request for an OpenAI-compatible endpoint (/v1) stays open, limited to local addresses as before.cre8ive-marketing commentedon Dec 1, 2026
@KnifeLemon I've assigned myself to this one. Here's the plan; I'll start building once you OK it.
Plan: OpenAI-compatible local server (
/v1)OllamaEndpointtoday:localhost,127.0.0.1,::1.TranslationServiceusesGET /v1/modelsinstead of/api/tags;POST /v1/chat/completions(non-streaming) instead of/api/generate, with the same prompt as system + user messages./api/show: it has no/v1equivalent, so the context size falls back to a fixed safe chunk size.Authorization: Beareronly to that local URL.Tests
HttpListenerplays llama.cpp's/v1answers. The checks cover the model list, a translation, a key sent only when set, and a non-local URL refused.KnifeLemon commentedon Dec 2, 2026
@cre8ive-marketing OK, go ahead. The default stays exactly today's Ollama behaviour. Nothing changes for anyone who doesn't switch.
AppSettingsproperty with a default (Ollama) reads as that default from an older settings.json.CurrentSchemaVersiononly moves with a migration of existing values, and it also moves the gallery'ssettingsSchemarange, so leave it.OllamaEndpoint.Parse.localhostbecomes the loopback address with no DNS lookup, and an IP must be loopback (0.0.0.0/::map to loopback). Anything else is refused and shown, never silently replaced (IgnoredValue). One difference:Parsedrops the path, but a/v1base needs its path kept (http://localhost:9931/v1).TranslationServicebuilds its clients withUseProxy = false. Keep that for/v1, because a proxy would carry the text off the computer.mainyet. Keep the key out of settings.json, logs, history and exports. Before you build it, propose in the PR how to store it. One option is an environment variable, likeOLLAMA_HOST. Another is the OS key store. On Windows that's DPAPI, which needs theSystem.Security.Cryptography.ProtectedDatapackage, a new dependency, so ask first.error.translation_needs_engineand the Engines card talk about Ollama, so the/v1mode needs its own wording. New strings go in all 23 i18n files.Translate.ModelandPreferredOllamaModelhold Ollama names. When a preset's model isn't on the/v1list, handle it the same way as a missing Ollama model today.OpenAI-compatible server: review fixes (KnifeLemon#1722)
AI server key from FILEE_AI_API_KEY: read once, sent only to the loca…