[GH-ISSUE #11118] Add Token Usage Tracking (Total Tokens Processed) #69392

Closed
opened 2026-05-04 17:58:31 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @har256b on GitHub (Jun 18, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/11118

I’d like to request a feature that enables users to track the total number of tokens processed by a locally running Ollama instance. This includes both input and output tokens across all sessions.

Why is this useful?

Helps developers monitor resource usage and optimize application performance.

Useful for research, billing estimates, and keeping track of large language model usage over time.

Aligns with functionality seen in platforms like OpenAI (e.g., token usage dashboards).

Suggested implementation options:

Add a CLI command like:

ollama stats

Which could output:

Total input tokens: 123456
Total output tokens: 789012

Or expose it via an API endpoint like:

GET /api/stats

Optional: Include per-model or per-session breakdown.

Alternative Workarounds (Currently Required):

Manually track tokens using an external tokenizer (e.g., Hugging Face).

Parse and log all input/output text from API calls, then tokenize offline.

Conclusion:

This feature would provide great transparency and utility to users who run Ollama models regularly, especially in production or research environments. Thank you for considering this!

Originally created by @har256b on GitHub (Jun 18, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/11118 I’d like to request a feature that enables users to track the total number of tokens processed by a locally running Ollama instance. This includes both input and output tokens across all sessions. ### Why is this useful? Helps developers monitor resource usage and optimize application performance. Useful for research, billing estimates, and keeping track of large language model usage over time. Aligns with functionality seen in platforms like OpenAI (e.g., token usage dashboards). ### Suggested implementation options: Add a CLI command like: `ollama stats` Which could output: ``` Total input tokens: 123456 Total output tokens: 789012 ``` Or expose it via an API endpoint like: `GET /api/stats` Optional: Include per-model or per-session breakdown. ### Alternative Workarounds (Currently Required): Manually track tokens using an external tokenizer (e.g., Hugging Face). Parse and log all input/output text from API calls, then tokenize offline. ### Conclusion: This feature would provide great transparency and utility to users who run Ollama models regularly, especially in production or research environments. Thank you for considering this!
GiteaMirror added the feature request label 2026-05-04 17:58:31 -05:00
Author
Owner

@rick-github commented on GitHub (Jun 18, 2025):

https://github.com/ollama/ollama/issues/3144

<!-- gh-comment-id:2985002518 --> @rick-github commented on GitHub (Jun 18, 2025): https://github.com/ollama/ollama/issues/3144
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#69392