"How much will this GPT-4o call cost?" If you've asked this while building an AI app, this API is for you. It calculates token costs across Claude, GPT-4o, Gemini, Llama, and Mistral models — with real pricing data updated weekly.
Try It Right Now
curl -s -X POST https://api.lazy-mac.com/ai-cost/api/v1/calculate \
-H "Content-Type: application/json" \
-d '{"model": "gpt-4o", "input_tokens": 1000, "output_tokens": 500}' | jq
Response:
{
"model": "gpt-4o",
"provider": "openai",
"input_tokens": 1000,
"output_tokens": 500,
"input_cost_usd": 0.0025,
"output_cost_usd": 0.005,
"total_cost_usd": 0.0075,
"rates": {
"input_per_mtok": 2.5,
"output_per_mtok": 10
}
}
All Endpoints
| Endpoint | Description |
|---|---|
POST /api/v1/calculate |
Calculate cost for a specific model |
POST /api/v1/estimate |
Estimate from text length |
POST /api/v1/compare |
Compare costs across models |
GET /api/v1/cheapest?input_tokens=N&output_tokens=N |
Find cheapest model |
GET /api/v1/models |
List all 14 supported models |
GET /api/v1/models/:provider |
Models by provider |
Find the Cheapest Model
curl -s "https://api.lazy-mac.com/ai-cost/api/v1/cheapest?input_tokens=10000&output_tokens=5000" | jq
Compare Claude vs GPT-4o
curl -s -X POST https://api.lazy-mac.com/ai-cost/api/v1/compare \
-H "Content-Type: application/json" \
-d '{"models": ["claude-opus-4", "gpt-4o"], "input_tokens": 10000, "output_tokens": 2000}' | jq
Use as an MCP Server
Ask Claude: "How much would 10K tokens cost on GPT-4o vs Claude Sonnet?"
{
"mcpServers": {
"ai-cost": {
"url": "https://api.lazy-mac.com/ai-cost/mcp"
}
}
}
Supported Models (14 total)
Anthropic (Claude Opus 4, Sonnet 4, Haiku 3.5), OpenAI (GPT-4o, GPT-4o-mini, o1, o3-mini), Google (Gemini 2.0 Flash, Gemini 1.5 Pro), Meta (Llama 3.3 70B), Mistral (Large, Small).
Pricing
| Tier | Requests/mo | Price |
|---|---|---|
| Free | 100 | $0 |
| Pro | 10,000 | $9/mo |
| Business | Unlimited | $49/mo |
Browse all 22 APIs at api.lazy-mac.com →
More from the lazymac API Toolkit:
- Text Analysis API — Sentiment and readability scoring
- Crypto Trading Signals API — Live trading signals
- Fake Data Generator API — Realistic test data
Top comments (0)