[WSJF-5] Add cost tracking (OpenAI spend per email) #11

Open
opened 2026-06-27 10:45:50 +02:00 by bullitt · 0 comments
Owner

Context

Article reports $9 vs $200 cost differences between approaches. We have no visibility into AI costs.

Problem

No idea how much each AI extraction costs. Can't make informed decisions about when to use AI vs. not.

Proposal

  • Log token usage from OpenAI response (prompt_tokens, completion_tokens)
  • Store in events table or separate metrics table
  • Add to /api/stats: total_tokens_used, avg_tokens_per_extraction, estimated_cost
  • Surface in stats UI

WSJF: 5

## Context Article reports $9 vs $200 cost differences between approaches. We have no visibility into AI costs. ## Problem No idea how much each AI extraction costs. Can't make informed decisions about when to use AI vs. not. ## Proposal - Log token usage from OpenAI response (prompt_tokens, completion_tokens) - Store in events table or separate metrics table - Add to /api/stats: total_tokens_used, avg_tokens_per_extraction, estimated_cost - Surface in stats UI ## WSJF: 5
Sign in to join this conversation.
No labels
arch
harness
security
ux
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
bullitt/trackbox#11
No description provided.