LLM Token & API Cost Calculator

Estimate prompt BPE tokens, context window usage, and per-request / monthly API cost (USD & BRL) across Gemini, Claude, OpenAI, and DeepSeek.

Sample prompt / text (for live token estimation)
Input tokens
Output tokens
Prompt cache hit (%)
Requests per day
USD/BRL exchange rate
Prompt estimate~34 tokens (131 chars, 22 words)
ModelContextUSD / ReqUSD / MonthBRL / Month
Gemini 2.5 Pro (Google)0.5% (1049k)$0.0141$84.36R$449.64
Gemini 2.5 Flash (Google)0.5% (1049k)$0.0035$20.85R$111.13
Gemini 2.5 Flash-Lite (Google)0.5% (1049k)$0.0007$4.35R$23.19
Claude Sonnet 4.6 (Anthropic)2.5% (200k)$0.0243$145.80R$777.11
Claude Opus 4.6 (Anthropic)2.5% (200k)$0.1215$729.00R$3,885.57
Claude Haiku 4.5 (Anthropic)2.5% (200k)$0.0065$38.88R$207.23
GPT-4.1 (OpenAI)0.5% (1048k)$0.0145$87.00R$463.71
GPT-4.1 mini (OpenAI)0.5% (1048k)$0.0029$17.40R$92.74
OpenAI o3 (OpenAI)2.5% (200k)$0.0145$87.00R$463.71
DeepSeek V3 (DeepSeek)3.9% (128k)$0.0020$11.88R$63.32
Use from the terminal (JSON)

This tool also runs outside the site: the cli.js script uses the same logic as this page and returns the result as JSON. Parameters are the same as this page's URL — copy the command below with the values on screen.

Deno
deno run -q "https://tools.thecodecodex.com/cli.js?tool=llm-cost"
Node.js / Bun
curl -s https://tools.thecodecodex.com/cli.js | node --input-type=module - llm-cost in=…
ParameterDescriptionDefault
intokens de entrada por requisição4000
outtokens de saída por requisição1000
cachefração de entrada em cache (0 a 1)0.5
reqrequisições por dia100
texttexto opcional para estimar tokens automaticamente—

Requires Deno, Node.js or Bun. With Deno the script runs with no permissions: it cannot read files or access the network. Central Bank indicators are from the day the site was published.

More in AI