Featured

Deploy OpenClaw in 60 seconds — 20% off logoDeploy OpenClaw in 60 seconds — 20% off

Launch OpenClaw on Hostinger in about 60 seconds and keep your agent live 24/7. Our referral link gives you 20% off, no coupon code needed.

Launch on Hostinger
Run your Hermes agent on Hostinger, fully managed logoRun your Hermes agent on Hostinger, fully managed

Launch Hermes on Hostinger in one click, fully managed, no VPS knowledge needed. Use code ZACAARON10 for 10% off.

Launch on Hostinger
Crawl and scrape any site into clean data, 10% off logoCrawl and scrape any site into clean data, 10% off

Firecrawl crawls and scrapes any site into clean markdown for your agent. Get 1,000 free credits, and new users get 10% off their first purchase.

Try Firecrawl free
6,000+ web scrapers for your AI agent, start free logo6,000+ web scrapers for your AI agent, start free

Apify gives your agent live web data: 6,000+ prebuilt scrapers and actors, MCP-ready. Sign up free with $5 in usage credits.

Try Apify free
One API to scrape, enrich, and extract the internet. logoOne API to scrape, enrich, and extract the internet.

Context.dev gives your agents a single API to scrape, enrich, and extract live web data — no proxies, no parsers, no maintenance.

Start building free
SetupClaw: done-for-you OpenClaw for founders & exec teams logoSetupClaw: done-for-you OpenClaw for founders & exec teams

White-glove OpenClaw for founders and exec teams (4–50+ employees): we install, harden, integrate your tools, and maintain it — secured from day one.

Get it set up for you
SEO data APIs for your agent, $1 free credit logoSEO data APIs for your agent, $1 free credit

DataForSEO gives your agent live access to SERP results, keyword data, backlinks, and on-page SEO data through one API. New accounts get a $1 credit, good for up to 20,000 keyword or backlink lookups.

Try DataForSEO free
Reach 48,000+ AI builders

A flat monthly placement in front of developers actively installing AI tools. No lock-in, cancel anytime.

Advertise here

Works with

Claude CodeClaude DesktopCursorVS CodeClineCodex CLIOpenClaw+ any MCP client

Install to Claude Code

This server doesn't publish a one-line install command. Follow the setup in the source repository.

Summary

Enables 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.

README.md

<p align="center"><img src="logo.png" width="120" alt="logo"></p>

![lazymac API Store](https://lazymac2x.github.io/lazymac-api-store/) ![Gumroad](https://coindany.gumroad.com/) ![MCPize](https://mcpize.com/mcp/ai-cost-calculator-api)

AI Cost Calculator API

Building in public from $0 MRR. Star if you want to follow the journey — lazymac-mcp (42 tools, one MCP install) · lazymac-k-mcp (Korean wedge) · lazymac-sdk (TS client) · api.lazy-mac.com · Pro $29/mo.

![npm](https://www.npmjs.com/package/@lazymac/mcp) ![Smithery](https://smithery.ai/server/lazymac/mcp) ![lazymac Pro](https://coindany.gumroad.com/l/zlewvz) ![api.lazy-mac.com](https://api.lazy-mac.com)

🚀 Want all 42 lazymac tools through ONE MCP install? npx -y @lazymac/mcp · Pro $29/mo for unlimited calls.

The world's first AI model cost estimation API.

Calculate, compare, and optimize your AI spending across every major provider -- Anthropic, OpenAI, Google, Meta, and Mistral -- with a single API call.

No other product does this. Every AI startup, developer, and enterprise building on LLMs needs to understand and control their costs. This API makes that trivial.

Why This Exists

  • There is no unified API to calculate AI model costs across providers.
  • Pricing pages are scattered, inconsistent, and change frequently.
  • Developers waste hours building internal cost-tracking spreadsheets.
  • Finance teams have no programmatic way to forecast AI budgets.

This API solves all of that.

Features

  • Instant cost calculation for any model + token count
  • Monthly cost estimation from daily usage patterns
  • Cross-provider comparison sorted cheapest-first with savings analysis
  • Budget-aware model finder -- find the best model under your cost ceiling
  • Token estimation from raw text
  • Batch vs standard pricing where providers offer discounts
  • MCP server for integration with AI assistants (Claude, etc.)
  • 15 models across 5 providers, updated regularly

Quick Start

npm install
npm start
# Server runs on http://localhost:5000

API Endpoints

Calculate Cost

curl -X POST http://localhost:5000/api/v1/calculate \
  -H "Content-Type: application/json" \
  -d '{"model":"claude-sonnet-4","input_tokens":1000,"output_tokens":500}'

Monthly Estimate

curl -X POST http://localhost:5000/api/v1/estimate \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-4o","requests_per_day":1000,"avg_input_tokens":2000,"avg_output_tokens":500}'

Compare All Models

curl -X POST http://localhost:5000/api/v1/compare \
  -H "Content-Type: application/json" \
  -d '{"input_tokens":5000,"output_tokens":1000}'

Find Cheapest Model

curl "http://localhost:5000/api/v1/cheapest?input_tokens=1000&output_tokens=500&budget=0.01"

List All Models

curl http://localhost:5000/api/v1/models

List by Provider

curl http://localhost:5000/api/v1/models/anthropic

Estimate Tokens from Text

curl -X POST http://localhost:5000/api/v1/tokens \
  -H "Content-Type: application/json" \
  -d '{"text":"How much would it cost to process this sentence?"}'

MCP Server

Use with Claude Desktop or any MCP-compatible client:

{
  "mcpServers": {
    "ai-cost-calculator": {
      "command": "node",
      "args": ["src/mcp-server.js"]
    }
  }
}

Supported Models

| Provider | Model | Input $/MTok | Output $/MTok | |----------|-------|-------------|---------------| | Anthropic | Claude Opus 4 | $15.00 | $75.00 | | Anthropic | Claude Sonnet 4 | $3.00 | $15.00 | | Anthropic | Claude Haiku 3.5 | $0.80 | $4.00 | | OpenAI | GPT-4o | $2.50 | $10.00 | | OpenAI | GPT-4o Mini | $0.15 | $0.60 | | OpenAI | GPT-4 Turbo | $10.00 | $30.00 | | OpenAI | o1 | $15.00 | $60.00 | | OpenAI | o3-mini | $1.10 | $4.40 | | Google | Gemini 2.0 Flash | $0.10 | $0.40 | | Google | Gemini 1.5 Pro | $1.25 | $5.00 | | Meta | Llama 3.1 405B | $3.00 | $3.00 | | Meta | Llama 3.1 70B | $0.70 | $0.80 | | Mistral | Mistral Large | $2.00 | $6.00 | | Mistral | Mistral Small | $0.20 | $0.60 |

Docker

docker build -t ai-cost-calculator-api .
docker run -p 5000:5000 ai-cost-calculator-api

License

MIT

Related projects

<sub>💡 Host your own stack? <a href="https://m.do.co/c/c8c07a9d3273">Get $200 DigitalOcean credit</a> via lazymac referral link.</sub>

See related servers & alternatives →

Related MCP servers

Browse all →

Related guides

Hand-picked reading to help you choose and use AI & ML servers.