kotaemon icon indicating copy to clipboard operation
kotaemon copied to clipboard

[BUG] 🐛 Bug Report: Incorrect Endpoint Configuration for Ollama

Open alexz37 opened this issue 2 months ago • 1 comments

Description

🐛 Bug Report: Incorrect Endpoint Configuration for Ollama

Summary

By default, Ollama exposes the following RESTful endpoints as documented:

  • http://localhost:11434/api/generate
  • http://localhost:11434/api/chat

However, I'm not sure why the documentation lists that endpoint as the REST API path.

  • http://localhost:11434/v1/

Also, it hardcodes requests to /v1/chat/completions, which does not exist in Ollama’s native API. This leads to a 404 Not Found error when attempting to POST to that path.


Here’s the relevant log output from the tool:

[GIN] 2025/10/16 - 05:22:18  404  372.804µs  127.0.0.1  POST "/v1/chat/completions"

Requests should be sent to Ollama’s actual endpoints:

  • /api/chat for chat-style interactions
  • /api/generate for single-shot completions

Verification

I manually tested the correct endpoint using PowerShell:

Invoke-WebRequest -Uri "http://localhost:11434/api/generate" `
  -Method POST `
  -Body '{"model": "llama3.2", "prompt": "Why is the sky blue?"}' `
  -Headers @{ "Content-Type" = "application/json" }

Response

StatusCode        : 200
StatusDescription : OK
Content           : {123, 34, 109, 111...}
RawContent        : HTTP/1.1 200 OK
                    Transfer-Encoding: chunked
                    Content-Type: application/x-ndjson
                    Date: Thu, 16 Oct 2025 05:03:18 GMT

                    {"model":"llama3.2","created_at":"2025-10-16T05:03:18.6668943Z","response":"The"...
Content-Type      : application/x-ndjson
RawContentLength  : 28027

Pls let me know if there are any additional steps needed.Thanks

Reproduction steps

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

Screenshots

![DESCRIPTION](LINK.png)

Logs


Browsers

No response

OS

No response

Additional information

No response

alexz37 avatar Oct 16 '25 05:10 alexz37

Hi! Kotaemon uses an OpenAI-compatible API for Ollama, which is still available on the latest Ollama release (0.12.6). You should be able to use it as shown here.

If you are running Kotaemon using Docker, you are probably getting the 404 error because you are trying to connect Kotaemon to your local Ollama installation without exposing your local network to the docker container (which by default is isolated from your local network).

If you are using a local installation of Kotaemon, then maybe you haven't configured the default LLM and embedding model.

Try to follow the steps specified in https://github.com/Cinnamon/kotaemon/issues/787 and see if you can make it work.

thomasmarchioro3 avatar Oct 17 '25 10:10 thomasmarchioro3