6 views
-/https://github.com/berriai/litellm/issues/25567
GitHub · issue

#25567 [Bug]: Ollama get_model_info constructs redundant path .../api/chat/api/show, causing 404s on remote instances

  • State: open
  • Author: @RolandSchneider
  • Labels: bug, llm translation, SDK

### Check for existing issues

- [x] I have searched the existing issues and checked that my issue is not a duplicate.

### What happened?

#### Description

In litellm/llms/ollama/completion/transformation.py, the get_model_info method incorrectly uses a "polluted" api_base that already contains a provider suffix (like /api/chat), resulting in malformed URLs like: http://<IP>:11434/api/chat/api/show

This causes 404 errors for background tasks like cost calculation or capability checking, especially when Ollama is running on a remote host.

#### Proposed Fix The issue is in ```litellm/llms/ollama/completion/transformation.py``` within the get_model_info method. The api_base can be sanitized with the following logic:

```python # Strip existing provider suffixes from api_base before appending /api/show sanitized_base = api_base.rstrip("/") for suffix in ["/api/chat", "/api/generate"]: if sanitized_base.endswith(suffix): sanitized_base = sanitized_base[:-len(suffix)] url = f"{sanitized_base}/api/show" ```

### Steps to Reproduce

1. Configure LiteLLM to use a remote Ollama instance via OLLAMA_API_BASE. 2. Use the ollama_chat/ provider. 3. Trigger a completion. 4. Observe…

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (2 events)
#0 of 0 · 31d19h17m48s ago — entered · #import:https:::github.com:berriai:litellm post #1883
The right issue is substantially harder: it spans proxy read/write paths, routing-key translation, persistence semantics, compatibility with existing team data, and regression coverage across multiple API flows. The left issue is a localized URL-normalization fix with limited surface area and straightforward testing.
#0 of 0 · 31d19h15m4s ago — current · #import:https:::github.com:berriai:litellm post #1931
The left issue is harder because it spans proxy-boundary request construction, metadata preservation semantics, and cascade regression coverage. The right issue is a localized URL-normalization change with a narrow test surface.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search