API & MCP

Everything a person can do on LLM Cost Explorer, a program or AI agent can do with the same inputs and get the identical result.

HTTP API

LLM Cost Explorer

Calculates what an LLM workload costs per request and per month on each model – requests per day, input and output tokens, the share of the prompt that can be cached, cache hit rate and batch discounts – using live prices from OpenRouter's public models API, a pasted copy of it, or prices you enter. Shows caching and batch savings, the cheapest models that fit your context and budget, and a cost comparison chart.

Inputs of LLM Cost Explorer
FieldTypeDefaultDescription
priceSourceselect (manual, openrouter, paste)"manual"Prices from
pricestable—Model prices (USD per 1M tokens)
modelIdslist—OpenRouter model ids. e.g. openai/gpt-4o-mini – one per line. Empty in paste mode = all pasted models.
modelsJsontextarea—OpenRouter models JSON
requestsPerDay (required)number1000Requests per day
inputTokens (required)integer2000Input tokens per request
outputTokens (required)integer500Output tokens per request
cacheablePctnumber0Cacheable prompt prefix. Share of input tokens that repeat across requests (system prompt, tools, documents).
cacheHitRatenumber80Cache hit rate
batchSharePctnumber0Share of requests sent via batch API
batchDiscountPctnumber50Batch discount
daysPerMonthnumber30.4Days per month
budgetnumber—Monthly budget (optional)

Example request

Support bot: 5,000 requests/day, cached system prompt (example prices you entered)

curl -X POST https://llmcostexplorer.usefulweb.site/api/v1/calculate -H 'content-type: application/json' -d '{"priceSource":"manual","prices":[{"model":"Large model (example)","inputPerM":3,"outputPerM":15,"cacheReadPerM":0.3,"cacheWritePerM":3.75,"contextTokens":200000},{"model":"Mid model (example)","inputPerM":0.4,"outputPerM":1.6,"cacheReadPerM":0.1,"contextTokens":1000000},{"model":"Small model (example)","inputPerM":0.1,"outputPerM":0.4,"contextTokens":8000}],"requestsPerDay":5000,"inputTokens":12000,"outputTokens":400,"cacheablePct":75,"cacheHitRate":90,"budget":2000}'

Every result contains

inputs (normalised, defaults applied), summary, result (validated against the published schema), units, assumptions, sources, warnings, computedAt and links.

MCP (Model Context Protocol)

{
  "mcpServers": {
    "llm-cost-explorer": { "type": "http", "url": "https://llmcostexplorer.usefulweb.site/mcp" }
  }
}