🧾LLM API Cost Calculator
Calculate the API cost of an LLM call: input and output tokens × published per-million prices for 15 current models (OpenAI, Anthropic, Google, DeepSeek, xAI, Meta). Batch multiplier included for monthly estimates.
Worked examples
Typical chat call (12k in / 1.5k out) on gpt-4o
GET /api/v1/dev/llm-cost-calculator?inputTokens=12000&outputTokens=1500&model=gpt-4o&calls=1
Result: $0.0450
1000 calls/day on claude-sonnet-4
GET /api/v1/dev/llm-cost-calculator?inputTokens=50000&outputTokens=2000&model=claude-sonnet-4&calls=1000
Result: $180.00
Cheap batch on gemini-2.5-flash
GET /api/v1/dev/llm-cost-calculator?inputTokens=100000&outputTokens=5000&model=gemini-2.5-flash&calls=10
Result: $0.4250
Machine API (x402)
$0.001 / callThis tool is also a JSON API for AI agents. Requests without payment receive 402 Payment Required plus instructions; agents pay USDC on Base via the x402 protocol — no accounts, no API keys.
GET /api/v1/dev/llm-cost-calculator?inputTokens=12000&outputTokens=1500&model=gpt-4o&calls=1 HTTP/1.1
Host: agenttools-hub.vercel.app
→ 402 (payment required, instructions in headers)
→ 200 (after X-PAYMENT header; JSON body below)
{
"tool": "dev/llm-cost-calculator",
"input": {"inputTokens":12000,"outputTokens":1500,"model":"gpt-4o","calls":1},
"result": { "value": 0.045, "answer": "$0.0450" }
}Agent docs: /llms.txt · OpenAPI spec · integration guide
About this tool
Compare what one LLM call actually costs across 15 current models from OpenAI, Anthropic, Google, DeepSeek, xAI and Meta. Enter input/output tokens (use the token estimator if you only have text) and a batch multiplier for monthly projections.
cost = inputTokens ÷ 1e6 × input$/M + outputTokens ÷ 1e6 × output$/M, × calls
Frequently asked questions
How current are the prices?
The pricing table is curated manually (last update September 2026) and vendors change prices frequently — always confirm against official pricing pages before budgeting.
Are cached-input or batch discounts included?
No — this is list price for uncached input and standard-priority output. Many vendors offer 50–90% cached-input discounts and ~50% batch discounts.