mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-07 03:18:23 -05:00
[GH-ISSUE #22579] issue: Litellm token usage stats not requested/consumed by default #19755
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 @jndao on GitHub (Mar 11, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/22579
Check Existing Issues
Installation Method
Git Clone
Open WebUI Version
v0.8.10
Ollama Version (if applicable)
No response
Operating System
Windows 11
Browser (if applicable)
No response
Confirmation
README.md.Expected Behavior
Token usage should be parsed from litellm (OpenAI compatible) requests and the metadata provided in responses.
Actual Behavior
Token usage is consistently at 0.
No usage data is consumed in the response or retrieved from LiteLLM. This feature should be provided by default by litellm if the
stream_options={"include_usage": True}.is provided in the completions request. There is no option to provide this or any other additional headers if required (could be a feature?).See also: https://docs.litellm.ai/docs/completion/usage
This may be a candidate option to be provided by default.
Steps to Reproduce
Any and all requests do not parse token usage.
Logs & Screenshots
See metadata
Additional Information
A workaround could be to forcefully enable usage metrics via litellm https://docs.litellm.ai/docs/completion/usage#proxy-always-include-streaming-usage
But it appears this setting is missing in the UI right now as of litellm v1.82.0
See: https://github.com/BerriAI/litellm/issues/23343
Workaround is to update the litellm config file and add
@Classic298 commented on GitHub (Mar 11, 2026):
Yep can confirm this issue CC @tjbck
(issue is actually that open webui doesn't parse the usage block hence token usage is always zero in analytics also)
@Ithanil commented on GitHub (Mar 11, 2026):
Always thought it was intended to have this off by default, because if "Usage" is checked in the model settings, then it does get send. I would like to have this on by default too though.
@Classic298 commented on GitHub (Mar 11, 2026):
@Ithanil not sure what you mean but if i read your comment correctly, then
admin panel > settings > models > top right settings > here you can turn on usage for ALL MODELS centrally (force enabled) for all models
@Ithanil commented on GitHub (Mar 11, 2026):
Yeah, that's only possible since recently though.
And what I mean is that
is not true, but still I think the default should be the other way around. As the OP thinks as well:
@Classic298 commented on GitHub (Mar 11, 2026):
Let me re-read this again I.. I am currently not understanding what you mean exactly
@Classic298 commented on GitHub (Mar 11, 2026):
AHA!
Shoutout to AI for translating ;)
You mean the Usage capability should be ON by default?
I discussed this with Tim at some point in the last weeks. Reasoning was to not make this breaking change because some providers don't support sending usage, and turning it on by default will break a lot of existing deployments, wheras keeping it off by default will never hurt anyone @Ithanil
@Ithanil commented on GitHub (Mar 11, 2026):
Didn't know there are providers who return errors, if you send this. OK.
@jndao commented on GitHub (Mar 11, 2026):
Yep. Additional headers can be added in the connection setting which I missed. My bad!
As configuring this relies on buried (& outdated?) litellm docs, this could be an unintentional UX failure mode. I'm not too opinionated on how this should be solved if at all.
Side note:
I did find an additional bug, where the save button gets stuck in a loading statewhen JSON formatting fails
@Ithanil commented on GitHub (Mar 11, 2026):
You do not need to add it as explicit header, but just click the "Usage" checkbox in the model settings:
@Ithanil commented on GitHub (Mar 11, 2026):
@jndao You might want to try that. ;-)
@Classic298 commented on GitHub (Mar 11, 2026):
just enable usage for all models at once, no need to configure it on litellm side (unless of course you use litellm for other things also)
@tjbck commented on GitHub (Mar 11, 2026):
Intended behaviour.