OpenViking icon indicating copy to clipboard operation
OpenViking copied to clipboard

[Bug] embedding.provider "ollama" fails with 404 against local ollama server — litellm provider form works

Open pperezrubio opened this issue 3 months ago • 5 comments

[Bug] embedding.provider: "ollama" fails with 404 against local ollama server

Version: v0.4.16 (uv tool install, macOS arm64, Python 3.14)

Summary

Configuring the dense embedding provider with the documented ollama provider produces a probe failure — LiteLLM builds a request path that ollama answers with 404 page not found. Switching the same ollama server to the litellm provider form (model: "ollama/nomic-embed-text") works immediately.

Repro

~/.openviking/ov.conf:

{
  "embedding": {
    "dense": {
      "provider": "ollama",
      "api_base": "http://127.0.0.1:11434",
      "model": "nomic-embed-text",
      "dimension": 768
    }
  }
}
$ openviking-server doctor
  Embedding:      FAIL  ollama/nomic-embed-text api_base=http://127.0.0.1:11434
                  dimension=768 (probe failed: OpenAI API error: 404 page not found)

The server itself is fine — both native and OpenAI-compat endpoints answer:

$ curl -s http://127.0.0.1:11434/v1/embeddings -d '{"model":"nomic-embed-text","input":"probe"}'
{"object":"list","data":[{"embedding":[...]}]}        # works
$ curl -s http://127.0.0.1:11434/api/embed -d '{"model":"nomic-embed-text","input":"probe"}'
{"embeddings":[[...]]}                                 # works

Workaround

{
  "embedding": {
    "dense": {
      "provider": "litellm",
      "api_key": "ollama",
      "api_base": "http://127.0.0.1:11434",
      "model": "ollama/nomic-embed-text",
      "dimension": 768
    }
  }
}

doctor then reports probe ok (dimension=768) against the same server.

Expectation

Either the ollama embedding provider should route to the same litellm path that the workaround uses, or the config docs should state that local ollama embeddings require the litellm provider form.

pperezrubio avatar Aug 24 '26 21:08 pperezrubio

Hi, thanks for the report.

provider: "ollama" currently uses the OpenAI-compatible embedding endpoint, so api_base needs to include /v1:

{
  "embedding": {
    "dense": {
      "provider": "ollama",
      "api_base": "http://127.0.0.1:11434/v1",
      "model": "nomic-embed-text",
      "dimension": 768
    }
  }
}

You can also omit api_base, in which case OpenViking defaults to http://localhost:11434/v1.

The 404 happens because http://127.0.0.1:11434 makes the OpenAI SDK call /embeddings, while Ollama exposes the compatible endpoint at /v1/embeddings.

sponge225 avatar Aug 25 '26 04:08 sponge225

The /v1 requirement explains the immediate cause, but this is a recurring configuration trap rather than an isolated documentation question. We have seen the same broader class of api_base mistakes elsewhere in this repository: a missing provider path here, a duplicated provider path in #4132, and confusion between base_url and api_base in #1382. The resulting errors are usually opaque 404s or startup failures.

Documentation can show the correct examples, but it cannot validate or normalize a manually entered URL. A small, bounded change would prevent this case without altering explicit proxy configurations: for provider: "ollama", map only an empty or / URL path to /v1, and leave every non-root path unchanged. I have this patch ready locally with regression coverage for a bare host, a trailing slash, an existing /v1, and a custom path. Would you be open to this compatibility improvement?

ranxi2001 avatar Aug 25 '26 06:08 ranxi2001

Thanks — confirmed, adding /v1 to api_base fixes it. It might be worth updating the config docs or adding a validation hint, since the error message (404 Not Found) doesn't point to the missing suffix. Closing from our side.

pperezrubio avatar Sep 02 '26 13:09 pperezrubio

For anyone landing here and switching to the litellm provider form as a workaround: worth checking your model is symmetric before you settle on it.

The ollama branch builds an OpenAIDenseEmbedder, and neither branch prepends an instruction to query text. With qwen3-embedding that is a silent ranking loss — the probe passes, requests return 200, only relevance degrades. Measured here: 0/4 queries ranked correctly without the prefix, 4/4 with it.

#5485 adds a query_instruction field covering the openai, azure and ollama branches.

theomgdev avatar Sep 30 '26 01:09 theomgdev

Thanks for confirming that adding /v1 fixed the 404. With provider: "ollama", OpenViking uses Ollama's OpenAI-compatible embedding endpoint, so the explicit base URL should be http://127.0.0.1:11434/v1. Omitting api_base also uses the default http://localhost:11434/v1.

Closing the reported connection issue as resolved by the configuration correction.

qin-ctx avatar Oct 12 '26 09:10 qin-ctx