Repeated incorrect API cost estimates caused significant financial overrun
Summary
Claude Code (Opus model) repeatedly provided incorrect cost estimates for an Anthropic API batch processing task, resulting in a spend of ~$1,700 against an original estimate of ~$300. The user was misled through three separate incorrect estimates, each discovered only after money was already spent.
Timeline of failures
- Estimate 1: £215 ($270) — Claude estimated batch processing 63,000 emails through a 2-pass pipeline (Haiku classifier + Sonnet extractor). This failed to account for a 511,000-character product catalog (~128,000 tokens) being sent with EVERY Sonnet API call. The data to calculate this correctly was available at the time.
- Estimate 2: £66 ($83) — After discovering the catalog issue, Claude recalculated based on a single test email (1,106 input tokens). This was not representative of the full dataset. Claude had access to 55,000+ emails in BigQuery with full body text and could have computed accurate averages.
- Estimate 3: $108 — Still based on the single test email rate of $0.0265/email. Actual measured rate from a 1,458-email batch was $0.045/email — 70% higher.
Root cause
- The product catalog (511,439 chars / ~128,000 tokens) was included in every Sonnet API call. This was the prompt design — Claude created it and failed to account for its cost impact.
- Cost estimates were based on rough calculations rather than empirical measurement. Claude had full access to BigQuery with 55,000+ email bodies and could have computed exact token counts at any point.
- No controlled test batch was run before committing to large-scale processing.
Financial impact
- Original agreed budget: ~$300
- Actual spend to date: ~$1,700
- Remaining to complete: ~$156
- Total if completed: ~$1,856
What should have happened
- Before any processing: query BigQuery for actual email body sizes, calculate exact prompt sizes including catalog, compute accurate per-email cost
- Run a 100-email test batch, measure actual API usage from response headers
- Present verified cost to user before proceeding
- Monitor spend during execution and halt if exceeding estimate
Environment
- Claude Code with Opus model
- Anthropic API (claude-sonnet-4-6 for extraction, claude-haiku-4-5-20251001 for classification)
- Windows 11, Python 3.13
- Organization: Duncan & Grove
Request
The user is requesting a billing adjustment / partial refund for the cost overrun caused by Claude's repeated incorrect estimates. The overrun of ~$1,400 above the original $300 estimate was caused by a prompt design flaw (128k token catalog per call) that Claude created and failed to identify the cost impact of.
Contact: The organization admin can be reached via the Duncan & Grove workspace on the Anthropic console.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