llm-cost

llm-cost

Token cost math for LLM API calls: current per-million-token rates for 69 models across 17 providers, with local arithmetic for estimates, comparisons and monthly budgets. Rates are verified and date-stamped.

Category
访问服务器

README

<div align="center">

llm-cost: token cost math for LLM API calls

models providers dependencies license

</div>

Someone asks what the AI feature will cost at scale, and the honest answer around most teams is a shrug. Rates moved twice since anyone last checked, and the model itself will happily quote prices from its training data. This MCP server keeps current per-million-token rates for 69 models where your assistant can reach them, and does the arithmetic itself.

Watch it work

$ You: price Claude Opus 4.8 on a 25k-token prompt with a 1k answer, run 5,000 times

  llm-cost › estimate_cost

  Cost estimate: Claude Opus 4.8 (Anthropic)
  Rates: input $5/1M, output $25/1M, cached input $0.5/1M

  Per call (25,000 in + 1,000 out tokens):
    input:  $0.1250
    output: $0.0250
    per call total: $0.1500

  Across 5,000 calls: $750.00

  Ways to pay less for the same 5,000 calls:
    with cached input:  $187.50
    via batch API:      $375.00

Nothing here is rounded or guessed. The rate is verified, date-stamped, and the server multiplied.

<details> <summary><b>Open a second session: same call across four models, ranked</b></summary>

$ You: compare that call on Opus 4.8, Sonnet 5, GPT-5.6 Terra and Gemini 3.1 Pro

  llm-cost › compare_models_cost

  25,000 in + 1,000 out, cheapest first:

  1. Claude Sonnet 5      $0.0600 /call    $300.00 /5k
  2. Gemini 3.1 Pro       $0.0620 /call    $310.00 /5k
  3. GPT-5.6 Terra        $0.0775 /call    $387.50 /5k
  4. Claude Opus 4.8      $0.1500 /call    $750.00 /5k

  Ranking uses each model's live feed entry, not remembered prices.

</details>

The gap it closes

An assistant on its own An assistant with llm-cost
quotes output rates from training data, often a generation stale reads the current rate, dated
flattens the estimate to "a few cents" $0.1500 per call, $750.00 across 5,000
never mentions batch or caching discounts $375.00 batch, $187.50 cached, only where the model really offers them
confidently wrong, no way to tell every figure traces to a feed entry with a verification date

The same numbers answer in a browser through the LLM calculator, and the LLM category hub ranks every tracked model by rating and price.

Where the numbers travel

flowchart LR
    V["provider pricing pages<br/>17 providers"] --> CE["verification<br/>date-stamped checks"]
    CE --> F["model prices feed<br/>69 models, USD per 1M tokens"]
    F -->|"6h cache, serve stale on failure"| MCP["llm-cost server<br/>local arithmetic"]
    MCP --> A["your agent"]

The server never calls a provider API. It reads one public feed, llms-model-prices.json, and computes locally. Nothing to rate-limit, no key to leak, and a network hiccup serves the last good copy instead of an error. How each price gets checked is written up in the methodology, and the catalog behind it ships as an open dataset under CC BY 4.0.

The six tools

Four do the math. Two help you find the exact model id the math wants.

Tool Answers Params
estimate_cost one call, or N identical calls, in dollars model, input_tokens, output_tokens, calls?
compare_models_cost the same call priced across 2 to 6 models models[], input_tokens, output_tokens
monthly_budget daily, monthly, yearly spend for a workload model, daily_calls, avg_input_tokens, avg_output_tokens
cheapest_models lowest-cost models, optional context floor min_context?, limit?
list_models every model with rates, context and tier provider?
list_providers providers with model counts and cheapest pick none

<details> <summary><b>Token rules of thumb, for when nobody knows the counts</b></summary>

  • A page of English prose is roughly 500 tokens; one token is about four characters.
  • Model references are forgiving: claude-opus-4-8, Opus 4.8 and anthropic/opus resolve to the same model. When the resolver is unsure, it returns candidates instead of guessing.
  • cheapest_models ranks by a blended rate weighting input to output 3 to 1, because real workloads read far more than they write. Confirm the winner with estimate_cost on your actual split.

</details>

Prompts

Prompt Args Runs
estimate_my_workflow workflow, model? token estimates plus per-run and monthly cost for a described workflow
pick_cheapest_model task cheapest model that still meets the requirement, top candidates priced
forecast_ai_budget model, usage monthly and yearly bill projected from expected volume

Wire it up

{
  "mcpServers": {
    "llm-cost": {
      "command": "npx",
      "args": ["-y", "@comparedge/llm-cost-mcp@latest"]
    }
  }
}

Claude Desktop keeps this file at ~/Library/Application Support/Claude/claude_desktop_config.json. Cursor: Settings, then MCP. VS Code with Copilot reads .vscode/mcp.json. Restart the client; six tools appear. No API key, no account. Per-client walkthroughs live in the setup guide.

Family

Built by ComparEdge, where software prices are checked against vendor pages before anyone quotes them. Two siblings share the data: the full catalog server and a price-change watcher, both on ComparEdge MCP.

MIT licensed. JSON-RPC 2.0 over stdio, standard Model Context Protocol.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选