cd /news/developer-tools/ai-api-costs-are-surprising-people-h… · home topics developer-tools article
[ARTICLE · art-97273] src=dev.to ↗ pub= topic=developer-tools verified=true sentiment=· neutral

AI API Costs Are Surprising People — Here's How to Check First

A developer built a free browser-based token counter that handles OpenAI, Anthropic, and Google models, providing exact or estimated token counts and custom pricing. The tool aims to help developers avoid surprise API costs by understanding token usage before sending requests. The developer emphasizes that most token counters are inaccurate and that output tokens are often overlooked.

read2 min views1 publishedAug 14, 2026

You're building something with the OpenAI or Anthropic API.

It's working well. Then you check your usage dashboard and

the number is... not what you expected.

This happens to almost everyone who builds with AI APIs for

the first time. Not because the pricing is hidden - it's

published clearly - but because tokens are not an intuitive

unit of measurement, and the costs compound in ways that

aren't obvious until you're already past them.

Tokens aren't words. They aren't characters. They're chunks

of text a model's tokenizer splits your input into, and the

exact split depends on the model.

Rough rules of thumb:

The same sentence can be a different number of tokens

depending on which model you're using. This is normal and

expected.

Most people focus on input cost (your prompt) and forget

about output cost (the completion). This is a mistake because:

Most AI token counters claim to give you an exact count for

any model. Most are lying, or at best, guessing.

Exact token counts are only possible when you have access to

the model's actual tokenizer. Today that means:

A tool that claims to give you an exact Claude token count

is giving you a confident approximation. That's fine as long

as it's honest about it. Most aren't.

Three things worth knowing before you send:

Show how each of these plays out differently across GPT-4o,

Claude Sonnet 4, and Gemini 2.5 Flash using the same prompt.

"I built a free token counter that handles all three major

providers, is upfront about which counts are exact vs.

estimated, and lets you add custom pricing if the built-in

table is out of date. No signup, runs entirely in your browser."

| Model | Context Window | Input (per 1M) | Output (per 1M) |
|---|---|---|---|

| GPT-4o | 128K tokens | $2.50 | $10.00 | | GPT-4o mini | 128K tokens | $0.15 | $0.60 | | Claude Opus 4 | 200K tokens | $15.00 | $75.00 | | Claude Sonnet 4 | 200K tokens | $3.00 | $15.00 | | Gemini 2.5 Pro | 1M tokens | $1.25 | $10.00 | | Gemini 2.5 Flash | 1M tokens | $0.075 | $0.30 |

Prices change. Check the calculator for the most current

verified rates.

Knowing your token count before you send doesn't just save

money on individual calls. It changes how you think about

prompt design - you start making deliberate tradeoffs between

context richness and cost, which makes you a better AI

application builder.

── more in #developer-tools 4 stories · sorted by recency
── more on @openai 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/ai-api-costs-are-sur…] indexed:0 read:2min 2026-08-14 ·