6 releases
| new 0.1.5 | Dec 7, 2025 |
|---|---|
| 0.1.4 | Nov 10, 2025 |
#343 in Development tools
24 downloads per month
135KB
3.5K
SLoC
__ __ __
| \ | \ | \
_| $$_ ______ | $$ __ _| $$_ ______ ______
| $$ \ / \ | $$ / \| $$ \ / \ / \
\$$$$$$ | $$$$$$\| $$_/ $$ \$$$$$$ | $$$$$$\| $$$$$$\
| $$ __ | $$ | $$| $$ $$ | $$ __ | $$ | $$| $$ | $$
| $$| \| $$__/ $$| $$$$$$\ | $$| \| $$__/ $$| $$__/ $$
\$$ $$ \$$ $$| $$ \$$\ \$$ $$ \$$ $$| $$ $$
\$$$$ \$$$$$$ \$$ \$$ \$$$$ \$$$$$$ | $$$$$$$
| $$
| $$
\$$
htop but for llm tokens
toktop is a terminal-based dashboard for OpenAI and Anthropic token usage and costs. It allows user (admin of their openai and anthropic accounts) to monitor their usage inside terminal without constantly jumping into different websites.
Installation
cargo install toktop --locked
Usage
# 1. Set Environment Variables
export OPENAI_ADMIN_KEY="your-openai-key"
export ANTHROPIC_ADMIN_KEY="your-anthropic-key"
toktop
# 2. Use env file
toktop -e .env
# 3. Don't set env var, toktop will prompt for api key
toktop
Hotkeys
←/→- Switch between options columns (Provider, Metrics, Date Range, Group By)↑/↓- Choosing optionsh/l- Scrolling charts if scroll bar is presentr- Refresh dataq- Quit the application
API Keys
OPENAI
It requires $OPENAI_ADMIN_KEY from https://platform.openai.com/settings/organization/admin-keys with READ permission to Management API Scope and Usage API Scope.
It tracks two data:
- Cost:
GET /v1/organization/costs - Usage:
GET v1/organization/usage/completionsGET v1/organization/usage/embeddingsGET v1/organization/usage/images
To group by API Keys, it also needs read access to the following endpoint:
- Get project ids:
GET v1/organization/projects - Get api key names from projects:
GET v1/organization/projects/{project_id}/api_keys
ANTHROPIC
It requires $ANTHROPIC_ADMIN_KEY from https://console.anthropic.com/settings/admin-keys.
It tracks two data:
- Cost:
GET /v1/organizations/cost_report - Usage:
GET /v1/organizations/usage_report/messages
Others
I would love to track my other LLM spends from Gemini and Cursor as well. Unfortunately, Cursor Admin API requires enterprise plan, which I don't have at the moment. Gemini does not seem to expose usage/cost in API in the same manner.
Dependencies
~15–32MB
~441K SLoC