Skip to content

feat: durable token usage tracking (SQLite + usage_get_summary action)#59

Draft
DorianZheng wants to merge 22 commits intomainfrom
feature/token-usage-tracking
Draft

feat: durable token usage tracking (SQLite + usage_get_summary action)#59
DorianZheng wants to merge 22 commits intomainfrom
feature/token-usage-tracking

Conversation

@DorianZheng
Copy link
Copy Markdown
Member

@DorianZheng DorianZheng commented Apr 19, 2026

Adds durable token usage tracking and a usage summary action.

  • Adds token_usage table to SQLite DB with columns: group_jid, session_id, model, prompt_tokens, completion_tokens, total_tokens, cache_read_tokens, cache_write_tokens, cost_usd, latency_ms, ts
  • Records usage after each LLM response using existing captureTokenUsageSummary() hook
  • New token-pricing.ts with static pricing map for claude-opus-4-6, claude-sonnet-4-6, claude-haiku-4-5
  • New usage_get_summary action with optional filters: group_jid, model, since (unix ms)
  • 550 tests passing, TypeScript builds clean

@DorianZheng DorianZheng changed the title feat: add durable token usage tracking (SQLite + usage_get_summary action) feat: durable token usage tracking (SQLite + usage_get_summary action) Apr 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant