Closed ProjectMoon closed 3 months ago
Is your feature request related to a problem? Please describe. While ollama does not support authentication yet directly, many things that expose an ollama endpoint support authentication with the ollama API, and it's recommended to proxy it with an authentication header if exposed publicly. For example, Open WebUI proxies the ollama endpoint and requires a user's API key to use it.
Describe the solution you'd like Right now, the code is not setting an
Authorization
header for ollama. A new setting for the authorization header can be added. It would be best for this to just be arbitrary text, instead of an API key that hasBearer
prepended to it. So the config option would be likeOllama Authorization Header = Bearer ...
. The reasoning for this is because some people might expose ollama with different authorization header values, instead ofBearer
+ API key.Describe alternatives you've considered Some sort of odd configuration where perplexica can bypass the ollama authentication, but this is complicated and requires funny rewrite rules in a reverse proxy and isn't really scalable.
Additional context The biggest value add of this feature is using proxied ollama endpoints like Open Web UI, which can aggregate multiple ollama servers together into one transparent endpoint. In my case, I have the ollama embedding model running on a different machine than the main text generation models, in order to save on model load times.
Hi man, right now, you can make use of the custom OpenAI provider and add the Ollama URL in their along with the API key. As of now we cannot add the option for custom Ollama headers as it might be confusing to most of the people (the current implementation is confusing as well). If someone has implemented some other type of authentication system I believe they have the knowledge to simply change a simple keyword in the providers file and get it to work. But we can think of this in the future when we're done with most of the things.
Hmm, when setting the custom OpenAI base URL, I cannot enter the /v1
or https
in the settings. Is that intended behavior? :thinking:
OK I hacked this in as a new toml setting on my own fork. If you want, I can make a PR for it. But otherwise, I will just maintain it on my own version. I just added a new setting to the TOML, and then pass it as an HTTP header if present.
OK I hacked this in as a new toml setting on my own fork. If you want, I can make a PR for it. But otherwise, I will just maintain it on my own version. I just added a new setting to the TOML, and then pass it as an HTTP header if present.
Can you please post your code example. Thank you!
OK I hacked this in as a new toml setting on my own fork. If you want, I can make a PR for it. But otherwise, I will just maintain it on my own version. I just added a new setting to the TOML, and then pass it as an HTTP header if present.
Can you please post your code example. Thank you!
Needs some cleanup, but this is what I did. Some leftover unused variables and stuff. Also no UI setting.
Is your feature request related to a problem? Please describe. While ollama does not support authentication yet directly, many things that expose an ollama endpoint support authentication with the ollama API, and it's recommended to proxy it with an authentication header if exposed publicly. For example, Open WebUI proxies the ollama endpoint and requires a user's API key to use it.
Describe the solution you'd like Right now, the code is not setting an
Authorization
header for ollama. A new setting for the authorization header can be added. It would be best for this to just be arbitrary text, instead of an API key that hasBearer
prepended to it. So the config option would be likeOllama Authorization Header = Bearer ...
. The reasoning for this is because some people might expose ollama with different authorization header values, instead ofBearer
+ API key.Describe alternatives you've considered Some sort of odd configuration where perplexica can bypass the ollama authentication, but this is complicated and requires funny rewrite rules in a reverse proxy and isn't really scalable.
Additional context The biggest value add of this feature is using proxied ollama endpoints like Open Web UI, which can aggregate multiple ollama servers together into one transparent endpoint. In my case, I have the ollama embedding model running on a different machine than the main text generation models, in order to save on model load times.