
Llm Cost Estimator
io.github.waqarulwahab由 GitHub 帳號 waqarulwahab 發布v0.3.1更新於 Oct 25, 2026
Token counting & multi-model LLM cost estimates: GPT-4o, Claude, Gemini, 25+. No API key.
概覽
一個本機 MCP 伺服器,讓助理統計 token 數量並估算 25 種以上大型模型的費用,不需 API 金鑰。
- 可以做什麼
- 針對一段文字估算多個模型的 token 數與費用,回傳 Markdown 表格和結構化 JSON,可選輸出 token 數與貨幣參數。統計單一模型的 token 數,其中 OpenAI 為精確值,其他供應商標示為估算。列出所有模型鍵及其供應商、每百萬 token 價格和上下文視窗。
- 適用情境
- 適合在 GPT-4o、Claude、Gemini、DeepSeek、Mistral、Llama、Grok 等供應商之間比較提示詞或輸出成本,或在把文字送給模型前確認其 token 用量。
- 執行需求
- 以 stdio 方式在本機執行,由 MCP 用戶端作為子程序啟動。需要 Node.js;已發佈的 npm 套件可用 npx 啟動,也可從原始碼在本機建置。不需 API 金鑰或環境變數。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Llm Cost Estimator,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
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.
來源:mcp-server/README.md,提交 b90eb2e
工具
0版本歷史
1- v0.3.1最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分