
AI API Cost Calculator
Estimates OpenAI, Claude and Gemini API costs, margins and break-even price for SaaS
AI API Cost Calculator is an open-source MCP server for ai models and llm tooling. It runs locally on your machine and is started by your AI client.
- Pricing
- Open source
- Platforms
- CLI, API, macOS
- Runs
- Locally
- Version
- 0.1.0
- Listing updated
Similar MCP servers
Install
Add with the CLI
Run in a terminal
claude mcp add ai-api-cost-mcp -- npx -y ai-api-cost-mcpAdd --scope user to use it in every project, or --scope project to share it in .mcp.json.
Or share it with your project
Add to .mcp.json
{
"mcpServers": {
"ai-api-cost-mcp": {
"command": "npx",
"args": [
"-y",
"ai-api-cost-mcp"
]
}
}
}Add to claude_desktop_config.json
{
"mcpServers": {
"ai-api-cost-mcp": {
"command": "npx",
"args": [
"-y",
"ai-api-cost-mcp"
]
}
}
}Settings → Developer → Edit Config, then quit and reopen Claude Desktop.
Add to ~/.cursor/mcp.json
{
"mcpServers": {
"ai-api-cost-mcp": {
"command": "npx",
"args": [
"-y",
"ai-api-cost-mcp"
]
}
}
}Use .cursor/mcp.json in a project to share it with the project.
Add to ~/.copilot/mcp-config.json
{
"mcpServers": {
"ai-api-cost-mcp": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"ai-api-cost-mcp"
]
}
}
}Or put the same entry in .mcp.json at your workspace root to share it.
Add with the CLI
Run in a terminal
codex mcp add ai-api-cost-mcp -- npx -y ai-api-cost-mcpOr add to config.toml
Add to ~/.codex/config.toml
[mcp_servers.ai-api-cost-mcp]
command = "npx"
args = ["-y", "ai-api-cost-mcp"]Add to your client's MCP settings (most use this shape)
{
"mcpServers": {
"ai-api-cost-mcp": {
"command": "npx",
"args": [
"-y",
"ai-api-cost-mcp"
]
}
}
}Gemini CLI and Antigravity
Gemini CLI
Add to ~/.gemini/settings.json
{ "mcpServers": { "ai-api-cost-mcp": { "command": "npx", "args": [ "-y", "ai-api-cost-mcp" ] } } }Or run: gemini mcp add -s user ai-api-cost-mcp npx -- -y ai-api-cost-mcp
Antigravity
Add to ~/.gemini/config/mcp_config.json
{ "mcpServers": { "ai-api-cost-mcp": { "command": "npx", "args": [ "-y", "ai-api-cost-mcp" ] } } }Use .agents/mcp_config.json to add it to one workspace only.
Devin Desktop (formerly Windsurf)
Add to ~/.config/devin/mcp_config.json
{ "mcpServers": { "ai-api-cost-mcp": { "command": "npx", "args": [ "-y", "ai-api-cost-mcp" ] } } }On Windows the file is %APPDATA%\devin\mcp_config.json. Use .devin/mcp_config.json to share it with a project.
Cline
Add to cline_mcp_settings.json
{ "mcpServers": { "ai-api-cost-mcp": { "command": "npx", "args": [ "-y", "ai-api-cost-mcp" ] } } }Open it from the MCP Servers icon → Configure → Configure MCP Servers.
Zed
Add to Zed settings.json
{ "context_servers": { "ai-api-cost-mcp": { "command": "npx", "args": [ "-y", "ai-api-cost-mcp" ] } } }Open it with zed: open settings file. Merge context_servers into the settings you already have.
JetBrains AI Assistant and Junie
AI Assistant
Add to Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add
{ "mcpServers": { "ai-api-cost-mcp": { "command": "npx", "args": [ "-y", "ai-api-cost-mcp" ] } } }Junie
Add to ~/.junie/mcp/mcp.json
{ "mcpServers": { "ai-api-cost-mcp": { "command": "npx", "args": [ "-y", "ai-api-cost-mcp" ] } } }Use .junie/mcp/mcp.json to share it with a project.
Kiro
Add to ~/.kiro/settings/mcp.json
{ "mcpServers": { "ai-api-cost-mcp": { "command": "npx", "args": [ "-y", "ai-api-cost-mcp" ] } } }Use .kiro/settings/mcp.json to add it to one workspace only.
Using several servers? Build one config file with the MCP config generator.
Configuration
AI_API_COST_MCP_OFFLINESet to 1 to skip the live rates download and use only the rates bundled with the package.
About AI API Cost Calculator
Planning a model budget for an AI feature usually means juggling token rates, cache assumptions and subscription revenue in a spreadsheet. This server lets an AI assistant run those numbers directly, returning monthly token spend, cost per request, gross margin and the price needed to break even.
It works from the same rate table and formulas as the companion web calculator, so answers match what a visitor would see in the browser. Each workload can start from a preset for chat, support, summarizing or document processing, and any value such as user count, token volume or fixed overhead can be overridden. Responses state which numbers came from the preset.
It suits founders and developers pricing an AI add-on, comparing providers before committing to one, or checking whether a usage-based plan stays profitable. Results cover token cost only, not output quality or latency.
Tools this server provides (3)
Taken from the project documentation; the running server may differ.
From the tool list in its README, going by the names, 1 of 3 tools reads data; 2 names don't say.
From the server's own tool labels and tool names; not verified by us.
- list_modelsName suggests: reads
- Current rates per million input, cached input and output tokens for each model, with official pricing sources.
- estimate_cost
- Full monthly estimate for one model or custom rates, including cost breakdown, margin and break-even.
- compare_models
- Runs one workload against every model or one provider and ranks them by monthly API cost.
What it does
- Monthly cost estimation
- Calculates total token spend per month from users, requests and input and output token counts.
- Cross-provider comparison
- Runs one workload against every model or a single provider and ranks them by monthly cost.
- Margin and break-even
- Shows gross profit, margin, break-even price per user and break-even user count.
- Cached input handling
- Prices uncached input, cached input and output tokens separately.
- Workload presets
- Starts from chat, support, summarizer or documents presets that can be overridden field by field.
- Custom rate overrides
- Accepts your own per-million token rates when a provider's pricing differs from the table.
Good for
- Estimating the monthly API bill for an AI chat feature before launch
- Comparing OpenAI, Claude and Gemini costs for the same support bot workload
- Setting a subscription price that keeps gross margin above a target
- Checking how many users a plan can support before token costs erode profit
Pricing
Open source
Prices change. Check aisaaswithmustafa.com before you buy.
AI API Cost Calculator FAQ
Does AI API Cost Calculator need an API key from the model providers?
No. It performs local calculations on the rate table and does not call provider APIs.
Can I work offline?
Yes. Setting AI_API_COST_MCP_OFFLINE to 1 skips the live rates download and uses only the bundled rates.
Which clients can use AI API Cost Calculator?
Installation examples are given for Claude Desktop, Claude Code and Cursor, using npx to run the npm package.
Are the results billing guarantees?
No. They are planning estimates covering token cost only.
How do I add AI API Cost Calculator to Claude Code?
Run this command in your terminal: claude mcp add ai-api-cost-mcp -- npx -y ai-api-cost-mcp
What are the best alternatives to AI API Cost Calculator?
The closest alternatives to AI API Cost Calculator are AI Rate Card, ComparEdge LLM Cost, Ai Economics, LLM API Pricing and Automation Tools by shurco.ai and AI-Cost-CLI.
Where this comes from
- Description: written from the project's README, the project's website and its MCP Registry entry.
- Install steps: from the official MCP Registry entry.