open-webui/backend/open_webui
Classic298 fcc130c9bb
fix: send stream_options.include_usage for backend-initiated chats (#27661)
Only the frontend added `stream_options: {include_usage: true}` to the completion payload, gated on the model's `usage` capability. Every backend-initiated run builds its own payload (automations, timers, subagents, channels) and omitted it, so those responses came back without token counts and never rendered the usage block, even with the capability enabled on the model.

Set it in `chat_completion` instead, the single handler all of those callers go through, and drop the two duplicate copies (the Anthropic-compat handler and the frontend). Capabilities are read from the resolved model before the custom-model fallback can rebind it, and the flag is applied after the model's `stream_response` override so a non-streaming model is unaffected.

Fixes #27653
2026-08-10 23:30:46 -06:00
..
data refac: mv backend files to /open_webui dir 2024-09-04 16:54:48 +02:00
internal perf: route native JSON columns through JSONCodec instead of stdlib json (#28396) 2026-08-10 19:39:49 -05:00
migrations refac 2026-08-10 23:22:08 -06:00
models refac 2026-08-10 20:00:43 -06:00
retrieval fix: repair two broken logging calls, one of which makes VECTOR_DB=opengauss unusable (#27838) 2026-08-10 22:19:41 -06:00
routers fix: align public_tools and public_notes sharing defaults with config (#27716) 2026-08-10 23:24:18 -06:00
socket refac 2026-08-10 23:13:10 -06:00
static refac 2026-07-27 19:39:36 -04:00
storage refac 2026-07-31 17:41:14 -04:00
tools refac 2026-08-10 20:13:03 -06:00
utils refactor: walk chat message history by map key (#28034) 2026-08-10 23:24:41 -06:00
__init__.py refac 2026-07-27 19:39:36 -04:00
alembic.ini fix: Alembic CLI commands from failing 2025-08-15 04:17:47 -04:00
config.py refac 2026-08-10 19:08:46 -06:00
constants.py refac 2026-07-27 19:39:36 -04:00
env.py fix: make the aiodns resolver opt-in and pin aiodns to 3.6.1 (#28242) 2026-08-10 19:52:29 -06:00
events.py refac 2026-08-10 23:13:10 -06:00
functions.py perf: build debug log messages lazily so disabled debug logs cost nothing (#27834) 2026-07-31 19:09:01 -05:00
main.py fix: send stream_options.include_usage for backend-initiated chats (#27661) 2026-08-10 23:30:46 -06:00
tasks.py refac 2026-07-31 17:41:14 -04:00