cd /news/ai-tools/tokeneff-an-open-source-llm-cost-met… · home topics ai-tools article
[ARTICLE · art-128045] src=dev.to ↗ pub= topic=ai-tools verified=true sentiment=↑ positive

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

A developer released tokeneff, an open-source CLI that runs a local proxy on localhost:7860 to meter LLM API spending in real time, storing usage data in a local SQLite database. The tool distinguishes itself with month-end spend forecasting, separate CNY and USD tracking, and a BYOK mode that keeps keys and request metadata entirely local. It is installable via pip and supports a platform mode routing through the TokenEff gateway for wholesale pricing.

by read3 min views5 publishedSep 13, 2026

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 — 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 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.

── more in #ai-tools 4 stories · sorted by recency
── more on @tokeneff 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/tokeneff-an-open-sou…] indexed:0 read:3min 2026-09-13 ·