mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 10:58:17 -05:00
[GH-ISSUE #23323] feat: built-in per-user and per-group token/message usage limits #35477
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 @smorello87 on GitHub (Apr 1, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/23323
Check Existing Issues
Related: #6692 (broad tracking/limit discussion), #21675 (analytics enhancements)
Problem Description
Open WebUI v0.8.0+ introduced the
chat_messagetable with per-message token usage tracking, and the analytics dashboard already aggregates usage by user and by model viaget_token_usage_by_userandget_token_usage_by_model. However, there's currently no built-in way to enforce usage limits — admins can see how many tokens each user consumed, but can't cap it.For institutions and teams deploying Open WebUI, this is a critical gap. Without built-in limits, admins must either:
The data to enforce limits is already being collected in
chat_message.usage. What's missing is the enforcement layer.Desired Solution
Add an admin-configurable usage limit system that leverages the existing
chat_messageanalytics data:Per-user limits (Admin → Users or Settings):
Per-group limits (Admin → Groups):
Admin UI:
User-facing:
Why Built-In?
The
chat_messagetable already has everything needed:get_token_usage_by_user()can check current period usageget_message_count_by_user()can check message countsA lightweight check before each model call (query current period usage, compare against limit) would be straightforward to implement and wouldn't require any external dependencies.
Alternatives Considered
A built-in solution would cover the 80% use case (simple token/message caps) without requiring external infrastructure, while users with more complex needs (cost-based billing, per-model pricing) could continue using LiteLLM or similar tools.
Additional Context
We run Open WebUI for ~500 users at CUNY (City University of New York) and this is our most-requested admin feature. We've been working around it with LiteLLM sidecar + group budget sync scripts, but a native solution would dramatically simplify our deployment.
@tjbck commented on GitHub (Apr 2, 2026):
#21675