llm-price-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@llm-price-mcp Compare gpt-4o-mini and deepseek-chat for 2M input and 500k output tokens"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
llm-price-mcp
让 AI Agent 查询、比较大模型 API 价格、GPU 租赁价格和自建推理成本的 MCP Server · An MCP server that lets AI agents compare LLM API prices, GPU rental prices and self-hosting cost.
模型 API 价格来自 OpenRouter 公开模型接口(无需 API Key),内存缓存 1 小时。
GPU 租赁价格来自 price-tracker 生成的
gpu_prices.csv(RunPod / Lambda / Vast.ai / AutoDL 等),每行带来源 URL 与抓取日期;没有本地数据时使用包内自带的快照(2026-11-02;其中 AutoDL 为手工值,日期 2026-10-28),并在输出中注明。LLM prices come from OpenRouter's public models endpoint (no API key), cached for 1 hour.
GPU rental prices come from a price-tracker
gpu_prices.csv(RunPod / Lambda / Vast.ai / AutoDL …), each row with its source URL and fetch date; without local data a bundled, clearly dated snapshot (2026-11-02; AutoDL rows are manual values dated 2026-10-28) is used.
当前版本 / Version: 0.2.0 — 见 / see CHANGELOG.md.
中文
功能(工具)
工具 | 参数 | 说明 |
|
| 列出模型及价格(美元 / 百万 token) |
|
| 计算给定用量在各模型上的成本(美元),从低到高排序;找不到的模型列在 |
|
| 按「100 万输入 + 100 万输出 token」的成本给出最便宜的模型 |
|
| 每卡每小时租赁价格,按美元价从低到高;含原币种价格、 |
|
| 自建推理每百万 token 成本,并可与指定 API 模型的输入/输出单价对比 |
说明:OpenRouter 中价格为“可变”(如 openrouter/auto 路由)的模型会被跳过;免费模型(通常有限流)默认不参与 cheapest 排序。
GPU 数据来源(按优先级)
环境变量
LLM_PRICE_GPU_CSV:指定 CSV 文件路径(文件不存在时直接报错,不会悄悄换用其他数据);LLM_PRICE_TRACKER_DIR(默认/workspace/price-tracker)下最新一期data/<YYYY-MM-DD>/gpu_prices.csv;包内快照
src/llm_price_mcp/data/gpu_prices_snapshot.csv,输出中带source_kind: "bundled-snapshot"、snapshot_date和过期提醒。
CSV 列:provider,gpu,variant,price_per_hour,currency,note,source,fetch_date;provider=FX, gpu=USD/CNY 一行为汇率。价格为空的行(如 Vast.ai 当期无报价)会被跳过。
自建成本公式
每百万 token 成本(美元)= gpu_hourly_usd / (tokens_per_second × 3600 × utilization) × 1,000,000tokens_per_second 应是整套部署在实际并发下的总吞吐,gpu_hourly_usd 是对应全部 GPU 的小时费用(如 8 卡 × 单价)。只计 GPU 租金,不含存储、流量、运维和闲置(utilization 之外)。对比时以 API 的输出单价为主要参照(self_host_vs_output_ratio < 1 表示自建更便宜)。
安装
需要 Python ≥ 3.10。推荐使用 uv:
git clone https://github.com/under-stand/llm-price-mcp.git
cd llm-price-mcp
uv venv && uv pip install -e .
# 或:python -m venv .venv && .venv/bin/pip install -e .仓库地址默认是
under-stand/llm-price-mcp;如果你 fork 或改了 GitHub 用户名,替换成自己的即可。
本地试运行(stdio 传输):
.venv/bin/llm-price-mcp
# 或使用 MCP Inspector 调试:
npx @modelcontextprotocol/inspector .venv/bin/llm-price-mcp
# Streamable HTTP(端点 http://localhost:8081/mcp):
.venv/bin/llm-price-mcp --transport streamable-http --port 8081Docker
docker build -t llm-price-mcp .
docker run -i --rm llm-price-mcp # stdio
docker run --rm -p 8081:8081 -e MCP_TRANSPORT=streamable-http llm-price-mcp # HTTP /mcp
# 使用更新的 GPU 数据:
docker run -i --rm -v /path/to/price-tracker:/data -e LLM_PRICE_TRACKER_DIR=/data llm-price-mcpSmithery
仓库根目录的 smithery.yaml 采用 Smithery 的 container 运行时格式(构建 Dockerfile,以 Streamable HTTP 提供 /mcp)。注意:Smithery 现行文档主推「填写公网 URL」或「上传 MCPB 包」的发布方式,smithery.yaml 参考页已从现行文档移除,发布前请以 Smithery 当时的说明为准。
在 Claude Desktop 中配置
编辑 claude_desktop_config.json(macOS:~/Library/Application Support/Claude/,Windows:%APPDATA%\Claude\):
{
"mcpServers": {
"llm-price": {
"command": "uv",
"args": ["--directory", "/绝对路径/llm-price-mcp", "run", "llm-price-mcp"]
}
}
}在 Cursor 中配置
编辑 ~/.cursor/mcp.json(全局)或项目内 .cursor/mcp.json:
{
"mcpServers": {
"llm-price": {
"command": "/绝对路径/llm-price-mcp/.venv/bin/llm-price-mcp",
"args": []
}
}
}配置后可以直接问 Agent:“帮我比较 gpt-4o-mini、deepseek-chat、mistral-nemo 处理 200 万输入、50 万输出 token 的费用”,“上下文至少 128k 的最便宜的 5 个模型是哪些?”,“现在租 H100 最便宜的是哪家?”,或“一张 2.69 美元/小时的 H100 跑到 1500 token/s、利用率 60%,和 deepseek-chat API 比哪个便宜?”
如需指定 GPU 数据文件,可在配置里加 "env": {"LLM_PRICE_GPU_CSV": "/绝对路径/gpu_prices.csv"}。
开发与测试
uv pip install -e '.[dev]'
.venv/bin/pytest -q # 网络请求均已 mock,离线可跑Related MCP server: OptimToken MCP
English
Tools
Tool | Arguments | Description |
|
| List models with prices in USD per 1M tokens |
|
| Estimated USD cost of the workload per model, sorted cheapest first; unknown names go to |
|
| Cheapest models ranked by the cost of 1M input + 1M output tokens |
|
| Per-GPU-hour rental prices, cheapest (USD) first, with original currency, |
|
| Self-hosting cost per 1M tokens, optionally compared with API input/output prices |
Models with variable pricing (e.g. the openrouter/auto router) are skipped. Free models (usually rate-limited) are excluded from cheapest unless include_free=true.
GPU data source (in order)
LLM_PRICE_GPU_CSV: explicit CSV path (a missing file is reported as an error, never silently replaced);the newest
data/<YYYY-MM-DD>/gpu_prices.csvunderLLM_PRICE_TRACKER_DIR(default/workspace/price-tracker);the bundled snapshot
src/llm_price_mcp/data/gpu_prices_snapshot.csv; the output then carriessource_kind: "bundled-snapshot",snapshot_dateand a staleness notice.
CSV columns: provider,gpu,variant,price_per_hour,currency,note,source,fetch_date; the provider=FX, gpu=USD/CNY row holds the exchange rate. Rows with an empty price are skipped.
Self-hosting formula
USD per 1M tokens = gpu_hourly_usd / (tokens_per_second × 3600 × utilization) × 1,000,000Use the deployment's aggregate throughput under real concurrency and the hourly cost of all its GPUs. Only GPU rent is counted (no storage, egress, ops or idle time beyond utilization). Compare mainly against the API output price (self_host_vs_output_ratio < 1 means self-hosting is cheaper).
Install
Python ≥ 3.10. With uv:
git clone https://github.com/under-stand/llm-price-mcp.git
cd llm-price-mcp
uv venv && uv pip install -e .
# or: python -m venv .venv && .venv/bin/pip install -e .Run locally (stdio): .venv/bin/llm-price-mcp, or debug with
npx @modelcontextprotocol/inspector .venv/bin/llm-price-mcp.
Streamable HTTP: .venv/bin/llm-price-mcp --transport streamable-http --port 8081 (endpoint /mcp).
Docker
docker build -t llm-price-mcp .
docker run -i --rm llm-price-mcp # stdio
docker run --rm -p 8081:8081 -e MCP_TRANSPORT=streamable-http llm-price-mcp # HTTP /mcp
docker run -i --rm -v /path/to/price-tracker:/data -e LLM_PRICE_TRACKER_DIR=/data llm-price-mcpSmithery
smithery.yaml uses Smithery's container-runtime format (builds the Dockerfile, serves Streamable HTTP at /mcp). Smithery's current docs favour publishing by public URL or as an MCPB bundle and no longer list the smithery.yaml reference page, so check Smithery's instructions at publish time.
To point the server at a specific GPU CSV, add "env": {"LLM_PRICE_GPU_CSV": "/absolute/path/gpu_prices.csv"} to the client config.
Claude Desktop
{
"mcpServers": {
"llm-price": {
"command": "uv",
"args": ["--directory", "/absolute/path/to/llm-price-mcp", "run", "llm-price-mcp"]
}
}
}Cursor (~/.cursor/mcp.json or .cursor/mcp.json)
{
"mcpServers": {
"llm-price": {
"command": "/absolute/path/to/llm-price-mcp/.venv/bin/llm-price-mcp",
"args": []
}
}
}Development
uv pip install -e '.[dev]'
.venv/bin/pytest -q # all network calls are mockedDisclaimer
GPU prices are on-demand list prices captured on the stated fetch date (RunPod/Lambda/Vast.ai/AutoDL pages and APIs); marketplace prices such as Vast.ai change constantly and AutoDL prices are before member discounts. GPU 价格为抓取日期当天的按需标价;Vast.ai 等市场价格变化很快,AutoDL 为会员折扣前价格。
Prices are OpenRouter's listed prices and may differ from a provider's direct pricing, tiered/long-context pricing, caching discounts or batch discounts. Always verify before making budget decisions. 价格为 OpenRouter 标价,可能与厂商直连价、长上下文阶梯价、缓存/批量折扣不同,做预算前请自行核实。
变现思路 / Monetization ideas
简短、务实,不保证收入:
免费开源基础版(本仓库):MIT 协议,用来获取 GitHub Star、在 MCP 目录(如 Smithery、mcp.so、Glama)上架,积累用户和信任。
付费托管版:提供远程 HTTP/SSE 端点 + API Key,免去用户本地安装;按调用量或月订阅(例如每月几美元的个人档)收费。可同时提供一个普通 REST API,服务不用 MCP 的开发者。
更多数据源与数据质量:在付费版中合并厂商官方直连价格(OpenAI、Anthropic、Google、DeepSeek、国内厂商等)、缓存/批量折扣、阶梯价、历史价格曲线和降价提醒——这些是免费版没有、且维护有成本的部分。
团队功能:按团队实际用量做成本预测、模型选型建议报告、预算告警。
先验证:观察 Star / 安装量和 issue 里的真实需求,再决定做哪个付费功能;在有人愿意付费之前,不要先投入大量开发。
Free open-source core (this repo) for stars, MCP-directory listings and trust.
Hosted paid version: remote HTTP endpoint with API keys, priced per usage or a small monthly plan; optionally a plain REST API too.
More data sources: direct provider pricing, cache/batch discounts, tiered pricing, price history and drop alerts.
Team features: cost forecasting from real usage, model-selection reports, budget alerts.
Validate demand (stars, installs, issues) before building paid features.
License
Available Tools
5 toolscheapestA
Return the cheapest models, ranked by cost of 1M input + 1M output tokens.
Args: min_context: Only models with at least this context window (tokens). keyword: Optional provider/keyword filter, e.g. "qwen". limit: How many models to return (default 10). include_free: Include $0 models (often rate-limited); default False.
Inputs: limit, keyword, min_context, include_free. Returns: object
compare_costA
Estimate and rank the cost (USD) of a workload across several models, cheapest first.
Args: models: Model ids such as "openai/gpt-4o-mini" (a unique substring also works). input_tokens: Number of prompt/input tokens. output_tokens: Number of completion/output tokens.
Inputs: models (required), input_tokens (required), output_tokens (required). Returns: object
estimate_self_hostA
Estimate the USD cost per 1M tokens of self-hosting a model on rented GPUs.
cost_per_1M = gpu_hourly_usd / (tokens_per_second * 3600 * utilization) * 1,000,000
Args: tokens_per_second: Sustained aggregate throughput of the deployment (all concurrent requests together), in generated tokens per second. gpu_hourly_usd: Total hourly cost of the GPUs serving that throughput (e.g. 8 x price). utilization: Fraction of paid hours actually spent serving traffic, in (0, 1]. Default 1.0. compare_models: Optional OpenRouter model ids (unique substrings work) to compare against their API input/output prices per 1M tokens.
Inputs: gpu_hourly_usd (required), tokens_per_second (required), utilization, compare_models. Returns: object
gpu_rental_pricesA
GPU rental prices per GPU-hour (RunPod, Lambda, Vast.ai, AutoDL, ...), cheapest first.
Data comes from the newest price-tracker CSV (data//gpu_prices.csv), or the file in the LLM_PRICE_GPU_CSV env var, falling back to a dated snapshot bundled with the package. Each row carries its source URL and fetch date; CNY prices are also converted to USD.
Args: gpu: Optional GPU name filter, e.g. "H100", "a100 sxm", "4090" (all terms must match). provider: Optional provider filter, e.g. "runpod", "lambda", "vast", "autodl".
Inputs: gpu, provider. Returns: object
list_modelsA
List LLMs and their prices (USD per 1M tokens) from OpenRouter.
Args: filter: Optional provider or keyword, e.g. "anthropic", "gpt", "deepseek coder". All space-separated terms must match the model id/name. limit: Max number of models to return (default 50).
Inputs: limit, filter. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool has a stated, distinct use: list_models enumerates with a keyword filter, cheapest ranks by blended 1M-in+1M-out price with context constraints, and compare_cost ranks a user-specified workload. There is still mild overlap between list_models and cheapest (both return model price rows, one just sorted/filtered differently), but the descriptions make the intended choice reasonably clear.
Three names follow verb_noun or verb_phrase style (list_models, compare_cost, estimate_self_host), but gpu_rental_prices is a bare noun phrase and cheapest is a lone adjective with no object. Readable and thematic, but not a single predictable convention.
Five tools is well-scoped for a pricing/comparison server: discovery, comparison, cheapest lookup, GPU rental data, and self-host estimation. Each tool maps to a concrete workflow step rather than padding the surface.
The domain (LLM/GPU cost analysis) is covered end-to-end: list prices, compare workloads, find cheapest, rent GPUs, and estimate self-host economics with an API-price comparison hook. Minor gaps remain, such as a direct single-model lookup by id or explicit currency/date selection, but these are workable via filters.
Maintenance
Related MCP Connectors
LLM API token prices and GPU rental prices, each with its source and date. No key, no account.
Live LLM API pricing: token prices, comparisons, cheapest-model lookups. No key required.
LLM API prices and AI agent cost estimates, verified daily. Read-only cost lookup tools.
LLM and GPU rental prices: model price lookup, GPU listings, cheapest-GPU search, price history
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides live LLM pricing data from OpenRouter, enabling agents to search models, get pricing, estimate costs, and compare models.MIT

OptimToken MCPofficial
AlicenseNot gradedqualityBmaintenanceEnables AI assistants to fetch live, dated prices for LLM models and cloud compute instances across providers, compare and recommend models, and estimate monthly costs based on workload-specific token shapes and constraints.MIT
indextkn MCP serverofficial
AlicenseNot gradedqualityCmaintenanceEnables agents to query live AI model pricing, compare providers, and calculate token workload costs from current published prices.MIT
apipriceindex-mcpofficial
AlicenseAqualityBmaintenanceGives AI agents live, verified LLM API prices from apipriceindex.com, enabling cost estimation, model search, and price lookups with verification metadata.8109 PyPIMIT