How to estimate AI API costs
1. Count tokens, not words
AI models bill by tokens, small chunks of text produced by each provider's tokenizer. For English, a token is about 4 characters or three-quarters of a word, so 1,000 words is roughly 1,333 tokens. Code, JSON and non-Latin scripts usually take more tokens per word. Tokenizers also differ between providers and model generations, so measure a few real requests from your usage logs when you can.
| Word Count | Estimated English Tokens | Estimated Code / JSON Tokens | Typical Document Equivalent |
|---|---|---|---|
| 500 words | ~667 tokens | ~900 tokens | 1-page memo or short email |
| 1,000 words | ~1,333 tokens | ~1,800 tokens | Standard blog post or product spec |
| 2,500 words | ~3,333 tokens | ~4,500 tokens | In-depth research paper or agreement |
| 10,000 words | ~13,333 tokens | ~18,000 tokens | Technical manual or quarterly report |
| 50,000 words | ~66,667 tokens | ~90,000 tokens | Full-length novel or codebase repo |
2. Split input and output
Every request has input tokens (instructions, conversation history, documents and the user's message) and output tokens (the reply). On most models output costs 3× to 5× more than input because output token generation is autoregressive and sequential. Reasoning models also bill their hidden "thinking" tokens as output, so long chains of thought can dominate the bill.
3. Reuse repeated text with prompt caching
If many requests start with the same text, such as a long system prompt, tool definitions or a reference document, providers can serve it from cache at a much lower rate. Published discounts on cached input: Anthropic 90–98%, OpenAI 50–95%, Google 90%, xAI (SpaceXSI) 75–85%, DeepSeek 97–98%, Mistral AI 90%, Z.ai 80–86%, Moonshot AI (Kimi) 80–90%, Meta 88–95% and Together AI 42–89%. Put stable content first and changing content (the user's message, timestamps) last, because any change near the start breaks the cache.
4. Reasoning tokens and chain-of-thought overhead
Next-generation reasoning models such as OpenAI o1, o3-mini and DeepSeek R1 allocate hidden "thinking" tokens to reason through complex problems before emitting their visible response. Providers bill every reasoning token at the full output rate ($60.00/1M on o1, $4.40/1M on o3-mini, $2.19/1M on DeepSeek R1). Because an intricate logic query might generate 3,000 to 10,000 hidden reasoning tokens for a concise 200-word answer, always account for this output multiplier when budgeting reasoning architectures.
5. Worked example
A support assistant handling 100,000 requests a month, with 1,500 input tokens and 350 output tokens per request and 70% of the input repeated, would cost about this on the latest models:
- Qwen3.7 Flash (Alibaba Cloud (Qwen)): $9.05/month
- Ministral 3 3B (Mistral AI): $18.50/month
- GPT-OSS 20B (Groq): $21.75/month
- …up to GPT-6 Astra: $2,305/month
The cheapest model is not automatically the right one. Test answer quality, speed and reliability on your own prompts, then price the models that pass. Open this example in the calculator.
6. Five architectural ways to lower the bill
- Route by difficulty. Send routine requests to a low-cost model and only hard ones to a premium model.
- Cap output. Set
max_tokensand ask for short answers. Output is the expensive side. - Trim context. Summarize old conversation turns and include only the passages you need, not whole documents.
- Structure prompts for caching. Keep the shared opening text identical across requests.
- Batch what can wait. Nightly tagging, extraction and evaluation jobs qualify for batch discounts where offered.
7. Multimodal token calculations (Vision & Audio in 2026)
Modern 2026 models process images, PDFs, and audio natively. Vision models (such as Claude 3.5 Sonnet, GPT-4o, and Gemini 2.0 Flash) calculate image costs based on resolution and tile count:
- Standard 1080p Image: Requires ~4 to 6 tiles of 512×512, converting to roughly 1,000 to 1,600 input tokens per image.
- High-Resolution Document (PDF page): A scanned document page rendered at 300 DPI consumes approximately 2,000 input tokens.
- Real-time Audio Input: Audio is billed at a premium (typically $10.00 to $40.00 per 1M audio tokens or roughly $0.06 per minute), making text transcription via Whisper or local speech models significantly more cost-effective before feeding into an LLM.
Step-by-Step: How to Calculate LLM Token Costs
Quantify Expected Monthly Request Volume
Estimate total API calls across all users. For internal tools, 10,000 requests/month is typical; consumer apps or support bots regularly scale to 100,000 to 500,000 calls monthly.
Measure Tokens per Request (1,000 words ≈ 1,333 tokens)
Calculate input footprint (system prompt, retrieved RAG documents, chat history) plus output tokens. Output tokens are 3× to 5× more expensive due to autoregressive generation.
Leverage Prompt Caching & Batch Asynchronous Discounts
Enable prompt caching for static instructions to save 50% to 98% on input. Route non-latency-sensitive background jobs through Batch APIs to slash invoices by an additional 50%.
Benchmark Model Tiers & Local Currency Totals
Compare low-cost models (Gemini Flash, DeepSeek V3) vs frontier reasoning models (Claude 3.5 Sonnet, OpenAI o1/o3-mini). Switch currencies (USD, EUR, GBP, INR, JPY) to review local engineering budgets.
Conversational Quick Answers
"Which AI model has the cheapest API in 2026?"
Gemini 2.0 Flash ($0.10/1M input) and DeepSeek V3 ($0.14/1M input) offer the cheapest API rates in 2026, delivering frontier performance at up to 94% lower cost than GPT-4o.
"How much do 1 million tokens cost?"
One million input tokens costs between $0.10 on budget models like Gemini Flash to $3.00 on Claude 3.5 Sonnet. Output tokens range from $0.28 to $15.00 per million tokens.
"How many tokens is a 1,000-word article?"
In standard English, 1,000 words equals approximately 1,333 tokens. The baseline conversion rule is 1 token equals 0.75 words or approximately 4 characters.
"How much does prompt caching save on LLM APIs?"
Prompt caching saves 50% to 98% on input token costs on repeated context across DeepSeek (98%), Anthropic (90%), OpenAI (50-95%), and Google Cloud (90%).
Cite this Calculator & Methodology
If you reference this tool in research papers, architecture decision records (ADRs), or technical articles, use the attribution below:
Pricing data sourced directly from official documentation published by OpenAI, Anthropic, Google Cloud, DeepSeek, xAI, Mistral AI, and Groq.