<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to configure LibreChat to discuss with secured self hosted Ollama?]]></title><description><![CDATA[<p dir="auto">Hi<br />
I've installed LibreChat and Ollama on Cloudron and I've followed the checklists for each app.<br />
LibreChat discusses with Mistral without trouble using my API Key.<br />
However I can't make it work with my own instance of Ollama and I don't know what I'm doing wrong.<br />
I get this error from LibreChat</p>
<pre><code>Something went wrong. Here's the specific error message we encountered:

An error occurred while processing the request: 
&lt;html&gt; &lt;head&gt;&lt;title&gt;401 Authorization Required&lt;/title&gt;&lt;/head&gt; &lt;body&gt; &lt;center&gt;&lt;h1&gt;401 Authorization Required&lt;/h1&gt;&lt;/center&gt; &lt;hr&gt;&lt;center&gt;nginx/1.24.0 (Ubuntu)&lt;/center&gt; &lt;/body&gt; &lt;/html&gt;
</code></pre>
<p dir="auto">I guess a Bearer is missing, but even if I add it to librechat.yaml configuration, the problem remains.</p>
<p dir="auto">Any shared experience/example would help, I found the documentation very light about this issue, and the examples I see on how ton configure LibreChat for Ollama in other contexts show various base URLs for Ollama and sometimes use 'ollama' as api key, sometimes provide a Bearer token.</p>
<p dir="auto">My librechat.yaml config:</p>
<pre><code>version: 1.2.8

endpoints:
  custom:
    - name: "Ollama"
      apiKey: "ollama"
      baseURL: "https://ollama-api.&lt;REDACTED&gt;/v1"
      models:
        default:
          - "llama3:latest"
          - "mistral"
          - "gemma:7b"
          - "phi3:mini"
        fetch: false
      headers:
        Authorization: 'Bearer ${OLLAMA_BEARER_TOKEN}'
      titleConvo: true
      titleModel: "current_model"
      summarize: false
      summaryModel: "current_model"
      forcePrompt: false
      modelDisplayLabel: "Ollama"
</code></pre>
<p dir="auto">Does it look correct? the <code>OLLAMA_BEARER_TOKEN</code> is defined in the .env file.</p>
<p dir="auto">Thanks in advance</p>
]]></description><link>https://forum.cloudron.io/topic/14484/how-to-configure-librechat-to-discuss-with-secured-self-hosted-ollama</link><generator>RSS for Node</generator><lastBuildDate>Wed, 11 Nov 2026 09:50:17 GMT</lastBuildDate><atom:link href="https://forum.cloudron.io/topic/14484.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 30 Oct 2025 09:18:44 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to configure LibreChat to discuss with secured self hosted Ollama? on Thu, 30 Oct 2025 22:10:46 GMT]]></title><description><![CDATA[<p dir="auto">That's working too for me by changing the name <img src="https://forum.cloudron.io/assets/plugins/nodebb-plugin-emoji/emoji/android/1f60c.png?v=15ba4f11b43" class="not-responsive emoji emoji-android emoji--relieved" style="height:1.4em;width:auto;vertical-align:middle" title="😌" alt="😌" /> ! Thanks <a class="plugin-mentions-user plugin-mentions-a" href="/user/james" aria-label="Profile: james">@<bdi>james</bdi></a></p>
]]></description><link>https://forum.cloudron.io/post/114645</link><guid isPermaLink="true">https://forum.cloudron.io/post/114645</guid><dc:creator><![CDATA[SansGuidon]]></dc:creator><pubDate>Thu, 30 Oct 2025 22:10:46 GMT</pubDate></item><item><title><![CDATA[Reply to How to configure LibreChat to discuss with secured self hosted Ollama? on Thu, 30 Oct 2025 18:17:14 GMT]]></title><description><![CDATA[<p dir="auto">There was just a comment.</p>
<blockquote>
<p dir="auto">Thanks, this is specific to Ollama as it still uses some legacy code where headers are not expected.</p>
<p dir="auto">You can already work around it by changing the custom endpoint name from "ollama" to something else, but I'm pushing a simple fix.</p>
</blockquote>
<p dir="auto">Tested this, config:</p>
<pre><code>version: 1.2.8

