ai-api-cost-mcp
Provides read-only cost estimation and comparison for Google Gemini API models, including token rates, monthly workload costs, cost per request, margins, and break-even calculations.
Provides read-only cost estimation and comparison for OpenAI API models, including per-million input, cached input, and output token rates, monthly workload costs, cost per request, gross margin, break-even price, and break-even users.
AI API Cost MCP Server
An MCP server that estimates and compares OpenAI, Anthropic Claude and Google Gemini API costs for a SaaS feature: monthly token cost, cost per request, gross margin, break-even price per user and break-even users.
Ask your AI assistant things like:
"If 2,500 users each send 30 chat messages a month, what does Claude Sonnet 5.5 cost us?"
"Compare every model for a support bot with 80 requests per user, priced at $49 a month."
"At $1 input and $4 output per million tokens, what's our margin on the documents workload?"
It uses the same rates, presets and formulas as the free web calculator at aisaaswithmustafa.com/tools/ai-api-cost-calculator.html, so the two always agree.
Tools
Tool | What it does |
| Current rates per 1M input, cached input and output tokens for each model, with promotional end dates and official pricing sources. Optional |
| Full monthly estimate for one model (or your own |
| Runs one workload against every model (or one provider) and ranks them by monthly API cost, with total cost and margin. |
Every workload can start from a preset (chat, support, summarizer, documents) and override any number: users, requests_per_user, input_tokens, output_tokens, cached_input_pct, extra_cost_per_request, price_per_user, variable_cost_per_user, fixed_monthly_cost. The answer always says which values came from the preset.
All tools are read-only calculations. Results are planning estimates, not billing guarantees, and cover token cost only, not output quality or latency.
Related MCP server: TokenLens MCP Server
Install
Requires Node.js 18.17 or newer.
Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"ai-api-cost": {
"command": "npx",
"args": ["-y", "ai-api-cost-mcp"]
}
}
}On Windows, if npx is not found, use "command": "cmd" with "args": ["/c", "npx", "-y", "ai-api-cost-mcp"].
Claude Code:
claude mcp add ai-api-cost -- npx -y ai-api-cost-mcpCursor (.cursor/mcp.json): the same mcpServers block as Claude Desktop.
Where the rates come from
The package bundles the rate table, verified against the official OpenAI, Anthropic and Google pricing pages (the verified date is shown in every answer).
On start, the server also tries the public rates file at
https://aisaaswithmustafa.com/tools/ai-api-pricing.jsonand uses it if it is newer, so price updates arrive without a new release. It is a plain GET of a static JSON file; nothing you type is sent anywhere.Set
AI_API_COST_MCP_OFFLINE=1to skip that request and use only the bundled rates.Promotional prices switch to the standard rate automatically after their end date.
Development
npm install
npm test # starts the server over stdio with a real MCP client and checks every tool
npm run sync # inside the website repo only: re-copy the calculator modulesrc/calculator.cjs is a copy of the calculator that runs on the website, so the rates and formulas stay identical. This repository is published from the mcp/ai-api-cost-mcp folder of the website's repository; in a standalone clone, npm run sync keeps the bundled copy.
Author
Built by Muhammad Mustafa, full-stack SaaS and AI developer. Issues and suggestions are welcome.
License
MIT
Available Tools
3 toolscompare_modelsCompare AI API cost across modelsARead-onlyIdempotent
Run the same SaaS workload against every known OpenAI, Claude and Gemini model (or one provider) and rank them by monthly AI API cost, with cost per request, total monthly cost and gross margin. Token cost only: it does not judge output quality or latency.
Inputs: users, provider, use_case, input_tokens, +7 more.
estimate_costEstimate monthly AI API cost and marginARead-onlyIdempotent
Estimate the monthly AI API bill for one model and a SaaS workload: token costs (uncached input, cached input, output), cost per request, total cost with other variable and fixed costs, revenue, gross profit, gross margin, break-even price per user and break-even users. Start from a use_case preset and override any number.
Inputs: model, users, use_case, custom_rates, +8 more.
list_modelsList AI API models and ratesARead-onlyIdempotent
List the OpenAI, Anthropic Claude and Google Gemini models this server knows, with current standard rates in USD per 1 million input, cached input and output tokens, promotional end dates and official pricing sources.
Inputs: provider.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
Each tool targets a clearly distinct operation: list_models is a read-only catalog lookup, estimate_cost computes one model against one workload, and compare_models iterates all models to rank costs. Descriptions explicitly delimit scope (compare_models even notes it is token-cost only), so an agent can select correctly without confusion.
All three names follow a strict snake_case verb_noun pattern with verbs whose semantics match the operation (list for enumeration, estimate for computation, compare for ranking). No style mixing or vague verbs like process/run.
Three tools is on the lean side but each earns its place in a narrow pricing/estimation domain, with no redundancy. A small addition such as fetching a single model's details or refreshing rates would round it out, but nothing is superfluous.
The surface covers the core lifecycle for this domain: discover models with rates, price a single-model workload, and compare across providers. Minor gaps exist — no tool to update or add custom rates, no per-model detail lookup, and no output-quality/latency dimension — but agents can work around these by overriding cost inputs in estimate_cost.
Maintenance
Related MCP Connectors
LLM prices, cost estimates and break-even, plus your app's AI cost and margin per user.
Compare AI model prices and estimate workload costs with four read-only tools. No account needed.
Find AI model pricing, estimate token costs and compare offers. No API key required.
LLM API prices and AI agent cost estimates, verified daily. Read-only cost lookup tools.
Related MCP Servers
- AlicenseAqualityDmaintenanceEstimates Claude API token counts, per-model cost, and prompt-caching break-even without an API key or network.5MIT
- FlicenseAqualityDmaintenanceEnables AI agents to compare AI model pricing plans, run cost scenarios, find break-even points, and get plan recommendations using TokenLens data.4-
- AlicenseNot gradedqualityDmaintenanceEnables AI cost calculation, comparison, and optimization across major providers like Anthropic, OpenAI, Google, Meta, and Mistral. Supports cost estimation, budget-aware model finding, and token estimation through a simple API and MCP integration.MIT
- AlicenseAqualityBmaintenanceEnables AI agents to calculate, compare, and recommend AI API costs from multiple providers, with support for currency conversion and platform fee analysis.81MIT