[GH-ISSUE #12879] Local Ollama Proxy sends Cloud model responses for non-streaming tasks with incorrect Content-Type header #55046

Closed
opened 2026-04-29 08:14:46 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @LosLockos13 on GitHub (Oct 31, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/12879

What is the issue?

Description:
When using a local Ollama instance as a proxy for Ollama Cloud models (models with the -cloud suffix like glm-4.6:cloud), the local instance returns the response from the cloud with a Content-Type: text/plain; charset=utf-8 header instead of the expected Content-Type: application/json.

This causes clients, like Open WebUI, to except with a ContentTypeError when trying to parse the valid JSON response.

Bypassing the local ollama instance and using https://ollama.com as backend does respond with correct Content-Type. So it looks like an issue in the local ollama instance when acting as proxy for cloud modles.

Steps to Reproduce:

  • Run a local Ollama instance.
  • Configure Open WebUI to use this local instance and select an cloud model like glm-4.6:cloud.
  • Trigger a background task in Open WebUI that uses a cloud model (e.g., automatic title generation, follow-up questions, or chat tagging)
  • Observe the error in the Open WebUI logs.

Expected Behavior:
The local Ollama instance, when proxying a request to the cloud, should preserve the Content-Type: application/json header from the cloud's response.

Actual Behavior:
The local Ollama instance delivers the JSON payload with a Content-Type: text/plain header.

Workaround:
A client-side workaround in Open WebUI is to ignore the Content-Type error for 200 OK responses and attempt to parse the body as JSON anyway.

Relevant log output

Oct 31 07:58:25 Host open-webui[47790]: > File "/srv/open-webui/lib/python3.11/site-packages/open_webui/routers/tasks.py", line 233, in generate_title
Oct 31 07:58:25 Host open-webui[47790]:     return await generate_chat_completion(request, form_data=payload, user=user)
Oct 31 07:58:25 Host open-webui[47790]:                  │                        │                  │             └ UserModel(id='3e9785c9-4a3f-4afb-89d2-103190d1eba2', name='xxx', email='xxx@home.net', username=None, role='admin', profile_i...
Oct 31 07:58:25 Host open-webui[47790]:                  │                        │                  └ {'model': 'glm-4.6:cloud', 'messages': [{'role': 'user', 'content': '### Task:\nGenerate a concise, 3-5 word title with an em...
Oct 31 07:58:25 Host open-webui[47790]:                  │                        └ <starlette.requests.Request object at 0x7fff31be4a50>
Oct 31 07:58:25 Host open-webui[47790]:                  └ <function generate_chat_completion at 0x7fff546ecf40>
Oct 31 07:58:25 Host open-webui[47790]:   File "/srv/open-webui/lib/python3.11/site-packages/open_webui/utils/chat.py", line 266, in generate_chat_completion
Oct 31 07:58:25 Host open-webui[47790]:     response = await generate_ollama_chat_completion(
Oct 31 07:58:25 Host open-webui[47790]:                      └ <function generate_chat_completion at 0x7fff547e2ac0>
Oct 31 07:58:25 Host open-webui[47790]:   File "/srv/open-webui/lib/python3.11/site-packages/open_webui/routers/ollama.py", line 1393, in generate_chat_completion
Oct 31 07:58:25 Host open-webui[47790]:     return await send_post_request(
Oct 31 07:58:25 Host open-webui[47790]:                  └ <function send_post_request at 0x7fff547653a0>
Oct 31 07:58:25 Host open-webui[47790]:   File "/srv/open-webui/lib/python3.11/site-packages/open_webui/routers/ollama.py", line 218, in send_post_request
Oct 31 07:58:25 Host open-webui[47790]:     raise HTTPException(
Oct 31 07:58:25 Host open-webui[47790]:           └ <class 'fastapi.exceptions.HTTPException'>
Oct 31 07:58:25 Host open-webui[47790]: fastapi.exceptions.HTTPException: 200: Ollama: 200, message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8', url='http://Host:11434/api/chat'

OS

Linux

GPU

No response

CPU

Other

Ollama version

0.12.7

Originally created by @LosLockos13 on GitHub (Oct 31, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/12879 ### What is the issue? Description: When using a local Ollama instance as a proxy for Ollama Cloud models (models with the -cloud suffix like glm-4.6:cloud), the local instance returns the response from the cloud with a Content-Type: text/plain; charset=utf-8 header instead of the expected Content-Type: application/json. This causes clients, like Open WebUI, to except with a ContentTypeError when trying to parse the valid JSON response. Bypassing the local ollama instance and using https://ollama.com as backend does respond with correct Content-Type. So it looks like an issue in the local ollama instance when acting as proxy for cloud modles. Steps to Reproduce: - Run a local Ollama instance. - Configure Open WebUI to use this local instance and select an cloud model like glm-4.6:cloud. - Trigger a background task in Open WebUI that uses a cloud model (e.g., automatic title generation, follow-up questions, or chat tagging) - Observe the error in the Open WebUI logs. Expected Behavior: The local Ollama instance, when proxying a request to the cloud, should preserve the Content-Type: application/json header from the cloud's response. Actual Behavior: The local Ollama instance delivers the JSON payload with a Content-Type: text/plain header. Workaround: A client-side workaround in Open WebUI is to ignore the Content-Type error for 200 OK responses and attempt to parse the body as JSON anyway. ### Relevant log output ```shell Oct 31 07:58:25 Host open-webui[47790]: > File "/srv/open-webui/lib/python3.11/site-packages/open_webui/routers/tasks.py", line 233, in generate_title Oct 31 07:58:25 Host open-webui[47790]: return await generate_chat_completion(request, form_data=payload, user=user) Oct 31 07:58:25 Host open-webui[47790]: │ │ │ └ UserModel(id='3e9785c9-4a3f-4afb-89d2-103190d1eba2', name='xxx', email='xxx@home.net', username=None, role='admin', profile_i... Oct 31 07:58:25 Host open-webui[47790]: │ │ └ {'model': 'glm-4.6:cloud', 'messages': [{'role': 'user', 'content': '### Task:\nGenerate a concise, 3-5 word title with an em... Oct 31 07:58:25 Host open-webui[47790]: │ └ <starlette.requests.Request object at 0x7fff31be4a50> Oct 31 07:58:25 Host open-webui[47790]: └ <function generate_chat_completion at 0x7fff546ecf40> Oct 31 07:58:25 Host open-webui[47790]: File "/srv/open-webui/lib/python3.11/site-packages/open_webui/utils/chat.py", line 266, in generate_chat_completion Oct 31 07:58:25 Host open-webui[47790]: response = await generate_ollama_chat_completion( Oct 31 07:58:25 Host open-webui[47790]: └ <function generate_chat_completion at 0x7fff547e2ac0> Oct 31 07:58:25 Host open-webui[47790]: File "/srv/open-webui/lib/python3.11/site-packages/open_webui/routers/ollama.py", line 1393, in generate_chat_completion Oct 31 07:58:25 Host open-webui[47790]: return await send_post_request( Oct 31 07:58:25 Host open-webui[47790]: └ <function send_post_request at 0x7fff547653a0> Oct 31 07:58:25 Host open-webui[47790]: File "/srv/open-webui/lib/python3.11/site-packages/open_webui/routers/ollama.py", line 218, in send_post_request Oct 31 07:58:25 Host open-webui[47790]: raise HTTPException( Oct 31 07:58:25 Host open-webui[47790]: └ <class 'fastapi.exceptions.HTTPException'> Oct 31 07:58:25 Host open-webui[47790]: fastapi.exceptions.HTTPException: 200: Ollama: 200, message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8', url='http://Host:11434/api/chat' ``` ### OS Linux ### GPU _No response_ ### CPU Other ### Ollama version 0.12.7
GiteaMirror added the bug label 2026-04-29 08:14:46 -05:00
Author
Owner

@rick-github commented on GitHub (Oct 31, 2025):

#12694

<!-- gh-comment-id:3472183691 --> @rick-github commented on GitHub (Oct 31, 2025): #12694
Author
Owner

@LosLockos13 commented on GitHub (Oct 31, 2025):

OK. I see. Thank you!

<!-- gh-comment-id:3472766873 --> @LosLockos13 commented on GitHub (Oct 31, 2025): OK. I see. Thank you!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#55046