If you're building a cost dashboard, automating budget reports, or integrating AI cost estimation into your product, you need programmatic access to pricing data and cost calculations.
APIpulse now offers two free calculator APIs alongside the existing pricing data API:
/api/calculate— Calculate costs for one or more models with your exact usage parameters/api/cheapest— Find the cheapest model for your use case, budget, or quality requirements
Both endpoints are free, require no API key, and support CORS for direct browser usage.
Calculate Costs for Any Model
The /api/calculate endpoint takes your token counts, request volume, and time period, then returns per-request, daily, monthly, and annual cost estimates.
# Single model — GPT-5 with 2K input / 500 output tokens, 1000 requests/day, 30 days
curl "https://getapipulse.com/api/calculate?model=openai-gpt5&input_tokens=2000&output_tokens=500&requests=1000&days=30"
Response:
{
"model": "openai-gpt5",
"name": "GPT-5",
"provider": "OpenAI",
"pricing": { "input_per_1m": 1.25, "output_per_1m": 10.00 },
"costs": {
"per_request": 0.0075,
"per_1k_requests": 7.5,
"daily": 7.5,
"monthly": 225.0,
"annual": 2700.0
},
"mode": "standard"
}
Compare Multiple Models at Once
Pass a comma-separated list of model IDs to get a side-by-side comparison, automatically sorted by cost:
curl "https://getapipulse.com/api/calculate?models=openai-gpt5,anthropic-sonnet46,deepseek-v4-pro,google-flash&input_tokens=3000&output_tokens=1000&requests=5000"
Returns all models ranked by monthly cost, with the cheapest flagged:
{
"results": [
{ "name": "Gemini 2.0 Flash", "costs": { "monthly": 120.0 } },
{ "name": "DeepSeek V4 Pro", "costs": { "monthly": 1966.5 } },
{ "name": "GPT-5", "costs": { "monthly": 4500.0 } },
{ "name": "Claude Sonnet 4.6", "costs": { "monthly": 6750.0 } }
],
"cheapest": { "name": "Gemini 2.0 Flash", "monthly": 120.0 }
}
Batch and Streaming Modes
API costs vary by delivery mode. The API supports three modes via the mode parameter:
| Mode | Parameter | Effect |
|---|---|---|
| Standard | mode=standard (default) | Normal pricing |
| Streaming | mode=streaming | +15% output tokens (real-world overhead) |
| Batch | mode=batch | 50% discount (OpenAI Batch API pricing) |
# Estimate costs with OpenAI's Batch API (50% off)
curl "https://getapipulse.com/api/calculate?model=openai-gpt5&requests=10000&mode=batch"
Find the Cheapest Model
The /api/cheapest endpoint is designed for one question: "What's the cheapest model that fits my needs?"
By Budget
# What can I get for $50/month with 10K requests/day?
curl "https://getapipulse.com/api/cheapest?budget=50&requests=10000"
By Use Case
# Best models for coding tasks
curl "https://getapipulse.com/api/cheapest?use_case=coding"
# Best models for chat, budget tier only
curl "https://getapipulse.com/api/cheapest?use_case=chat&quality=budget"
By Cost Per Request
# Models that cost less than $0.01 per request
curl "https://getapipulse.com/api/cheapest?max_cost_per_request=0.01"
JavaScript Integration
// Estimate costs for your workload
async function estimateCost(modelId, monthlyRequests) {
const url = `https://getapipulse.com/api/calculate?model=${modelId}&requests=${monthlyRequests / 30}&days=30`;
const res = await fetch(url);
const data = await res.json();
return data.costs.monthly;
}
// Find cheapest model under budget
async function findCheapest(budget, requests) {
const res = await fetch(
`https://getapipulse.com/api/cheapest?budget=${budget}&requests=${requests}`
);
const data = await res.json();
return data.recommendations[0];
}
Python Integration
import requests
# Compare 5 models for a 50K request/day workload
r = requests.get("https://getapipulse.com/api/calculate", params={
"models": "openai-gpt5,anthropic-sonnet46,deepseek-v4-pro,google-flash,mistral-large",
"input_tokens": 3000,
"output_tokens": 1000,
"requests": 50000
})
data = r.json()
for m in data["results"]:
print(f"{m['name']:25s} ${m['costs']['monthly']:>10,.2f}/mo")
print(f"\nCheapest: {data['cheapest']['name']} at ${data['cheapest']['monthly']:,.2f}/mo")
All 34 Supported Models
| Provider | Model ID | Price (Input/Output per 1M) |
|---|---|---|
| OpenAI | openai-gpt55 | $5.00 / $30.00 |
| OpenAI | openai-gpt5 | $1.25 / $10.00 |
| OpenAI | openai-gpt5-mini | $0.25 / $2.00 |
| OpenAI | openai-gpt4o-mini | $0.15 / $0.60 |
| Anthropic | anthropic-sonnet46 | $3.00 / $15.00 |
| Anthropic | anthropic-haiku | $1.00 / $5.00 |
google-flash | $0.10 / $0.40 | |
google-flash-lite | $0.075 / $0.30 | |
| DeepSeek | deepseek-v4-flash | $0.14 / $0.28 |
| Mistral | mistral-small | $0.15 / $0.60 |
| Meta | llama-4-scout | $0.11 / $0.34 |
| ...and 22 more. Full list in API docs. | ||
Why Use a Cost Calculator API?
Budget Planning — Feed your actual usage data to get accurate monthly projections before committing to a provider.
Model Selection — Programmatically pick the cheapest model that meets your quality requirements. Run the comparison in CI/CD.
Cost Dashboards — Embed cost estimates in internal tools. Show stakeholders real numbers, not guesses.
Startup Budgeting — Compare all 34 models in one API call. Find the option that fits your runway.
API Reference
| Endpoint | Method | Description |
|---|---|---|
/api/calculate | GET | Calculate costs for one or more models |
/api/cheapest | GET | Find cheapest models by use case, budget, or quality |
/api/pricing | GET | Raw pricing data for all 34 models |
Full documentation with all parameters: getapipulse.com/api-docs.html
Try the Interactive Calculator
Prefer a visual interface? Our web calculator has the same data with charts, presets, and one-click model comparison.
Open Cost Calculator →