
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 分