Give your agent a token calculator
Seven tools over MCP and a JSON API. Free, no account.
MCP endpoint
https://tokencalc.io/mcpStreamable HTTP, stateless. Works with clients on the 2026-07-28 revision and on the 2025 revisions.
Add it to your client
Claude Code
claude mcp add --transport http tokencalc https://tokencalc.io/mcp.mcp.json
{
"mcpServers": {
"tokencalc": {
"type": "http",
"url": "https://tokencalc.io/mcp"
}
}
}In any other client, add a remote server (Streamable HTTP) with the address above.
Tools
| Name | What it does |
|---|---|
list_models | Models with context windows, prices per 1M tokens, announced price changes and how tokens are counted. |
count_tokens | Token count of a text for up to 10 models, with the method and error band per model. |
estimate_cost | Cost per call and per month, with caching, batch and long-context prices. |
compare_models | Models ranked by cost for the same text or token count. |
fit_context | Whether a prompt fits each context window with room for the answer. |
caching_breakeven | Saving from prompt caching and the number of reuses at which it pays back. |
optimize_prompt | Deterministic rewrites of a prompt with measured token savings. |
JSON API
The same functions as plain HTTP endpoints, described in OpenAPI 3.1. /openapi.json
Example call
curl -s https://tokencalc.io/api/v1/count \
-H 'content-type: application/json' \
-d '{"text":"How many tokens is this?","models":["gpt-6.1-sol","claude-sonnet-5-5","llama-3.3-70b"]}'Limits and privacy
60 requests a minute without a key. Text up to 512 KB per request. Request text is never stored or logged. Exact vendor counts need a key.
Ask for a free key
A key raises the limit to 600 requests a minute and switches on exact vendor counts.