mirror of
https://github.com/open-webui/open-webui.git
synced 2026-03-11 00:04:08 -05:00
issue: Root-level max_tokens dropped instead of converted to num_predict (Regression from Feb 2025) #6767
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @elazar on GitHub (Oct 25, 2025).
Check Existing Issues
Installation Method
Docker
Open WebUI Version
v0.6.33 (tested) / main branch (as of Oct 25, 2025)
Ollama Version (if applicable)
v0.5.11
Operating System
Linux (Ubuntu 22.04) - should also be reproduceable on Debian 12, macOS, and Windows
Browser (if applicable)
N/A (backend bug, affects all clients)
Confirmation
README.md.Expected Behavior
When sending OpenAI-style API requests with root-level
max_tokensparameter to Open WebUI (which proxies to Ollama), themax_tokensparameter should be converted to Ollama'snum_predictparameter and properly limit the output token length.This behavior worked correctly prior to commit
fea169a9c(February 19, 2025).Actual Behavior
Root-level
max_tokensparameter is completely dropped during payload conversion, resulting in:OLLAMA_DEBUG=true): level=WARN msg="invalid option provided" option=max_tokensSteps to Reproduce
Prerequisites
Setup
curl -fsSL https://ollama.com/install.sh | shollama pull llama2Reproduce Bug
journalctl -u ollama | grep max_tokensLogs & Screenshots
Browser Console Logs
No relevant errors in browser console - this is a backend payload conversion bug that occurs during server-side request processing before any response reaches the browser.
The client receives what appears to be a successful response, but the
max_tokensparameter was dropped during Open WebUI's internal conversion to Ollama format, causing the warning in Ollama's logs.Docker Container Logs
Open WebUI: No errors (bug is in payload conversion logic)
Ollama Logs:
Code Evidence
Regression introduced in commit
fea169a9c(Feb 19, 2025)File:
backend/open_webui/utils/payload.pyRoot-level
max_tokenshandling was removedAdditional Information
Root Cause
Commit
fea169a9c(Feb 19, 2025) added nestedoptions.max_tokenssupport but removed root-level handlingImpact
max_tokensin options (non-standard)Fix
Restore root-level handling while preserving nested fix
@tjbck commented on GitHub (Oct 26, 2025):
Should be addressed in dev with
d11d49a08a