Skip to content

fix(litellm): pass api_base and enable_thinking for bool THINKING #1206

Closed

Description

@planetf1

`LiteLLMBackend` has two bugs in its `ModelOption.THINKING` handling that were discovered during live smoke testing against vLLM endpoints (Qwen3.6-27B and Gemma-4-31B-it).

First, `self._base_url` is stored in `init` but never passed as `api_base` to `litellm.acompletion()`. Any `LiteLLMBackend` constructed with a custom `base_url` silently connects to the wrong endpoint — the backend works only because `ollama_chat/` models happen to route to `localhost:11434` automatically via LiteLLM's prefix handling.

Second, when `THINKING=True` or `THINKING=False` (bool), `chat_template_kwargs.enable_thinking` is never set in `extra_body`. For vLLM-served models that require this Jinja template toggle (Qwen3, Gemma 4, GLM-4.5, and others), `THINKING=True` has no effect. Live test confirmed: Gemma-4-31B-it on vLLM produces no reasoning trace when called via LiteLLM with only `reasoning_effort="medium"` — it requires `chat_template_kwargs.enable_thinking=True` explicitly. `THINKING=False` sends `reasoning_effort=False` (an invalid value) which is silently dropped by `drop_params=True`, so thinking cannot be disabled either.

Both fixes are straightforward: pass `api_base=self._base_url` to the `litellm.acompletion()` call, and add the same `extra_body.chat_template_kwargs.enable_thinking` logic that PR #1204 introduced in `OpenAIBackend`.

Relates to #1201 (thinking model support epic). Discovered during validation work for PR #1204.

Activity

  1. added
    bug
    area/backends
    on Jun 4, 2026
  2. added a commit that references this issue on Jun 5, 2026
    1651e14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/backendsbug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions