← All Articles

Token Economics: What You’re Actually Paying For With AI APIs

Most people don’t understand what they’re paying for with the Claude API. They know it’s “$3 per million input tokens, $15 per million output tokens.” They know that sounds cheap. And compared to hiring someone to do the work manually, it is. But they don’t understand the actual mechanics or how to estimate costs, so they end up spending 2-3x more than they need to.

I'm going to change that.

The Basics: What's a Token?

A token is roughly a word, or a few characters. The exact count varies depending on the text.

"Hello, world!" = 3 tokens "The quick brown fox jumps over the lazy dog." = 9 tokens

Claude's tokenizer is conservative. Complex words, numbers, and special characters count more. Spaces count less.

For most text, assume 1 token per 1.3 words. So a 1000-word article is about 750 tokens. For code, it's similar: 1 token per ~4 characters.

When you call Claude's API, you pay for two things:

  1. Input tokens. Everything you send to Claude (the prompt, the document, the context).
  2. Output tokens. Everything Claude returns (the response).

You're charged separately for each.

Claude Pricing: The Current Rates

As of mid-2026:

Claude Sonnet 5:

(Sonnet 5 launched with introductory pricing of $2/$10 through August 31, 2026. The examples below use the standard rates.)

Claude Opus 5:

Claude Haiku 4.5:

Sonnet 5 is the best value for most use cases. Haiku is cheaper but less capable.

Cost Estimation: Real Examples

Let's calculate costs for common tasks.

Example 1: Invoice extraction. You upload a 3-page PDF invoice (~2000 tokens of text). Your prompt: "Extract vendor, total, and due date" (~50 tokens). Claude's response: JSON with extracted data (~100 tokens).

Per-invoice cost: (2000 input + 50 prompt) × $3/M + 100 output × $15/M = $0.0062 + $0.0015 = about $0.008 per invoice.

For 1,000 invoices per month: about $7.65. For 100,000: about $765.

Example 2: Customer support classification. Customer message: ~100 tokens. Context (company policies): ~500 tokens. Claude's response (classification + suggested reply): ~150 tokens.

Per message: (100 + 500) × $3/M + 150 × $15/M = $0.0018 + $0.0023 = about $0.004.

For 1,000 messages per month: about $4.

Example 3: Document analysis (10-page contract). 10-page contract: ~7,000 tokens. Prompt: "Analyze and extract key terms": ~50 tokens. Response: ~200 tokens.

Per contract: (7000 + 50) × $3/M + 200 × $15/M = $0.0212 + $0.0030 = about $0.024.

For 100 contracts per month: about $2.42.

The Hidden Cost: Context

Here's where people overspend.

You're building a chatbot. For each user question, you send:

Total input per request: 2,650 tokens. At $3/M, that's about $0.008 per request.

Now imagine you process 1,000 requests per month. That's about $8 in input costs.

But you're sending the same 2,100 tokens (system instructions + documentation) for every request. That's 2.1M tokens per month ($6.30) that never change.

This is where prompt caching comes in.

Prompt Caching: Cut Your Input Costs by 90%

Prompt caching is magical. It reduces the cost of repeated context.

Here's how it works. You send a request with a cache_control parameter on certain blocks:

# System prompt and documentation (this gets cached) import anthropic client = anthropic.Anthropic() system_instructions = "You are a helpful assistant..." documentation = "<50 pages of company policies>" message = client.messages.create( model="claude-sonnet-5", max_tokens=1024, system=[ { "type": "text", "text": system_instructions + "\n" + documentation, "cache_control": {"type": "ephemeral"} } ], messages=[ { "role": "user", "content": "What's the best way to handle customer refunds?" } ] )

The first request pays full price for the system prompt + documentation.

Subsequent requests in the same conversation (within 5 minutes) pay only $0.30 per million cached tokens — 90% cheaper.

Real cost reduction. Input costs with caching:

Total for 100 requests: about $0.08. Without caching: (100 × 2,650) × $3/M = about $0.80.

Savings: roughly 90%. Small numbers per conversation, but the ratio holds at any scale. At 2.65B input tokens a month, that's $7,950 vs. about $800.

Use caching whenever you have long system prompts or shared context that repeats across requests.

Batch Processing: 50% Discount for Off-Peak Work

If you're processing documents in bulk and don't need real-time responses, use Claude's batch API.

Batch processing costs 50% of standard rates:

You submit a batch of requests, Claude processes them in the background (usually within a few hours), and you retrieve the results.

Example: 100,000 invoices overnight. Standard API: about $765. Batch API: about $383. Savings: 50%.

Batch processing doesn't work for customer-facing, low-latency work. But for overnight processing, data analysis, or bulk extraction, it's a huge win.

Reducing Token Spend: Practical Techniques

1. Shorter prompts

Don't say:

"Please carefully analyze this document and extract the following information: the vendor name, invoice total, due date, line items with descriptions, quantities, and unit prices. Format as JSON."

Say:

"Extract: vendor, total, due_date, line_items (description, qty, price). JSON format."

First prompt: ~35 tokens. Second: ~15 tokens. 57% reduction.

2. Structured outputs, not natural language

Don't ask Claude to write a narrative summary. Ask for JSON. Summaries are verbose. JSON is dense.

Instead of "Summarize this document in 2-3 paragraphs," try "Extract summary, key risks, and action items as JSON." You'll reduce output tokens by 30-40%.

3. Few-shot examples, carefully

Showing Claude an example is helpful. But don't show 10 examples. One or two is usually enough. More examples = more tokens = higher cost.

4. Remove unnecessary context

If you're extracting data from an invoice, you don't need the user's entire account history. Just the invoice.

Audit your prompts. Remove anything Claude doesn't need to answer the question.

5. Use cheaper models for simple tasks

Haiku is a third the price of Sonnet for straightforward tasks (classification, simple extraction).

Don't reach for Opus unless you really need its capabilities. It's nearly double the price of Sonnet, and for routine work the quality difference doesn't show.

Token Optimization Checklist

Before you deploy any AI system, review:

Most systems can cut token spend by 40-60% with these optimizations.

Monitoring Costs

Set up cost tracking:

def log_token_usage(model: str, input_tokens: int, output_tokens: int): input_cost = (input_tokens / 1e6) * 3 # $3 per million output_cost = (output_tokens / 1e6) * 15 # $15 per million total_cost = input_cost + output_cost cloudwatch.put_metric_data( Namespace="AIProcessing", MetricData=[ {"MetricName": "TokenCost", "Value": total_cost, "Unit": "None"}, {"MetricName": "InputTokens", "Value": input_tokens}, {"MetricName": "OutputTokens", "Value": output_tokens} ] )

Log every API call. Aggregate by model, by task, by hour. You'll spot inefficiencies quickly.

For example, if customer support is costing $0.015 per request, but it should cost $0.004, you have a problem. Find it. Fix it.

Comparing Models: Is Cheaper Always Better?

Sometimes. Haiku costs a third as much as Sonnet. But it's also less capable.

For invoice extraction, Haiku and Sonnet are equivalent. Use Haiku.

For contract analysis with edge cases, Sonnet is worth the 3x cost. Haiku might miss nuances. For deep reasoning or high-stakes analysis, Opus is worth the premium.

Test with your actual use case. Run 100 samples through both models. Compare quality. Calculate the cost-to-quality ratio.

Usually, Sonnet is the sweet spot.

The Dollar Impact

Optimize tokens properly, and a $2,000/month Claude bill becomes $800/month.

For an SMB doing document processing, that's the difference between AI being a cool side project and AI being a core business system.

Start measuring. Watch the costs drop.

Ready to optimize your token spend? Book a call and I'll audit your API usage and show you where to cut costs by 40-60% without sacrificing quality.

Get the free AI Readiness Checklist

15 questions to diagnose your team’s AI readiness, where you’ll see ROI fastest, and what to tackle first.

Takes 5 minutes Actionable next steps No sales pitch

No spam. Unsubscribe anytime.

or

Ready to build AI that actually works?

Let’s talk about how SRE discipline transforms AI from a risky experiment into a reliable business system.

Book Your Free Discovery Call

About the author

Charles Harvey is the founder of Three Moons Network and a site reliability engineer who builds production-grade AI automation for small businesses — monitoring, cost visibility, and documentation included. He writes about his hands-on AI experiments at floggingclaude.com. Connect on LinkedIn or see the code on GitHub.