Objective
Replace rough token estimates with Anthropic's official token counter for accurate cost tracking.
Implementation Tasks
Success Criteria
Expected Impact
- Cost Tracking: Accurate to within 1% (vs 10-20% error)
- Timeline: Week 1
- Priority: HIGH
Reference
See detailed implementation plan in docs/ANTHROPIC_OPTIMIZATION_PLAN.md - Track 4
Objective
Replace rough token estimates with Anthropic's official token counter for accurate cost tracking.
Implementation Tasks
empathy_llm_toolkit/utils/tokens.pywith token counting utilitiescount_tokens()andcount_message_tokens()functionsAnthropicProviderwithestimate_tokens()andcalculate_actual_cost()Success Criteria
Expected Impact
Reference
See detailed implementation plan in
docs/ANTHROPIC_OPTIMIZATION_PLAN.md- Track 4