Skip to content

[Feature]: Allow to use user set API endpoint instead of only Ollama #1722

In progress

Description

@yzc3582

What would you like Filee to do?

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.

Ideas for how it could work

Just as many agents/...
http://localhost:9931/v1

Activity

  1. added
    enhancement
    on Nov 20, 2026
  2. yzc3582 commented on Nov 21, 2026

    @yzc3582
    Author

    Note:as this left unsolved,we can use --port 11434 to disguise llama.cpp as Ollama.

  3. KnifeLemon commented on Nov 21, 2026

    @KnifeLemon
    Owner

    谢谢建议,@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。
    • 前提是那个端口上的服务能回答上面这几个 Ollama 接口。你的 llama.cpp 用 --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 /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.

  4. yzc3582 commented on Nov 22, 2026

    @yzc3582
    Author

    抱歉,我没有及时把实际测试结果反馈来。
    实际情况是:(在llama.cpp路由模式下)直接使用11434进行欺骗的话,我并没有看到他能识别出预设模型。
    也就是说,直接欺骗实际上是没有用的。
    新过渡方案(不应是最终解决方案):想办法写个兼容层转一下接口

  5. yzc3582 commented on Nov 22, 2026

    @yzc3582
    Author

    Filee的确会尝试向该端点发送请求,它会被手动设置的API key拦下来,llama.cpp会打印“API key无效”的消息。但由于我在看到该消息后立即作出了变通可用性判断,故最终使判断错误。
    对于错误的实验结果,深感抱歉。

  6. KnifeLemon commented on Nov 24, 2026

    @KnifeLemon
    Owner

    谢谢你更正测试结果,@yzc3582!

    那我上次说的就不对了:只换端口(或设置 OLLAMA_HOST)不能让 Filee 用上 llama.cpp。

    • Filee 需要服务器按 Ollama 的格式 回答 /api/tags(模型列表)、/api/show 和 /api/generate。
    • Filee 不发送 API key,所以 llama.cpp 设置了 key 时,请求会被拒绝。
    • 不设 key 时也没有认出模型,说明那边的回答和 Filee 期待的 Ollama 格式不一样。

    你说的兼容层(在本机把 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.

    • Filee needs the server to answer /api/tags (the model list), /api/show and /api/generate in 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.

  7. cre8ive-marketing commented on Dec 1, 2026

    @cre8ive-marketing
    Collaborator

    @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.
  8. KnifeLemon commented on Dec 2, 2026

    @KnifeLemon
    Owner

    @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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions