Llm Usage & Cost Tracker

Created By
zhaoyue722a day ago
A local-first, multi-provider cost meter for LLM usage, exposed as MCP tools. Captures every call into a local SQLite ledger and lets any coding agent query spend, compare providers, and get recommendations — no cloud, no account. First-class support for Chinese providers (Qwen, DeepSeek) alongside Anthropic and OpenAI.
Overview

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

ToolWhat it answers
query_spendSpend broken down by provider / model / project / tag / day over a time window
usage_summaryRolled-up summary for today / week / month / year with top providers and models
compare_providersProjected cost of a workload across every known provider and model
recommend_providerCheapest model that fits a budget and workload
get_pricingCurrent per-million-token pricing for any provider/model
list_providersAll known providers, their models, and OpenAI-compatibility
record_usageManually 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.

Server Config

{
  "mcpServers": {
    "llm-usage": {
      "command": "uvx",
      "args": [
        "llm-usage-mcp"
      ]
    }
  }
}
Project Info
Created At
a day ago
Updated At
a day ago
Author Name
zhaoyue722
Star
-
Language
-
License
-
Category

Recommend Servers

View All