Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.
Before submitting, make sure you've checked the following:
Target branch: Please verify that the pull request targets the dev branch.
Description: Provide a concise description of the changes made in this pull request.
Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
Documentation: Have you updated relevant documentation Open WebUI Docs, or other documentation sources?
Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
Testing: Have you written and run sufficient tests to validate the changes?
Code review: Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
Prefix: To clearly categorize this pull request, prefix the pull request title using one of the following:
BREAKING CHANGE: Significant changes that may affect compatibility
build: Changes that affect the build system or external dependencies
ci: Changes to our continuous integration processes or workflows
chore: Refactor, cleanup, or other non-functional code changes
docs: Documentation update or addition
feat: Introduces a new feature or enhancement to the codebase
fix: Bug fix or error correction
i18n: Internationalization or localization changes
perf: Performance improvement
refactor: Code restructuring for better maintainability, readability, or scalability
style: Changes that do not affect the meaning of the code (white space, formatting, missing semi-colons, etc.)
test: Adding missing tests or correcting existing tests
WIP: Work in progress, a temporary label for incomplete or ongoing work
Changelog Entry
Description
Revamped tracking and display of "usage", fixing a tracking issue, exposing only necessary information to the client (i.e. not all active user IDs) and now displaying the actual concurrent LLM usage, overall and per model, which is arguably the more more interesting metric compared to the number of users with active websockets.
Added
tracking of active chat completions count per model
exposure of these metrics via /api/usage
display of these metrics in UserMenu, both in the menu and the tooltip on hover
locale string incl. German translation
Changed
expose only active user count to the clients, not the full user list
instead of a list of session ids, a list of message ids is tracked per model
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/open-webui/open-webui/pull/15311
**Author:** [@Ithanil](https://github.com/Ithanil)
**Created:** 6/25/2025
**Status:** 🔄 Open
**Base:** `dev` ← **Head:** `usage_revamp`
---
### 📝 Commits (6)
- [`be3d6f1`](https://github.com/open-webui/open-webui/commit/be3d6f1b2aaa6e37181f7efc30c1081fe6c4d85a) directly return number of active users from backend for usage display
- [`5b1e504`](https://github.com/open-webui/open-webui/commit/5b1e50410793b6912a72418f8f693dff1ea72cce) remove unused websocket variables
- [`6f88e8d`](https://github.com/open-webui/open-webui/commit/6f88e8d46295ec28b98a34c92de6112036cc3aeb) fix usage_pool update mechanism and store running message ids instead of session ids per model in usage pool
- [`e79637b`](https://github.com/open-webui/open-webui/commit/e79637b86cced3f90869bafd0c5c054d1c9a8a69) let /api/usage return active requests per model and display the information in UserMenu
- [`5b3460c`](https://github.com/open-webui/open-webui/commit/5b3460cb60d859e4d1c36e9d7a5e01f40b139249) add/change locales
- [`d6a79a7`](https://github.com/open-webui/open-webui/commit/d6a79a7f151886379e7c30171f82267a6d5aa36f) remove extraneous ' ,' at the end of running model list
### 📊 Changes
**7 files changed** (+74 additions, -52 deletions)
<details>
<summary>View changed files</summary>
📝 `backend/open_webui/main.py` (+3 -3)
📝 `backend/open_webui/socket/main.py` (+24 -15)
📝 `src/lib/components/chat/Chat.svelte` (+12 -7)
📝 `src/lib/components/layout/Sidebar/UserMenu.svelte` (+33 -25)
📝 `src/lib/i18n/locales/de-DE/translation.json` (+1 -0)
📝 `src/lib/i18n/locales/en-US/translation.json` (+1 -0)
📝 `src/lib/stores/index.ts` (+0 -2)
</details>
### 📄 Description
# Pull Request Checklist
### Note to first-time contributors: Please open a discussion post in [Discussions](https://github.com/open-webui/open-webui/discussions) and describe your changes before submitting a pull request.
**Before submitting, make sure you've checked the following:**
- [x] **Target branch:** Please verify that the pull request targets the `dev` branch.
- [x] **Description:** Provide a concise description of the changes made in this pull request.
- [x] **Changelog:** Ensure a changelog entry following the format of [Keep a Changelog](https://keepachangelog.com/) is added at the bottom of the PR description.
- [x] **Documentation:** Have you updated relevant documentation [Open WebUI Docs](https://github.com/open-webui/docs), or other documentation sources?
- [x] **Dependencies:** Are there any new dependencies? Have you updated the dependency versions in the documentation?
- [x] **Testing:** Have you written and run sufficient tests to validate the changes?
- [x] **Code review:** Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
- [x] **Prefix:** To clearly categorize this pull request, prefix the pull request title using one of the following:
- **BREAKING CHANGE**: Significant changes that may affect compatibility
- **build**: Changes that affect the build system or external dependencies
- **ci**: Changes to our continuous integration processes or workflows
- **chore**: Refactor, cleanup, or other non-functional code changes
- **docs**: Documentation update or addition
- **feat**: Introduces a new feature or enhancement to the codebase
- **fix**: Bug fix or error correction
- **i18n**: Internationalization or localization changes
- **perf**: Performance improvement
- **refactor**: Code restructuring for better maintainability, readability, or scalability
- **style**: Changes that do not affect the meaning of the code (white space, formatting, missing semi-colons, etc.)
- **test**: Adding missing tests or correcting existing tests
- **WIP**: Work in progress, a temporary label for incomplete or ongoing work
# Changelog Entry
### Description
Revamped tracking and display of "usage", fixing a tracking issue, exposing only necessary information to the client (i.e. not all active user IDs) and now displaying the actual concurrent LLM usage, overall and per model, which is arguably the more more interesting metric compared to the number of users with active websockets.
### Added
- tracking of active chat completions count per model
- exposure of these metrics via /api/usage
- display of these metrics in UserMenu, both in the menu and the tooltip on hover
- locale string incl. German translation
### Changed
- expose only active user count to the clients, not the full user list
- instead of a list of session ids, a list of message ids is tracked per model
### Removed
- Unused websocket variables `activeUserIds`, `USAGE_POOL`
### Fixed
- make sure "usage" is emitted on socket at least once, such that USAGE_POOL is reliably filled
### Security
- arguably, openly exposing the full user list on /api/usage without need isn't best practice, even if it's just IDs
### Breaking Changes
- **BREAKING CHANGE**: /api/usage now yields only active user count, not the full list of IDs
- **BREAKING CHANGE**: /api/usage now yields a dict of active model names and their request counts, instead of just a list of active models
---
### Additional Information
- In a further PR, the visibility of the whole display should be configurable, allowing for settings Everyone/Admins/Disabled
- In a further PR, cleanup mechanics for USER_POOL should be revisited
- This PR is 100% handcrafted, so please don't hurt my feelings 😅
### Screenshots or Videos
Issue **before** this PR, where USAGE_POOL wasn't reliably filled -> no tooltip appears on hover:
https://github.com/user-attachments/assets/8a691796-abe5-4ed1-af2b-7a64ae7c80bd
With this PR, A) model usage is tracked properly and B) overall and individual running requests are displayed:
https://github.com/user-attachments/assets/63ef0f69-984e-4a4e-84bb-1853c1da8cd6
Also, just a proof that active users are tracked properly:
https://github.com/user-attachments/assets/e88f894f-bd19-47c8-93de-2affe296bc8a
### Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms.
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/15311
Author: @Ithanil
Created: 6/25/2025
Status: 🔄 Open
Base:
dev← Head:usage_revamp📝 Commits (6)
be3d6f1directly return number of active users from backend for usage display5b1e504remove unused websocket variables6f88e8dfix usage_pool update mechanism and store running message ids instead of session ids per model in usage poole79637blet /api/usage return active requests per model and display the information in UserMenu5b3460cadd/change localesd6a79a7remove extraneous ' ,' at the end of running model list📊 Changes
7 files changed (+74 additions, -52 deletions)
View changed files
📝
backend/open_webui/main.py(+3 -3)📝
backend/open_webui/socket/main.py(+24 -15)📝
src/lib/components/chat/Chat.svelte(+12 -7)📝
src/lib/components/layout/Sidebar/UserMenu.svelte(+33 -25)📝
src/lib/i18n/locales/de-DE/translation.json(+1 -0)📝
src/lib/i18n/locales/en-US/translation.json(+1 -0)📝
src/lib/stores/index.ts(+0 -2)📄 Description
Pull Request Checklist
Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.
Before submitting, make sure you've checked the following:
devbranch.Changelog Entry
Description
Revamped tracking and display of "usage", fixing a tracking issue, exposing only necessary information to the client (i.e. not all active user IDs) and now displaying the actual concurrent LLM usage, overall and per model, which is arguably the more more interesting metric compared to the number of users with active websockets.
Added
Changed
Removed
activeUserIds,USAGE_POOLFixed
Security
Breaking Changes
Additional Information
Screenshots or Videos
Issue before this PR, where USAGE_POOL wasn't reliably filled -> no tooltip appears on hover:
https://github.com/user-attachments/assets/8a691796-abe5-4ed1-af2b-7a64ae7c80bd
With this PR, A) model usage is tracked properly and B) overall and individual running requests are displayed:
https://github.com/user-attachments/assets/63ef0f69-984e-4a4e-84bb-1853c1da8cd6
Also, just a proof that active users are tracked properly:
https://github.com/user-attachments/assets/e88f894f-bd19-47c8-93de-2affe296bc8a
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.