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

#26170 [Bug] Ollama provider checks `litellm.api_base` global before explicit `api_base` kwarg (inconsistent with openai provider)

  • State: open
  • Author: @aydenious
  • Labels: llm translation

## Description

In `litellm/main.py`, the three Ollama-related provider blocks resolve `api_base` with the **global `litellm.api_base` before the explicit `api_base` kwarg**, while the openai provider (and every other major provider) resolve in the opposite order. This causes the explicit kwarg passed to `litellm.completion(...)` or `litellm.embedding(...)` to be silently overridden when `litellm.api_base` has been set by unrelated code earlier in the process.

## Affected code (current `litellm_internal_staging`)

- `litellm/main.py:3970` — ollama completion path - `litellm/main.py:3999` — ollama_chat completion path - `litellm/main.py:5318` — ollama embedding path

All three currently read:

```python api_base = ( litellm.api_base # global FIRST ← bug or api_base # explicit kwarg SECOND or get_secret("OLLAMA_API_BASE") or "http://localhost:11434" ) ```

Compare with the openai provider at `litellm/main.py:2038` and other occurrences — they all resolve kwarg first:

```python api_base = ( api_base # kwarg FIRST or litellm.api_base or get_secret("OPENAI_BASE_URL") or get_secret("OPENAI_API_BASE") or "…

GitHub resolver

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

Refresh page
vote history (7 events)
#0 of 0 · 31d19h11m33s ago — entered · #import:https:::github.com:berriai:litellm post #1676
Issue 28585 is harder because it spans dashboard request behavior, pagination control flow, API-limit compatibility, and regression coverage; issue 26170 is a localized precedence correction across three provider paths with comparatively contained testing.
Requires cross-layer investigation, authorization/error-contract decisions, and broader regression coverage; the other is a localized consistency fix with limited testing scope.
The left issue is harder because it requires extending cross-provider request translation for multimodal content, preserving semantics across differing schemas, and adding coverage for multiple lowering paths. The right issue is a localized precedence correction across a few provider branches with comparatively straightforward regression tests.
Bedrock handling requires tracing request construction and conditional tool state across provider-specific paths, with compatibility and regression testing; the Ollama change is a localized precedence fix with limited validation scope.
The left issue is harder because it likely requires coordinating dashboard behavior, backend mutations, schema compatibility, and deployment or migration handling. The right issue is comparatively localized, with a small set of consistent precedence corrections and focused regression tests.
The left requires diagnosing cross-process lifecycle behavior in containerized deployments, identifying the responsible subprocess/signal/reaping path, and validating the fix across runtime and Docker scenarios. The right is a localized precedence correction across a few provider branches with straightforward regression tests, so the left has substantially greater investigation risk and scope.
#0 of 0 · 31d18h14m17s ago — current · #import:https:::github.com:berriai:litellm post #2603
Redis connection setup requires careful compatibility handling across configuration forms and transport behavior, while the Ollama fix is a localized precedence correction repeated in three call paths with straightforward regression coverage.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search