Programming · Tool

LLM API Cost Calculator

Estimate monthly API cost for any LLM workload across Anthropic and OpenAI models. Includes prompt-cache and batch-API math so you see what you actually pay — not just the headline rate.

EndpointPOST /v1/programming-dev/llm-api-cost-calculatorVersionv1.0.0Added2026-05-17

Inputs

modelenumModel
default "anthropic/claude-sonnet-4.6" · one of: anthropic/claude-opus-4.7, anthropic/claude-sonnet-4.6, anthropic/claude-haiku-4.5, openai/gpt-5.5, openai/gpt-5.4, openai/gpt-5.4-mini, openai/gpt-5.4-nano, openai/gpt-5, openai/gpt-5-mini, openai/gpt-4.1, openai/gpt-4.1-mini, openai/gpt-4o-mini
Provider/model. Per-Mtok rates baked in — see pricing_as_of for freshness.
input_tokens_per_callRequiredinteger (tok)Input Tokens / Call
required · min 1 · max 1000000 · default 2000
Average prompt size: system + user + retrieved context combined.
output_tokens_per_callRequiredinteger (tok)Output Tokens / Call
required · min 1 · max 1000000 · default 500
calls_per_monthRequiredintegerCalls / Month
required · min 1 · max 1000000000 · default 100000
cached_input_fractionnumberCached Input Fraction
min 0 · max 1 · default 0
Share of input tokens served from prompt cache (0 = no cache, 1 = fully cached). Anthropic and GPT-5.x get ~90% off cache reads; GPT-4o-class get 50% off.
use_batch_apibooleanUse Batch API
default false
Both providers offer 50% off both rates for async batch jobs.

Outputs

model_namestringModel
providerstringProvider
monthly_cost_usdnumber ($)Monthly Cost
cost_per_call_usdnumber ($)Cost per Call
input_cost_monthly_usdnumber ($)Input Cost / mo
output_cost_monthly_usdnumber ($)Output Cost / mo
monthly_cost_no_optim_usdnumber ($)Without Cache or Batch
cache_savings_usdnumber ($)Cache Savings / mo
batch_savings_usdnumber ($)Batch Savings / mo
effective_input_rate_per_mtoknumber ($/Mtok)Effective Input Rate
effective_output_rate_per_mtoknumber ($/Mtok)Effective Output Rate
pricing_as_ofstringPricing as of

Example request

curl · POST /v1/programming-dev/llm-api-cost-calculator
curl -X POST https://api.toolsamurai.com/v1/programming-dev/llm-api-cost-calculator \
  -H "Authorization: Bearer sk_free_•••••••••••••••" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "anthropic/claude-sonnet-4.6",
  "input_tokens_per_call": 2000,
  "output_tokens_per_call": 500,
  "calls_per_month": 100000,
  "cached_input_fraction": 0,
  "use_batch_api": false
}'

Example response

200 OK
{
  "ok": true,
  "tool": "llm-api-cost-calculator",
  "domain": "programming-dev",
  "version": "1.0.0",
  "result": {
    "model_name": "…",
    "provider": "…",
    "monthly_cost_usd": ,
    "cost_per_call_usd": ,
    "input_cost_monthly_usd": ,
    "output_cost_monthly_usd": ,
    "monthly_cost_no_optim_usd": ,
    "cache_savings_usd": ,
    "batch_savings_usd": ,
    "effective_input_rate_per_mtok": ,
    "effective_output_rate_per_mtok": ,
    "pricing_as_of": "…"
  },
  "meta": { "latency_ms": , "request_id": "req_…" }
}

Tags

llmopenaianthropiccostapi-pricingtokensprompt-cachebatch-apigptclaude