endpoints:
  custom:
    - name: "CloudronOllama"
      apiKey: "ollama"
      baseURL: "https://ollama-api.cloudron.dev/v1/"
      models:
        default: ["tinyllama:latest"]
        fetch: true
      titleConvo: true
      titleModel: "current_model"
      summarize: false
      summaryModel: "current_model"
      forcePrompt: false
      modelDisplayLabel: "Ollama"
      headers:
        Content-Type: "application/json"
        Authorization: "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhZG1pbiIsImlhdCI6MTc2MTgxNjM1OSwiZXhwIjoxNzYxODE5OTU5fQ.YLZtAuIjqnApthTBfuoPyyyJ5a7N2wywn2GW9dTqUeU"
</code></pre>
<p dir="auto">And indeed, this worked! But <code>danny-avila</code> already created a PR to fix this issue.<br />
So, to get it working right now, just change <code>- name: "Ollama"</code> to e.g. <code>- name: "CloudronOllama"</code></p>
<p dir="auto"><img src="/assets/uploads/files/1761848231499-39d2622a-3eb9-45d8-ab56-96a8a0cfe9d6-image-resized.png" alt="39d2622a-3eb9-45d8-ab56-96a8a0cfe9d6-image.png" class="img-markdown  img-fluid" width="1703" height="372" /></p>
]]></description><link>https://forum.cloudron.io/post/114639</link><guid isPermaLink="true">https://forum.cloudron.io/post/114639</guid><dc:creator><![CDATA[james]]></dc:creator><pubDate>Thu, 30 Oct 2025 18:17:14 GMT</pubDate></item><item><title><![CDATA[Reply to How to configure LibreChat to discuss with secured self hosted Ollama? on Thu, 30 Oct 2025 15:51:53 GMT]]></title><description><![CDATA[<p dir="auto">Just to keep everyone updated, the github issue in question is <a href="https://github.com/danny-avila/LibreChat/issues/10311" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/danny-avila/LibreChat/issues/10311</a></p>
]]></description><link>https://forum.cloudron.io/post/114633</link><guid isPermaLink="true">https://forum.cloudron.io/post/114633</guid><dc:creator><![CDATA[nebulon]]></dc:creator><pubDate>Thu, 30 Oct 2025 15:51:53 GMT</pubDate></item><item><title><![CDATA[Reply to How to configure LibreChat to discuss with secured self hosted Ollama? on Thu, 30 Oct 2025 14:57:47 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/sansguidon" aria-label="Profile: SansGuidon">@<bdi>SansGuidon</bdi></a><br />
Yes, that is what we assume now as well.<br />
We have created a bug report on GitHub for this.</p>
]]></description><link>https://forum.cloudron.io/post/114623</link><guid isPermaLink="true">https://forum.cloudron.io/post/114623</guid><dc:creator><![CDATA[james]]></dc:creator><pubDate>Thu, 30 Oct 2025 14:57:47 GMT</pubDate></item><item><title><![CDATA[Reply to How to configure LibreChat to discuss with secured self hosted Ollama? on Thu, 30 Oct 2025 14:26:13 GMT]]></title><description><![CDATA[<p dir="auto">Thanks <a class="plugin-mentions-user plugin-mentions-a" href="/user/james" aria-label="Profile: james">@<bdi>james</bdi></a> for confirming my suspicion. But Ollama is accepting the Header so I guess the problem is on LibreChat, right?</p>
]]></description><link>https://forum.cloudron.io/post/114622</link><guid isPermaLink="true">https://forum.cloudron.io/post/114622</guid><dc:creator><![CDATA[SansGuidon]]></dc:creator><pubDate>Thu, 30 Oct 2025 14:26:13 GMT</pubDate></item><item><title><![CDATA[Reply to How to configure LibreChat to discuss with secured self hosted Ollama? on Thu, 30 Oct 2025 13:58:11 GMT]]></title><description><![CDATA[<p dir="auto">I was able to capture the headers that are send to Ollama.</p>
<pre><code>// request made when re-trying the prompt ⚠️the auth bearer header is missing
POST /mirror HTTP/1.1
X-Original-URI: /api/chat
Host: 127.0.0.1:6677
Connection: close
Content-Length: 114
Content-Type: application/json
Accept: application/json
User-Agent: ollama-js/0.5.14 (x64 linux Node.js/v22.14.0)
accept-language: *
sec-fetch-mode: cors
accept-encoding: br, gzip, deflate

