跳到正文
DEV Community· Mostafa Orazani·· 35 分鐘前AI 評分50

llm-ledger:追蹤多個供應商 LLM token、延遲及美元成本的本機優先 CLI Proxy

I built a local-first CLI proxy to track LLM tokens, latency, and USD cost across providers

AI 導讀

作者建立了 llm-ledger,一款以 Python 編寫的輕量本機優先 HTTP Proxy 和 Rich CLI 儀錶板,用來追蹤多個供應商的 LLM token 用量、延遲及即時美元成本。它讓用戶無須把提示詞經由託管的第三方 SaaS 傳送,也可透過 uvx 在 10 秒內啟動本機 Proxy,毋須安裝。

正文

Cover image for I built a local-first CLI proxy to track LLM tokens, latency, and USD cost across providers

Mostafa Orazani

When working across multiple side projects and LLM APIs (OpenAI, Anthropic, Gemini, OpenRouter), keeping track of exact token usage and real-time USD cost gets messy fast. Most observability tools require routing your prompts through a hosted third-party SaaS—which is overkill (and a privacy headache) if you just want to know how much your scripts are spending.

So I built llm-ledger (llm-ledger-cli)—a lightweight, local-first HTTP proxy and Rich CLI dashboard written in Python.

llm-ledger terminal demo


Try it in 10 seconds (zero install)

If you use uv, you can spin up the local proxy immediately without installing anything:


bash
uvx --from llm-ledger-cli llm-ledger start

來源:DEV Community · dev.to