AI Token Counter & API Cost Calculator

Estimate tokens and project API costs for GPT-4o, Claude 3.5, Gemini 1.5, and more.

Token Counter

Paste any text or code below. Estimation uses ~4 characters per token (~0.75 words per token).

Characters

0

Words

0

Estimated tokens

0

This is an approximation. Exact tokenization varies by model and tokenizer (BPE, SentencePiece, etc.). For production-critical counts, use the official tokenizer for your provider.

Model

Select a model to check context window fit and pricing.

Context window

128,000 tokens

Fit check

Fits within context

Cost Calculator

Auto-filled from your token count above. Toggle between input and output pricing.

0 tokens × $2.50 / 1M = $0.00 per request
VolumePer requestPer dayPer month (30 days)
Single request$0.00$0.00$0.00
100 requests/day$0.00$0.00$0.00
1,000 requests/day$0.00$0.00$0.00
10,000 requests/day$0.00$0.00$0.00

Pricing reference

Approximate pricing — always check official provider pages for latest rates.

ModelProviderContextInput / 1MOutput / 1M
GPT-4oOpenAI128,000$2.50$10.00
GPT-4 TurboOpenAI128,000$10.00$30.00
GPT-3.5 TurboOpenAI16,385$0.50$1.50
Claude 3.5 SonnetAnthropic200,000$3.00$15.00
Claude 3 OpusAnthropic200,000$15.00$75.00
Gemini 1.5 ProGoogle2,000,000$1.25$5.00

Understanding AI API pricing

AI providers bill per token — sub-word units the model reads and writes. A token is roughly 4 characters or 0.75 words of English, though code, punctuation, and non-Latin scripts can shift that ratio significantly.

Input tokens cover everything you send: system prompt, conversation history, user message, tool definitions, and retrieved context. Output tokens are what the model generates. Output is typically 2–5× more expensive than input.

The context window is the hard cap on input + output tokens for a single request. Long conversations grow linearly because every prior turn is resent — caching and summarization keep costs in check.

To control spend: cap max_tokens, trim system prompts, route easy traffic to cheaper models, and cache repeated context where the provider supports it.

Frequently asked questions