// manual curl reuqest - header is there
GET /mirror HTTP/1.1
X-Original-URI: /v1/models
Host: 127.0.0.1:6677
Connection: close
user-agent: curl/8.5.0
accept: */*
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhZG1pbiIsImlhdCI6MTc2MTgxNjM1OSwiZXhwIjoxNzYxODE5OTU5fQ.YLZtAuIjqnApthTBfuoPyyyJ5a7N2wywn2GW9dTqUeU
</code></pre>
<p dir="auto">So for some reason the header is not send.</p>
]]></description><link>https://forum.cloudron.io/post/114619</link><guid isPermaLink="true">https://forum.cloudron.io/post/114619</guid><dc:creator><![CDATA[james]]></dc:creator><pubDate>Thu, 30 Oct 2025 13:58:11 GMT</pubDate></item><item><title><![CDATA[Reply to How to configure LibreChat to discuss with secured self hosted Ollama? on Thu, 30 Oct 2025 10:59:31 GMT]]></title><description><![CDATA[<p dir="auto">Thanks <a class="plugin-mentions-user plugin-mentions-a" href="/user/james" aria-label="Profile: james">@<bdi>james</bdi></a></p>
]]></description><link>https://forum.cloudron.io/post/114607</link><guid isPermaLink="true">https://forum.cloudron.io/post/114607</guid><dc:creator><![CDATA[SansGuidon]]></dc:creator><pubDate>Thu, 30 Oct 2025 10:59:31 GMT</pubDate></item><item><title><![CDATA[Reply to How to configure LibreChat to discuss with secured self hosted Ollama? on Thu, 30 Oct 2025 10:24:40 GMT]]></title><description><![CDATA[<p dir="auto">The LibreChat logs state on restart:</p>
<pre><code>Oct 30 11:23:19 2025-10-30 10:23:19 error: [indexSync] error fetch failed
</code></pre>
<p dir="auto">But in the Ollama logs for this timestamp I can see no request.<br />
But when trying to send a prompt, I get a request:</p>
<pre><code>Oct 30 11:24:15 172.18.0.1 - - [30/Oct/2025:10:24:15 +0000] "GET /api/tags HTTP/1.1" 401 188 "-" "axios/1.12.1"
Oct 30 11:24:17 172.18.0.1 - - [30/Oct/2025:10:24:17 +0000] "POST /api/chat HTTP/1.1" 401 188 "-" "ollama-js/0.5.14 (x64 linux Node.js/v22.14.0)"
</code></pre>
<p dir="auto">So, something is astray here.</p>
]]></description><link>https://forum.cloudron.io/post/114606</link><guid isPermaLink="true">https://forum.cloudron.io/post/114606</guid><dc:creator><![CDATA[james]]></dc:creator><pubDate>Thu, 30 Oct 2025 10:24:40 GMT</pubDate></item><item><title><![CDATA[Reply to How to configure LibreChat to discuss with secured self hosted Ollama? on Thu, 30 Oct 2025 10:14:36 GMT]]></title><description><![CDATA[<p dir="auto">Oh, wait no. Missing the <code>apiKey</code> config it defaulted back to my configured GPT.<br />
Sorry, I will look into it.</p>
]]></description><link>https://forum.cloudron.io/post/114605</link><guid isPermaLink="true">https://forum.cloudron.io/post/114605</guid><dc:creator><![CDATA[james]]></dc:creator><pubDate>Thu, 30 Oct 2025 10:14:36 GMT</pubDate></item><item><title><![CDATA[Reply to How to configure LibreChat to discuss with secured self hosted Ollama? on Thu, 30 Oct 2025 10:13:22 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/sansguidon" aria-label="Profile: SansGuidon">@<bdi>SansGuidon</bdi></a></p>
<p dir="auto">Your API request returned <code>{"object":"list","data":null}</code> which indicated no models found.</p>
<p dir="auto">For testing, in the web terminal of the Ollama app I send this command:</p>
<pre><code class="language-bash">ollama run tinyllama
</code></pre>
<p dir="auto">After that is done, now I get:</p>
<pre><code>curl https://ollama-api.cloudron.dev/v1/models -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhZG1pbiIsImlhdCI6MTc2MTgxNjM1OSwiZXhwIjoxNzYxODE5OTU5fQ.YLZtAuIjqnApthTBfuoPyyyJ5a7N2wywn2GW9dTqUeU"
{"object":"list","data":[{"id":"tinyllama:latest","object":"model","created":1761817528,"owned_by":"library"}]}
</code></pre>
<p dir="auto">After reproducing your setup I also get the HTTP error 401.<br />
I suspect that the <code>apiKey:</code> config is wrong since we use bearer auth.<br />
And yes, that was it.</p>
<p dir="auto">Here is my working config for LibreChat:</p>
<pre><code class="language-yaml">version: 1.2.8

endpoints:
  custom:
    - name: "Ollama"
      baseURL: "https://ollama-api.cloudron.dev/v1/" 
      models:
        default: [
          "tinyllama:latest"
          ]
        fetch: true
      titleConvo: true
      titleModel: "current_model"
      summarize: false
      summaryModel: "current_model"
      forcePrompt: false
      modelDisplayLabel: "Ollama"
      headers:
        Authorization: "Bearer ${OLLAMA_BEARER_TOKEN}"
</code></pre>
<p dir="auto">Always happy to help.</p>
]]></description><link>https://forum.cloudron.io/post/114604</link><guid isPermaLink="true">https://forum.cloudron.io/post/114604</guid><dc:creator><![CDATA[james]]></dc:creator><pubDate>Thu, 30 Oct 2025 10:13:22 GMT</pubDate></item><item><title><![CDATA[Reply to How to configure LibreChat to discuss with secured self hosted Ollama? on Thu, 30 Oct 2025 09:30:23 GMT]]></title><description><![CDATA[<p dir="auto">correct. I also tested that I can reach the Ollama api hosted on Cloudron using that same Bearer<br />
<code>curl -v https://ollama-api.&lt;REDACTED&gt;/v1/models -H "Authorization: Bearer &lt;REDACTED&gt;"</code><br />
it does not return anything more than <code>{"object":"list","data":null}</code> useful but at least it's a 200 and a good enough test for me.</p>
]]></description><link>https://forum.cloudron.io/post/114601</link><guid isPermaLink="true">https://forum.cloudron.io/post/114601</guid><dc:creator><![CDATA[SansGuidon]]></dc:creator><pubDate>Thu, 30 Oct 2025 09:30:23 GMT</pubDate></item><item><title><![CDATA[Reply to How to configure LibreChat to discuss with secured self hosted Ollama? on Thu, 30 Oct 2025 09:26:21 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/sansguidon" aria-label="Profile: SansGuidon">@<bdi>SansGuidon</bdi></a></p>
<p dir="auto">I assume you took the Ollama bearer token from the <code>/app/data/.bearer_token</code> file of the Ollama app, correct?</p>
]]></description><link>https://forum.cloudron.io/post/114600</link><guid isPermaLink="true">https://forum.cloudron.io/post/114600</guid><dc:creator><![CDATA[james]]></dc:creator><pubDate>Thu, 30 Oct 2025 09:26:21 GMT</pubDate></item></channel></rss>