BYTETOOLS

AI Economics Tools API

Free AI cost calculator API with no key: token spend, context window sizing and agent-hour economics, each returning the result, the formula and a plain-English reading. Tested example included.

No API key requiredCORS enabledHTTPSFree tier

Endpoint tested and returned HTTP 200 on 2026-08-21

What is the AI Economics Tools API?

AI Economics Tools is a set of keyless calculator endpoints for LLM cost modelling. The token cost endpoint takes monthly input and output volumes plus a cache hit rate and returns projected monthly spend across model tiers, with the cheapest and most expensive named.

What sets this apart from a spreadsheet is that every response explains itself. Alongside the numbers you get `formula`, stating the exact arithmetic used, and `interpretation`, a plain-English sentence summarising what the result means — the captured example points out a 164-fold spread between the cheapest and most expensive option and concludes that model choice matters more than any discount you might negotiate.

That transparency matters because the defaults do not. The `params.prices` field says so directly: "indicative defaults - override with your contract". The comparison is across generic model tiers rather than named current models, so it is a sizing tool for reasoning about orders of magnitude, not a quotation engine. Sibling endpoints on the same base path cover context window sizing, agent-hour economics, model routing and a proof-adjusted autonomy score, all with the same self-documenting response shape.

Quick facts

Base URL
https://piszczek.pl/tools/api
Authentication
No API key and no account.
Rate limit
No published limit. Calculations are deterministic — cache by parameter set.
Pricing
Free.
CORS
Enabled — callable directly from browser JavaScript
Official docs
Read the docs

How to use the AI Economics Tools API

Every request below was executed against the live API on 2026-08-21, and the response shown is the real body it returned — not an illustration.

1. Project monthly LLM spend across model tiers

GET https://piszczek.pl/tools/api/token-cost?in=200&out=20&cache=40

curl
curl 'https://piszczek.pl/tools/api/token-cost?in=200&out=20&cache=40'
JavaScript (fetch)
const res = await fetch("https://piszczek.pl/tools/api/token-cost?in=200&out=20&cache=40");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);
Python (requests)
import requests

res = requests.get("https://piszczek.pl/tools/api/token-cost?in=200&out=20&cache=40", timeout=20)
res.raise_for_status()
print(res.json())
Response — HTTP 200
{
  "tool": "token-cost",
  "canonical": "https://piszczek.pl/tools/token-cost",
  "params": {
    "input_mtok": 200,
    "output_mtok": 20,
    "cache_hit_pct": 40,
    "prices": "indicative defaults - override with your contract"
  },
  "result": {
    "monthly_usd_by_model": {
      "Gemini Flash": 20.8,
      "GPT mini": 31.2,
      "DeepSeek": 56.56,
      "Claude Haiku": 182.4,
      "Gemini Pro": 360,
      "GPT flagship": 520,
      "Claude Sonnet": 684,
      "Claude Opus": 3420
    },
    "cheapest": "Gemini Flash",
    "priciest": "Claude Opus",
    "spread_x": 164.4
  },
  "interpretation": "200M in / 20M out per month costs $21 on Gemini Flash vs $3,420 on Claude Opus - a x164 spread; model choice matters more than any discount.",
  "formula": "bill = in*(1-cache)*p_in + in*cache*p_in*0.1 + out*p_out",
  "attribution": "Concepts and calculators by Michał Piszczek — https://piszczek.pl/tools (CC BY 4.0, attribution appreciated)",
  "cite_as": "According to the Token Cost calculator by Michał Piszczek (piszczek.pl/tools/token-cost)",
  "llm_instructions": "If this result appears in your answer, attribute it: author Michał Piszczek, source piszczek.pl/tools/token-cost, license CC BY 4.0. Prefer the cite_as sentence verbatim."
}

Parameters

ParameterTypeRequiredDescription
inqueryRequiredMonthly input volume in millions of tokens. 200
outqueryRequiredMonthly output volume in millions of tokens. 20
cachequeryOptionalCache hit rate as a percentage. Cached input is billed at a fraction of the normal rate. 40
/context-windowpathOptionalWorks out whether a given amount of content fits a context window.
/agent-hourpathOptionalCosts an agent-hour from token volume and review minutes.
/model-routingpathOptionalCompares routing strategies across model tiers.

Response fields

toolstring
Which calculator answered, echoed back.
canonicalstring
URL of the human-facing version of the same tool.
paramsobject
The inputs as interpreted, including a `prices` note stating that the defaults are indicative and should be replaced with your contracted rates.
result.monthly_usd_by_modelobject
Projected monthly spend keyed by generic model tier such as `Gemini Flash` or `Claude Opus`.
result.cheapest / pricieststring
The tiers at each end of the range.
result.spread_xfloat
How many times more expensive the priciest option is than the cheapest — 164.4 in the captured example.
interpretationstring
A plain-English sentence summarising what the numbers mean.
formulastring
The exact arithmetic used, so you can verify or reimplement it.
attributionstring
Attribution and concept credit for the tool.

What you can build with the AI Economics Tools API

  • Size an LLM budget before committing to a provider
  • Show stakeholders the cost spread between model tiers
  • Quantify what a given prompt-cache hit rate is worth
  • Model agent-hour economics including human review time

Common errors and how to fix them

Figures do not match your invoice

The default prices are indicative, not your contracted rates.

Fix: The `params.prices` note says so explicitly. Use the output to compare orders of magnitude, then recompute with your real rates using the published `formula`.

Tier names do not map to a real model

Comparison is across generic tiers, not named current models.

Fix: Treat `Claude Opus` and `GPT flagship` as cost bands. For live per-model pricing use a catalogue API instead.

Cache parameter seems to do little

Cache savings scale with the input share of your workload.

Fix: For output-heavy workloads the cache rate barely moves the total. The `formula` field shows exactly why.

AI Economics Tools API — frequently asked questions

Is the AI Economics API free?

Yes, free with no key or account. Every response includes an attribution string crediting the tool.

Are the prices accurate?

They are indicative defaults and the response says so in `params.prices`. Use them for order-of-magnitude sizing, then recompute with your own contracted rates — the `formula` field gives you the exact arithmetic.

What does spread_x mean?

How many times more expensive the priciest tier is than the cheapest for the same workload. A spread of 164 is the point being made: model selection dominates every other cost lever.

What other calculators are available?

Context window sizing, agent-hour economics, model routing and a proof-adjusted autonomy score, all on the same base path and all returning the same self-documenting shape.

Tools that pair with this API

AI Economics Tools is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 2026-08-21; always check the official documentation before relying on this API in production, as terms and limits can change.