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.

VerifiedSTDIODesktop onlyData & AnalyticsAI & ML

Overview

AI-generated 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.
Before you install
Prices are described as representative placeholders, so estimates should be verified against each provider's official pricing. Only OpenAI token counts are exact; other providers are approximated with an OpenAI encoding and flagged as estimates.

Installation

In SourceWeft

  1. Open Llm Cost Estimator in the dashboard and add it to a workspace.
  2. 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

ToolDescription
estimate_costToken count + cost across multiple models for a piece of text. Returns a Markdown table and structured JSON. Args: text, models?, outputTokens?, currency?.
count_tokensToken count for one model. Args: text, model?. OpenAI is exact (tiktoken); others are flagged estimates.
list_modelsAll model keys with provider, prices (USD/1M), and context window.

⚠️ 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:

bash
npm install            # at the repo ROOT, once (provides the reused core's deps)cd mcp-servernpm installnpm run build          # -> dist/index.jsnpm test               # builds, then runs a real stdio MCP handshake

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):

jsonc
{  "mcpServers": {    "llm-cost-estimator": {      "command": "node",      "args": ["C:/path/to/llm-cost-estimator/mcp-server/dist/index.js"]    }  }}

Restart Claude Desktop, then ask: "Estimate the cost of this prompt on GPT-4o vs Claude Sonnet vs Gemini."

Claude Code (CLI)

bash
claude mcp add llm-cost-estimator -- node /abs/path/to/mcp-server/dist/index.js

Cursor

Add to ~/.cursor/mcp.json (global) or .cursor/mcp.json (per-project):

jsonc
{  "mcpServers": {    "llm-cost-estimator": {      "command": "node",      "args": ["/abs/path/to/mcp-server/dist/index.js"]    }  }}

After publishing to npm (optional)

Once this package is published, clients can launch it without a local build:

jsonc
{  "mcpServers": {    "llm-cost-estimator": { "command": "npx", "args": ["-y", "llm-cost-estimator-mcp"] }  }}

License

MIT — see ../LICENSE.

Source: mcp-server/README.md at commit b90eb2e

Tools

0
SourceWeft has not started this package in its sandbox yet, so its tools are not known.

Version history

1
  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