aicostdesk-mcp
# aicostdesk-mcp
An MCP server for **what AI actually costs**: LLM API prices, monthly bills, and the break-even
between a $20 subscription and pay-per-token.
It answers three questions inside Claude Desktop, Cursor, Claude Code or any MCP client:
- "What do the current LLM APIs cost per million tokens?"
- "What would 3,000 requests a day at 1,500 in / 500 out cost me per month, and which model is cheaper?"
- "I send 60 messages a day — is ChatGPT Plus at $20 or paying for the API the better deal?"
Every figure comes from [AI Cost Desk](https://aicostdesk.com): 20 LLM API models from OpenAI,
Anthropic, Google, DeepSeek and xAI, each rate read from the provider's own pricing page and dated.
The JSON this server reads is the same file the site's calculators use, so a desk number and a
server number cannot disagree.
## Tools
| Tool | What it does | Main inputs |
| --- | --- | --- |
| `list_llm_models` | Lists the 20 models with input, cached-input and output price per 1M tokens, the day each was checked, and scheduled price changes. | `provider`, `tier`, `sort`, `limit` |
| `calculate_api_cost` | Monthly and yearly bill for a workload on one model, per-request cost, and the cheapest alternatives for the same tokens. | `model`, `input_tokens`, `output_tokens`, `requests_per_day`, `days_per_month`, `cache_hit_rate` |
| `compare_subscription_vs_api` | A flat plan (ChatGPT Plus, Claude Pro, Cursor, …) versus metered API at a daily message volume, with the break-even volume. | `plan` or `monthly_price`, `model`, `messages_per_day`, `input_tokens`, `output_tokens` |
| `compare_two_models` | Two models on the same workload, side by side, with the monthly difference. | `model_a`, `model_b`, `input_tokens`, `output_tokens`, `requests_per_day` |
Results are Markdown: a short table or a few labelled numbers, the date the prices were checked,
and the page on aicostdesk.com that shows the same calculation.
## Install
**Claude Desktop** — add this to `claude_desktop_config.json`
(macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`,
Windows: `%APPDATA%\Claude\claude_desktop_config.json`), then restart Claude:
```json
{
"mcpServers": {
"aicostdesk": {
"command": "npx",
"args": ["-y", "aicostdesk-mcp"]
}
}
}
```
> Until the package is on the npm registry, run it straight from GitHub with
> `"args": ["-y", "github:phappyj/aicostdesk-mcp"]`. Both forms need Node 18.17+.
**Cursor** — the same block in `~/.cursor/mcp.json` (or Settings → MCP → Add new MCP server,
type `command`):
```json
{
"mcpServers": {
"aicostdesk": {
"command": "npx",
"args": ["-y", "aicostdesk-mcp"]
}
}
}
```
**Claude Code**
```bash
claude mcp add aicostdesk -- npx -y aicostdesk-mcp
```
**From a local clone** (development, or no npx)
```bash
git clone https://github.com/phappyj/aicostdesk-mcp.git
cd aicostdesk-mcp
npm install
node bin/aicostdesk-mcp.js
```
```json
{
"mcpServers": {
"aicostdesk": {
"command": "node",
"args": ["/absolute/path/to/aicostdesk-mcp/bin/aicostdesk-mcp.js"]
}
}
}
```
## Example
> **You:** I'm building a support bot. 2,000 conversations a day, about 4,000 input and 800 output
> tokens each. What does Gemini 4 Carbon cost me, and is something cheaper?
> **Claude** *(after `calculate_api_cost`)*: At 2,000 requests/day × 4,000 in + 800 out, Gemini 4
> Carbon is **$1,920/month** ($23,040/year), $0.032 per conversation. The cheapest models for the
> same tokens are GPT-6 Luna and Claude Haiku 5.5 at $48/month (98% less) — cost only, not quality:
> both are budget tier against a flagship. Prices checked 2026-12-01
> (aicostdesk.com/llm-api-calculator).
## Where the numbers come from
- Source: [`phappyj/llm-pricing-json`](https://github.com/phappyj/llm-pricing-json) `pricing.json`
(MIT), the machine-readable copy of the table behind [aicostdesk.com](https://aicostdesk.com) —
the same file the site's three calculators render from.
- On start the server fetches that file once (3 s timeout), keeps it in memory for the process, and
writes a copy to the OS temp directory. If the network is down it uses that copy (up to 7 days),
and if there is none it uses the snapshot bundled in the package, so a tool call never fails for
lack of a connection.
- Each model carries `lastChecked` — the day its provider's page was actually read. Every answer
prints it. Quoting a price without the date is the one thing this server will not do.
- The arithmetic is the site's published formula:
`cost = requests × (input × input_rate + cached_input × cached_rate + output × output_rate) ÷ 1,000,000`.
- Prices are **USD list prices, standard tier**. Not included: long-context surcharges (several
vendors double the rate above 200K tokens — the threshold is in each model's note), batch and
off-peak discounts, committed-use pricing, regional resale (Bedrock, Vertex), taxes. Cost says
nothing about quality, latency, context limits or rate limits, and the tools say so in their
output.
- The server sends nothing about you anywhere; the only network request is the price file, and
`AICOSTDESK_MCP_OFFLINE=1` turns even that off.
## Configuration
| Variable | Default | Purpose |
| --- | --- | --- |
| `AICOSTDESK_MCP_OFFLINE` | unset | `1` = never fetch; use the bundled snapshot |
| `AICOSTDESK_MCP_PRICING_URL` | `https://raw.githubusercontent.com/phappyj/llm-pricing-json/main/pricing.json` | Point at another copy of the price JSON |
## Development
```bash
npm install
npm test # 32 tests: raw JSON-RPC over stdio, cost maths, fallback chain
npm run test:live # the official SDK client against the live price feed
npm run sync-snapshot # refresh data/pricing.json from the live feed
```
The test suite speaks the protocol itself — it spawns `bin/aicostdesk-mcp.js` and sends
`initialize`, `tools/list` and `tools/call` as newline-delimited JSON-RPC, so a regression in
framing or schemas fails the build without an SDK in the loop.
## License
MIT. Data is collected from public vendor pricing pages; the vendors own their pricing. Not
affiliated with OpenAI, Anthropic, Google, DeepSeek, xAI, Cursor or GitHub.
TDQS
Scored across 4 tools
Each tool targets a distinct task: model discovery, workload cost calculation, subscription-vs-API comparison, and model head-to-head comparison. There is minor overlap because calculate_api_cost already names cheaper alternatives, which brushes against compare_two_models, but descriptions make the boundary clear enough.
All four names follow a consistent snake_case verb_noun pattern (list_, calculate_, compare_). The convention is predictable and reads uniformly across the set.
Four tools is on the lean side but well matched to a focused cost-calculator domain, with no filler tools. Reasonable coverage without bloat.
The surface covers discovery, cost estimation, subscription comparison, and model comparison, which are the core lifecycle needs of this domain. Minor gaps exist (e.g. batch/embedding pricing or a single-model lookup), but agents can work around them via list_llm_models.