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)
| Model | Context | USD / Req | USD / Month | BRL / Month |
|---|---|---|---|---|
| Gemini 2.5 Pro (Google) | 0.5% (1049k) | $0.0141 | $84.36 | R$449.64 |
| Gemini 2.5 Flash (Google) | 0.5% (1049k) | $0.0035 | $20.85 | R$111.13 |
| Gemini 2.5 Flash-Lite (Google) | 0.5% (1049k) | $0.0007 | $4.35 | R$23.19 |
| Claude Sonnet 4.6 (Anthropic) | 2.5% (200k) | $0.0243 | $145.80 | R$777.11 |
| Claude Opus 4.6 (Anthropic) | 2.5% (200k) | $0.1215 | $729.00 | R$3,885.57 |
| Claude Haiku 4.5 (Anthropic) | 2.5% (200k) | $0.0065 | $38.88 | R$207.23 |
| GPT-4.1 (OpenAI) | 0.5% (1048k) | $0.0145 | $87.00 | R$463.71 |
| GPT-4.1 mini (OpenAI) | 0.5% (1048k) | $0.0029 | $17.40 | R$92.74 |
| OpenAI o3 (OpenAI) | 2.5% (200k) | $0.0145 | $87.00 | R$463.71 |
| DeepSeek V3 (DeepSeek) | 3.9% (128k) | $0.0020 | $11.88 | R$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=…
| Parameter | Description | Default |
|---|---|---|
| in | tokens de entrada por requisição | 4000 |
| out | tokens de saída por requisição | 1000 |
| cache | fração de entrada em cache (0 a 1) | 0.5 |
| req | requisições por dia | 100 |
| text | texto 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.