induwara.lk
induwara.lkAI · Developer cost

Function Calling / Tool-Use Token Cost Calculator

Paste your tool definitions and see the hidden cost of re-sending them on every LLM API call — per model, with and without prompt caching, plus the saving from trimming verbose schemas. Counts run in your browser; no API key, no signup.

By Induwara AshinsanaUpdated Jun 19, 2026
Tool-use token cost
Anthropic-verified rate
loading tokenizer…

Paste the exact tools array you send on every request (Anthropic or OpenAI shape). Counted in your browser with gpt-tokenizer — nothing is uploaded.

How many API requests you make in a month.

Average input tokens per call, excluding tool definitions.

Average visible output tokens per call.

Claude Sonnet 4.6 cache-read rate: $0.3/1M.

Monthly tool-def cost
$0.00
without caching
Per-call overhead
0 tok
= $0.00/call (no cache)
Share of input bill
0%
tools vs conversation (no cache)
Caching could save
$0.00
per month vs full input rate

Paste a tool definition above to see its per-call token overhead and monthly cost.

Same tools, every model

ModelInput $/1MMonthly (no cache)Monthly (cached)
Claude Opus 4.8$5$0.00$0.00
Claude Sonnet 4.6selected$3$0.00$0.00
Claude Haiku 4.5$1$0.00$0.00
Fable 5$10$0.00$0.00
GPT-5list price$1.25$0.00$0.00
GPT-4olist price$2.5$0.00$0.00
GPT-4o minilist price$0.15$0.00$0.00
Gemini 3 Prolist price$1.25$0.00$0.00
Gemini 3 Flashlist price$0.3$0.00$0.00

Identical token count priced across tiers — this isolates the price spread. Cached column uses each model's cache-read rate.

Trim simulator

Target per-call tool-definition tokens after trimming.

Monthly saving
$0.00
0% less · new cost $0.00/mo
Tool/function definitions are serialized into the request and billed as input tokenson every call (Anthropic token-counting API; OpenAI cookbook). Token counts are in-browser estimates (gpt-tokenizer / cl100k_base); Anthropic's own tokenizer counts ~10–15% higher, so for an exact Claude figure use its count_tokens endpoint. Anthropic prices are cross-checked; OpenAI/Gemini are published list prices that change without notice. Rates last verified 2026-06-19. Full sources are listed below the calculator.

How it works

Large language models are stateless, so the full set of tool (function) definitions you give a model is serialized into the request and re-sent on every single call. Those definitions are billed as input tokens: Anthropic's token-counting API returns input counts that include the tools array, and OpenAI's token-counting cookbook documents that function definitions are injected into the prompt and counted as input. A schema that looks trivial can quietly dominate your bill once it is multiplied across high call volume.

The calculator works in four steps:

  1. Count tool-definition tokens.Your pasted JSON is tokenized in the browser with gpt-tokenizer (the JavaScript port of OpenAI's tiktoken, cl100k_base) to get the per-call overhead, plus a per-tool breakdown so you can spot the bloated one.
  2. Project monthly tokens. Per-call tool tokens × calls per month gives the monthly tool-definition input tokens.
  3. Apply the price. Monthly cost = tool_tokens × calls ÷ 1,000,000 × input_$/1M. With prompt caching, the stable tools prefix bills at the cache-read rate (≈0.1× the input rate on Anthropic) instead, which the caching toggle applies.
  4. Compare and trim. The same token count is priced across every model so you see the pure price spread, and the trim simulator shows the monthly saving from cutting your schemas to a target size.

The share of input billfigure divides the tool-definition cost by the total input cost (tool definitions + conversation), both at the full input rate, so you can see what fraction of your input spend is just re-sent definitions. Token counts are in-browser estimates — Anthropic's own tokenizer counts about 10–15% higher on the same JSON, so for a Claude figure to the token use Anthropic's count_tokens endpoint. The dollar arithmetic is exact for whatever token count you supply, and every monthly figure is cross-checked by an independent per-call calculation.

Worked examples

Support agent, 8 tools, Claude Sonnet 4.6

  1. Tool definitions: 1,200 tokens/call; 100,000 calls/month; input $3/1M.
  2. Monthly tool tokens: 1,200 × 100,000 = 120,000,000 (120 MTok)
  3. Cost (no caching): 120 × $3 = $360.00/month
  4. With prompt caching (0.1× → $0.30/1M): 120 × $0.30 = $36.00/month
  5. Caching saving: $360 − $36 = $324.00/month
  6. Conversation 1,500 tok/call: 150 × $3 = $450.00; tool share = 360 ÷ 810 = 44%

Trim the schemas (same workload)

  1. Cut verbose descriptions: 1,200 → 700 tokens/call; 100,000 calls; Sonnet $3/1M.
  2. Cost: 700 × 100,000 ÷ 1e6 × $3 = 70 × $3 = $210.00/month
  3. Saving vs un-trimmed: $360 − $210 = $150.00/month from trimming alone
  4. Add caching on the 700-token prefix: 70 × $0.30 = $21.00/month
  5. Trim + cache together: ~94% off the original $360.

Model spread (1,200 tokens, 100k calls, no caching)

  1. Same 1,200-token tools array, identical token count across models.
  2. Haiku 4.5 ($1/1M): 120 × $1 = $120/month
  3. Sonnet 4.6 ($3/1M): 120 × $3 = $360/month
  4. Opus 4.8 ($5/1M): 120 × $5 = $600/month
  5. Fable 5 ($10/1M): 120 × $10 = $1,200/month — a 10× spread for the same tools.

Frequently asked questions

Sources & references

Prices and the token-counting method were last cross-checked against the cited sources on 2026-06-19. Anthropic rates are verified against the Anthropic pricing page; OpenAI and Gemini rows are published list prices that change without notice. Token counts are in-browser estimates — for billing-exact Claude counts, use Anthropic's count_tokens endpoint.

Related tools

Rate this tool
Be the first to rate

Comments & feedback

Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.

Found a bug, edge case, or want to suggest an improvement?

Email me at [email protected] — most fixes ship within 24 hours.