Skip to main content

CLI-first, local LLM cost tracker for indie devs — drop it in front of any OpenAI-compatible API and watch token usage and spend in real time. No cloud, no signup.

Project description

👁️ llmstat

PyPI CI License: MIT

See what your LLM calls actually cost — in real time.

A modern, playful terminal dashboard that sits in front of any OpenAI-compatible API (OpenAI, DeepSeek, OpenRouter, LiteLLM, vLLM, Ollama, your own gateway…) and shows you live token usage, cost, and latency. No SDK changes. No cloud. No account.

pip install llmstat → point your base URL at it → watch the numbers move.

Light
llmstat light theme
Dark
llmstat dark theme

Two pastel themes — toggle with d. Today / all-time with t.


Why

You're an indie dev shipping with LLMs — self-hosted models, a personal gateway, a couple of pay-as-you-go API keys — and you have no idea what you're spending until the invoice lands. The big observability platforms (Helicone, Langfuse…) are built for enterprise: hosted, signup-walled, dashboard-heavy, and hungry for your data. llmstat is the opposite — for the dev who just wants the number: one tiny local proxy, one SQLite file, one good-looking TUI.

  • 🪶 Zero code changes — it's a drop-in proxy. Change one base URL.
  • 🔌 Provider-agnostic — anything that speaks the OpenAI API works.
  • 🌊 Streaming-aware — reads usage from SSE chunks, not just plain responses.
  • 💸 Cost, not just tokens — built-in pricing table, override your own rates.
  • 🔒 Local-first — your prompts never touch our anything. There is no "our anything".

Install

pip install llmstat

60-second tour (no API key needed)

llmstat demo      # seed some realistic sample traffic
llmstat dash      # open the dashboard
llmstat top       # or just a one-line status bar

Press t to flip between today and all-time, r to refresh, q to quit.

Real usage

1. Start the proxy in front of your provider:

llmstat serve --upstream https://api.openai.com
# llmstat proxy -> https://api.openai.com
# point your client base_url at: http://127.0.0.1:8787/v1

2. Point your client at it — only the base URL changes:

from openai import OpenAI

client = OpenAI(base_url="http://127.0.0.1:8787/v1")  # was: the real URL
client.chat.completions.create(
    model="gpt-5-mini",
    messages=[{"role": "user", "content": "hi"}],
)

3. Watch it live in another terminal:

llmstat dash

That's it. Every call your app makes now shows up with tokens, cost, and latency.

Tag your traffic (optional)

Send an X-Llmstat-Project header and llmstat will group spend by project — handy when one machine drives several apps.

Fix or add pricing

Models change prices constantly. Drop a ~/.llmstat/pricing.json to override:

{ "my-self-hosted-llama": [0.0, 0.0], "gpt-5.5-pro": [2.50, 15.00] }

Values are USD per 1M tokens: [input, output].

How it works

your app ──▶ llmstat proxy ──▶ real LLM API
                  │
                  └─▶ SQLite (~/.llmstat/usage.db) ──▶ TUI dashboard

The proxy forwards requests untouched and reads the standard usage block out of the response (for streams, it tees the SSE and grabs the final usage chunk). Nothing is buffered to disk except the counts you see.

Roadmap

  • llmstat top — a one-line live status bar (--watch to refresh)
  • Budgets & alerts (warn at $X/day)
  • Export to CSV / Prometheus
  • Per-project & per-key breakdown views

Ideas and PRs welcome — see an issue you'd like? Open one.

License

MIT © llmstat contributors

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llmstat-0.1.1.tar.gz (29.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llmstat-0.1.1-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file llmstat-0.1.1.tar.gz.

File metadata

  • Download URL: llmstat-0.1.1.tar.gz
  • Upload date:
  • Size: 29.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for llmstat-0.1.1.tar.gz
Algorithm Hash digest
SHA256 afcbef832a905c4ab3a72413993ff72de537d2cf7382b3556e01f438fb0d46fc
MD5 2f533a63d3e1c6aba3b91a8822eee9ef
BLAKE2b-256 c0f2201c15d27421cc8785885299a2b1c74c4dfcd9c00aef66c897eff17080cd

See more details on using hashes here.

File details

Details for the file llmstat-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: llmstat-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 14.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for llmstat-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1f81126c5e384b9aecf55965a30af740ffd8e8a3aa0c233a62bc79e89be81bb3
MD5 1d6e4c18fa1682a9559ccab15a2b2cd9
BLAKE2b-256 88f7de9e5c655aa41351c8f9ade23814e7b0db67b09c54e6e5eb9411d7a3ba8f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page