- Llm Usage & Cost Tracker
Llm Usage & Cost Tracker
llm-usage-mcp
Your local-first LLM spend ledger — queryable from inside your coding agent.
LLM costs are scattered across a dozen dashboards, billed in different currencies, with different cache-pricing rules. llm-usage-mcp captures every LLM API call you make into a single local SQLite database and exposes it as MCP tools — so your coding agent can answer "how much did I spend on Anthropic this week?" right in the chat.
It's a cost meter, not a router: it tells you what you spent and which provider fits a workload; it never changes your calls.
Why it's different
- Local-first. Everything lives in a SQLite file on your machine (
~/.llm-usage/usage.db). No cloud, no account, no telemetry. Privacy is the default. - Multi-provider, including Chinese providers. First-class support for Qwen and DeepSeek (with CNY→USD conversion) alongside Anthropic and OpenAI — the underserved combination.
- MCP-native. Cost data is exposed as MCP tools and resources, so any MCP-capable agent (Claude Code, Cursor, etc.) can query your spend conversationally.
Install
Zero-clone, straight from PyPI:
{
"mcpServers": {
"llm-usage": {
"command": "uvx",
"args": ["llm-usage-mcp"]
}
}
}
MCP tools
| Tool | What it answers |
|---|---|
query_spend | Spend broken down by provider / model / project / tag / day over a time window |
usage_summary | Rolled-up summary for today / week / month / year with top providers and models |
compare_providers | Projected cost of a workload across every known provider and model |
recommend_provider | Cheapest model that fits a budget and workload |
get_pricing | Current per-million-token pricing for any provider/model |
list_providers | All known providers, their models, and OpenAI-compatibility |
record_usage | Manually record a call (cost computed automatically at insert) |
Plus resources: usage://recent_events and usage://pricing_table.
Supported providers
Anthropic · OpenAI · Qwen (Alibaba DashScope) · DeepSeek — with an adapter pattern designed so adding Moonshot, Zhipu, Bedrock, and others is a small change.
Links
- GitHub: https://github.com/zhaoyue722/llm-usage-mcp
- PyPI:
uvx llm-usage-mcp - License: MIT
Server Config
{
"mcpServers": {
"llm-usage": {
"command": "uvx",
"args": [
"llm-usage-mcp"
]
}
}
}Recommend Servers
View AllWrite notes to Flomo