Labsco
MCP SERVER

tokentoll

by Jwrede

See what a code change does to your LLM bill before it merges.

Model Routing, Multi-Model Consultation & Cost Control
Summary
A cost regression caught in review, not on the invoice.

The static analysis states its own limits plainly: a model loaded from a database or remote config cannot be resolved, so that call site is priced against the configured per-SDK default and marked as such. Token counts use a characters-over-four heuristic unless tiktoken is installed, and monthly figures assume a uniform call volume you set.

What it is

A CI gate for LLM cost. It statically reads Python, JavaScript and TypeScript for LLM API calls, prices them, compares two refs and posts a verdict on the pull request. The MCP server puts the same two checks inside an agent conversation.

What you get
  • Costs estimated across a path — scan
  • Two refs compared, with the per-call-site delta — diff
  • Both returning JSON
  • Call sites detected in Python for OpenAI, Anthropic, Google GenAI, LiteLLM, LangChain and Zhipu, and in JS and TS for the OpenAI and Anthropic SDKs, the Vercel AI SDK and LangChain.js
  • Model names resolved through variable assignments, environment-variable fallbacks, function defaults, class attributes, dict and object literals and provider wrappers
  • Pricing bundled and working offline — 300+ models plus 2200+ entries from LiteLLM's combined catalog, refreshed on demand
  • Policy rules that decide a verdict: total monthly delta, per-call-site monthly cost, relative per-call increase, and unpriced models
Requirements

Pip install tokentoll[mcp], then claude mcp add --transport stdio tokentoll -- tokentoll-mcp. Python 3.10 or newer. Policy lives in .tokentoll.yml at the repository root and is discovered automatically. No API keys and no telemetry — everything runs inside your own environment.

Setup effort

One command — pip install tokentoll[mcp]