
Llm Cost Estimator
io.github.waqarulwahabPublished by GitHub account waqarulwahabv0.3.1Updated Oct 25, 2026
Token counting & multi-model LLM cost estimates: GPT-4o, Claude, Gemini, 25+. No API key.
Overview
A local MCP server that lets an assistant count tokens and estimate LLM costs across 25+ models, with no API key required.
- What you can do
- Estimate token counts and costs for a piece of text across multiple models, returning a Markdown table and structured JSON, with optional output-token and currency arguments. Count tokens for a single model, with OpenAI counts exact and other providers flagged as estimates. List all model keys with provider, prices per million tokens and context window.
- When to use it
- Useful when comparing prompt or output costs across providers such as GPT-4o, Claude, Gemini, DeepSeek, Mistral, Llama or Grok, or when checking how many tokens a piece of text will consume before sending it to a model.
- Requirements
- Runs locally over stdio as a subprocess launched by the MCP client. Requires Node.js; the published npm package can be started with npx, or a local build from source. No API key or environment variables are needed.
Installation
In SourceWeft
- Open Llm Cost Estimator in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
llm-cost-estimator-mcp
An MCP (Model Context Protocol) server that gives Claude, Cursor, or any MCP client the ability to count tokens and estimate LLM costs across GPT-4o, Claude, Gemini, DeepSeek, Mistral, Llama, Grok, and 25+ models — locally, with no API key.
It reuses the exact same tokenizer + pricing + estimator core as the LLM Cost & Token Estimator VS Code extension in this repo.
Tools
⚠️ Prices are representative placeholders — verify against each provider's official pricing page. OpenAI counts are exact; all other providers are approximated via an OpenAI encoding and flagged as estimates.
Build (from source)
The server reuses the extension's core in ../src (whose files import
js-tiktoken), so install the repo-root dependencies first:
End users don't need this — they just npx -y llm-cost-estimator-mcp once it's
published (the published dist/index.js is fully self-contained).
Connect it
The server speaks MCP over stdio, so any client launches it as a subprocess.
Use the absolute path to mcp-server/dist/index.js.
Claude Desktop
Edit claude_desktop_config.json
(Windows: %APPDATA%\Claude\claude_desktop_config.json,
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json):
Restart Claude Desktop, then ask: "Estimate the cost of this prompt on GPT-4o vs Claude Sonnet vs Gemini."
Claude Code (CLI)
Cursor
Add to ~/.cursor/mcp.json (global) or .cursor/mcp.json (per-project):
After publishing to npm (optional)
Once this package is published, clients can launch it without a local build:
License
MIT — see ../LICENSE.
Source: mcp-server/README.md at commit b90eb2e
Tools
0Version history
1- v0.3.1LatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts