You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature] Comprehensive Token Usage Analytics & Global Usage Guardrails #7214
A dashboard to monitor consumption over daily, weekly, monthly, yearly, and lifetime periods. Users can filter statistics by individual models and set custom data retention policies, such as a six-month default or permanent storage. The system automatically updates a local CSV file whenever Unsloth Studio is closed and allows users to export their history as a CSV or JSON data dump. Visualization features include line graphs for usage trends and simple predictive modeling. For hybrid workflows, the tracker shows the percentage split between local and API usage on a per-model basis.
Global Token Limiter
An aggregate cap that can be set by users to a custom value and usage period across all chat sessions within a set timeframe (for example, 150,000 tokens per week). This feature is distinct from individual session context length settings. Once the limit is reached, Unsloth Studio locks local model access until the next reset period to help users maintain self-imposed boundaries.
Rationale and Use Cases
This feature addresses several critical needs:
Neurodiversity Support: Provides a boundary for users with ADHD to prevent hyper-fixation or getting lost in long tangents.
Digital Wellbeing: Helps curb AI dependency and supports personal self-control regarding digital consumption.
Cost Management: Assists hybrid users in controlling expenses when using external APIs alongside local models.
Hardware Longevity: Protects consumer GPUs by managing thermal load and duty cycles through usage caps.
Productivity: Ensures AI remains an assistant rather than a distraction during deep work sessions.
Reacted by Eyera, Naitik Pal, dustinity and ContextPerspective
Thank you, VectorCipher. For your questions about part 2, here are my answers:
Q1: Global Token Limiter scope — should the cap apply to local models only (as the issue text implies — "locks local model access"), or should API usage share the same cap / get its own separate cap? A1: The cap could apply to both local and API, but be toggled as either the sum of local and API caps, or as two separate caps
Q2: Mid-generation behavior on cap hit — let an in-flight response finish and block the next request, or interrupt generation immediately? Part 1's schema logs on completion either way, but the limiter's enforcement point depends on this answer. A2: Let the in-flight response finish, then block the next request. Interrupting a generation mid-sentence creates a poor user experience and can cause client-side errors.
Q3: Multi-session counting — is the limiter a single global counter across all concurrently open sessions/windows, or per-session with a shared budget? A3: Single Global Counter. The limit should be a single global counter across all concurrently open sessions/windows. If the limit were per-session, it would be trivial to bypass the "Neurodiversity Support" and "Digital Wellbeing" goals by simply opening a new chat window or restarting the app. For the limiter to act as a meaningful boundary for focus and hardware protection, it must track the total load on the system budget regardless of which window is active.
Q4: Override/snooze — hard block with no bypass, or allow a manual override (possibly with friction, e.g. a confirmation step) so it doesn't lock someone out mid-task? A4: Provide a "One-time Override" option with explicit friction. When the limit is hit, show a dialog: "You have reached your weekly limit. Would you like to allow one more response to finish your current task? (This action cannot be undone until the next reset)."
Q5: Rollup vs. hard-delete for retention — Part 1 ships with simple hard-delete past the retention window for simplicity. A usage_events_daily rollup table (preserving long-range trend data without unbounded row growth) is a natural fast-follow — worth doing before or alongside the dashboard, or fine to defer further? A5: Do what you feel is best. The .csv table can be applied before or during the dashboard development.
One more thing, if this isn't too much to ask. Given that the limits can be set, say weekly, a timer to remove the limits could be nice, like set to minimum of the period up to say a year, or indefinitely (with password to unlock). For instance, a parent or boss could set a password to unlock usage limits if they are set to indefinite. For all other finite times, the limits could turn off after a set period the user specifies.
Edit: When the token usage limiter arrives, I have noticed that tokens can be counted either by total (which includes thinking), or only the non-thinking part. It would be nice if the user could set the limit to either be on the total, or on the non-thinking. For myself, I would set the limit only on the non-thinking part of the conversations. But others could set it on the actual total if needed. For instance, most of my chats use 20-30K tokens of non-thinking, while the data shows my total average chat length is 138K tokens. Also the x-axis cannot be scaled by daily, weekly, or monthly usage as of now.
For the graphs, it would be nice if the graph had units on the y-axis for tokens instead of being unitless, and the graph could be a line graph instead. Also, "most used models" could also be ranked in a pie chart and color coded by local vs API and by model type. Local could be solid color, while API could be striped. Thank you, @VectorCipher
Bar Graphs are kinda hard to read, and are typically not proper according to statistics professors.
Fixed! Sorry on the delay. Settings > Profile > Your stats now has an Export CSV button that saves every chat response and API request with its date, model and token counts, so you can pivot by day, month, year or model in a spreadsheet (fixed in #14213). The usage dashboard, line charts and API usage tracking landed earlier in #7593, #9320 and #13558; the global token limiter is not part of this, so feel free to open a separate issue for it if you still want it.
To update: Unsloth Desktop will have an update banner. For Studio, use unsloth studio update. For Docker, use docker exec <container> unsloth-studio-update. Reopen if it still happens.
8. Fixed! Sorry on the delay. Settings > Profile > Your stats now has an Export CSV button that saves every chat response and API request with its date, model and token counts, so you can pivot by day, month, year or model in a spreadsheet (fixed in #14213). The usage dashboard, line charts and API usage tracking landed earlier in #7593, #9320 and #13558; the global token limiter is not part of this, so feel free to open a separate issue for it if you still want it.
To update: Unsloth Desktop will have an update banner. For Studio, use unsloth studio update. For Docker, use docker exec <container> unsloth-studio-update. Reopen if it still happens.
Thank you. I'll open the separate issue some time this week for the token usage limiter. Might be a two part one that could limit tokens by calculated energy usage of CPU and GPU (software can determine that pretty easily nowadays) per period, and by total tokens/period.
Activity
TheAlex25 commentedon Jul 18, 2026
Thank you, VectorCipher. For your questions about part 2, here are my answers:
Q1: Global Token Limiter scope — should the cap apply to local models only (as the issue text implies — "locks local model access"), or should API usage share the same cap / get its own separate cap?
A1: The cap could apply to both local and API, but be toggled as either the sum of local and API caps, or as two separate caps
Q2: Mid-generation behavior on cap hit — let an in-flight response finish and block the next request, or interrupt generation immediately? Part 1's schema logs on completion either way, but the limiter's enforcement point depends on this answer.
A2: Let the in-flight response finish, then block the next request. Interrupting a generation mid-sentence creates a poor user experience and can cause client-side errors.
Q3: Multi-session counting — is the limiter a single global counter across all concurrently open sessions/windows, or per-session with a shared budget?
A3: Single Global Counter. The limit should be a single global counter across all concurrently open sessions/windows. If the limit were per-session, it would be trivial to bypass the "Neurodiversity Support" and "Digital Wellbeing" goals by simply opening a new chat window or restarting the app. For the limiter to act as a meaningful boundary for focus and hardware protection, it must track the total load on the system budget regardless of which window is active.
Q4: Override/snooze — hard block with no bypass, or allow a manual override (possibly with friction, e.g. a confirmation step) so it doesn't lock someone out mid-task?
A4: Provide a "One-time Override" option with explicit friction. When the limit is hit, show a dialog: "You have reached your weekly limit. Would you like to allow one more response to finish your current task? (This action cannot be undone until the next reset)."
Q5: Rollup vs. hard-delete for retention — Part 1 ships with simple hard-delete past the retention window for simplicity. A usage_events_daily rollup table (preserving long-range trend data without unbounded row growth) is a natural fast-follow — worth doing before or alongside the dashboard, or fine to defer further?
A5: Do what you feel is best. The .csv table can be applied before or during the dashboard development.
TheAlex25 commentedon Jul 29, 2026
One more thing, if this isn't too much to ask. Given that the limits can be set, say weekly, a timer to remove the limits could be nice, like set to minimum of the period up to say a year, or indefinitely (with password to unlock). For instance, a parent or boss could set a password to unlock usage limits if they are set to indefinite. For all other finite times, the limits could turn off after a set period the user specifies.
Edit: When the token usage limiter arrives, I have noticed that tokens can be counted either by total (which includes thinking), or only the non-thinking part. It would be nice if the user could set the limit to either be on the total, or on the non-thinking. For myself, I would set the limit only on the non-thinking part of the conversations. But others could set it on the actual total if needed. For instance, most of my chats use 20-30K tokens of non-thinking, while the data shows my total average chat length is 138K tokens. Also the x-axis cannot be scaled by daily, weekly, or monthly usage as of now.
For the graphs, it would be nice if the graph had units on the y-axis for tokens instead of being unitless, and the graph could be a line graph instead. Also, "most used models" could also be ranked in a pie chart and color coded by local vs API and by model type. Local could be solid color, while API could be striped. Thank you, @VectorCipher
Bar Graphs are kinda hard to read, and are typically not proper according to statistics professors.

danielhanchen commentedon Oct 19, 2026
Fixed! Sorry on the delay. Settings > Profile > Your stats now has an Export CSV button that saves every chat response and API request with its date, model and token counts, so you can pivot by day, month, year or model in a spreadsheet (fixed in #14213). The usage dashboard, line charts and API usage tracking landed earlier in #7593, #9320 and #13558; the global token limiter is not part of this, so feel free to open a separate issue for it if you still want it.
To update: Unsloth Desktop will have an update banner. For Studio, use
unsloth studio update. For Docker, usedocker exec <container> unsloth-studio-update. Reopen if it still happens.Studio: export token usage from Profile stats as CSV (unslothai#14213)
TheAlex25 commentedon Oct 20, 2026
Thank you. I'll open the separate issue some time this week for the token usage limiter. Might be a two part one that could limit tokens by calculated energy usage of CPU and GPU (software can determine that pretty easily nowadays) per period, and by total tokens/period.