# tokeneff: An Open-Source LLM Cost Meter That Runs Locally

> Source: <https://dev.to/nio_zanghotmailcom_zang/tokeneff-an-open-source-llm-cost-meter-that-runs-locally-5440>
> Published: 2026-09-13 02:10:15+00:00

**Most LLM dashboards show you the bill *after* the damage is done.**

You run a coding agent for an afternoon, ship a feature, and two days later your

OpenAI dashboard says you spent $47. On what? Which model? Which request? You

have no idea — and by then it's too late to do anything about it.

This is the problem we kept hitting, so we built **[tokeneff](https://github.com/zangxin75/token-efficiency)** — an open-source CLI that puts a real-time electricity meter on your LLM API spend.

```
⚡ tokeneff 电表  (CNY)

  今日花费       ¥0.0284
  本月累计       ¥0.2524
  月终预测       ~¥0.93 (100% 置信)
  累计节省       ¥0.0421

  今日模型花费分布
  deepseek-v4-flash  ¥0.0192   15,797 tok
  glm-4-flash        ¥0.0092    8,273 tok
```

`tokeneff` runs a tiny local proxy on `localhost:7860`. You point your LLM client's `base_url` at it, and it:

```
your client → tokeneff proxy (localhost:7860) → LLM upstream
                   ↓
              local SQLite meter
```

It's a transparent pipe. Your requests still go direct to the provider; tokeneff just reads the `usage` counts from the response and keeps a running tab.

There are a few LLM cost trackers on GitHub already. Here's where tokeneff fits:

| Feature | tokeneff | toktrack | tokencost | LLM-Cost-Guardian | 
|---|---|---|---|---|
| Capture method | **local proxy** | reads CLI logs | manual / proxy | local proxy | 
| Real-time token count | ✅ | ❌ | ✅ | ✅ | 
| **Month-end forecast** | ✅ | ❌ | ❌ | ❌ | 
| **Dual region / currency** | ✅ | ❌ | ❌ | ❌ | 
| **BYOK + platform dual-mode** | ✅ | ❌ | ❌ | ❌ | 
| Budget alerts | ✅ | ❌ | ✅ | ✅ | 

Three things nobody else does:

The killer feature. Based on your usage trend (weighted: last 7 days × 70% + linear extrapolation × 30%), it predicts what you'll spend by month-end — with a confidence score. Seven days of data and it locks in. "At this rate, I'll hit $31 by the 31st" is the kind of number that actually changes behavior.

If you're a Chinese developer using DeepSeek/GLM/Kimi, your spend is in CNY ¥. If you're using OpenAI/Claude, it's in USD $. Most tools mash these together into one meaningless number. tokeneff tracks them **separately** — CNY spend and USD spend are never mixed.

BYOK mode is 100% free and local — your keys, your upstream, zero markup. But there's also a **platform mode** that routes through the TokenEff gateway (one key, all models, wholesale pricing). The meter shows the savings: official price vs platform price, side by side. You switch when it makes sense, not when you're forced to.

This matters more than people admit. A cost tracker that sends your request metadata to a cloud service to compute your bill is... not great. tokeneff:

`~/.tokeneff/meter.db` is a SQLite file you can `rm` anytime

```
pip install tokeneff
tokeneff setup          # pick provider, paste key
tokeneff start          # starts the proxy on :7860
tokeneff stats          # see the meter
tokeneff dashboard      # live TUI (refreshes every 0.5s)
```

Point your client at `http://localhost:7860/v1` and start building. Watch the meter while you work — not after.

**Ubuntu 22.04 gotcha:** the default `setuptools` (59.6.0) is too old for PEP 621 and installs as `UNKNOWN-0.0.0`. Run `pip install --user --upgrade "setuptools>=70"` first. (Yes, this is in the README too.)

Star ⭐ the [repo](https://github.com/zangxin75/token-efficiency) if this solves a problem for you. Issues and PRs welcome — especially new provider additions.

*Building tokeneff as part of a broader open-source LLM gateway stack. BYOK meter first, gateway later. The meter is and will remain free + local.*
