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

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

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-4o-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-4o": [2.50, 10.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

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

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.0.tar.gz (25.4 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.0-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: llmstat-0.1.0.tar.gz
  • Upload date:
  • Size: 25.4 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.0.tar.gz
Algorithm Hash digest
SHA256 017e91c97600359901c86585cd8e8c3d9a8bef6fc6cfb45cfe30cb35acba3681
MD5 feb69853f179651ffb153b683b2737e0
BLAKE2b-256 f05a2fa716505a769da0762ce9b2cd0964282bccfe836d58712a3040a5e28923

See more details on using hashes here.

File details

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

File metadata

  • Download URL: llmstat-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.2 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c045a677b14725547a7f9ca7cf5ca07f39badc0055aabe6c70ee9397e0037904
MD5 1ce047dd6344ea719f2bc7687e414771
BLAKE2b-256 d9e48a414a1ddc48e322690bdeeac5760c3204c9821929b154dd023f35589735

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