Why you need this
Tokens are how AI APIs charge you—but most people don't understand them until the bill arrives. This guide helps you estimate costs before you build, so there are no surprises.
Perfect for:
- Developers building AI-powered apps
- Product managers planning budgets for AI features
- Startups trying to avoid surprise API bills
- Anyone using AI APIs at scale
What's inside
Part 1: Understanding Tokens
What's a token?
- Visual examples showing how text splits into tokens
- "Hello world" = 2 tokens, "ChatGPT" = 2 tokens, "AI" = 1 token
- Why tokens ≠ words (and why it matters)
Token count rules of thumb:
- 1 token ≈ 4 characters (English)
- 1 token ≈ 0.75 words (average)
- 1,000 tokens ≈ 750 words
Part 2: The Cost Formula
Simple estimation formula:
Total Cost = (Input Tokens × Input Price) + (Output Tokens × Output Price)
Example calculation:
- Input: 500 tokens (your prompt)
- Output: 200 tokens (AI's response)
- Model: GPT-4 ($0.03 per 1K input, $0.06 per 1K output)
- Cost: (500 × $0.03/1000) + (200 × $0.06/1000) = $0.027 per request
Part 3: Real-World Pricing Table
Current API pricing (per 1,000 tokens) for:
- GPT-4 Turbo (OpenAI)
- GPT-3.5 Turbo (OpenAI)
- Claude 3.5 Sonnet (Anthropic)
- Claude 3 Haiku (Anthropic)
- Gemini 1.5 Pro (Google)
- Gemini 1.5 Flash (Google)
Part 4: Cost Optimization Tips
5 strategies to reduce your AI API bill:
- Use smaller models for simple tasks (e.g., Haiku instead of Opus)
- Shorten prompts without losing clarity
- Cache repetitive content (some APIs offer caching discounts)
- Limit output length with constraints in your prompt
- Batch requests instead of making many small calls
How to use it
- Before building: Estimate monthly costs based on expected usage
- During development: Track token usage to stay on budget
- When scaling: Optimize prompts and models to reduce per-request costs
- For pitches: Show investors or leadership realistic AI infrastructure costs
Example: Budgeting for a Chatbot
Scenario: Customer support chatbot for a small e-commerce site
- Expected usage: 1,000 conversations/month
- Average input: 200 tokens (user question + context)
- Average output: 150 tokens (AI response)
- Model: GPT-3.5 Turbo ($0.0015 input, $0.002 output per 1K tokens)
Calculation:
- Input cost: 1,000 × 200 × $0.0015/1000 = $0.30
- Output cost: 1,000 × 150 × $0.002/1000 = $0.30
- Total: ~$0.60/month
Insight: Even with 1,000 conversations, costs are negligible. You can afford to scale.
Want to go deeper?
This guide covers the essentials. For advanced cost optimization, latency tuning, and model selection:
- Cost & Latency Guide — Full guide to optimizing AI performance and budget
- Glossary: Token — Deep dive into how tokens work
- Glossary: API — Understanding programmatic AI access
License & Attribution
This resource is licensed under Creative Commons Attribution 4.0 (CC-BY). You're free to:
- Share with your team or clients
- Print for planning meetings
- Adapt the formula for your own tools
Just include this attribution:
"Token & Cost Calculator Guide" by Field Guide to AI (fieldguidetoai.com) is licensed under CC BY 4.0
Download now
Click below for instant access. No signup required.