-
Notifications
You must be signed in to change notification settings - Fork 0
Track token usage and cost per agent #166
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Summary
Track per-agent token usage and cost by switching the Claude Code runner from --output-format text to --output-format json.
Available data
claude -p --output-format json returns:
total_cost_usd— total cost for the agent runusage.input_tokens,usage.output_tokens,usage.cache_read_input_tokensmodelUsage— per-model breakdown
Implementation
- In
src/runners/claude-code.ts, change--output-format textto--output-format json - Parse the JSON response to extract
result(the agent's text output) and cost/usage fields - Add
costUsd,inputTokens,outputTokensto theAgentResulttype insrc/types.ts - Store in run JSON so
thinktank statscan report aggregate cost data - Display per-agent cost in the results table
Why
Users need to understand the cost of ensemble runs. Currently we estimate "$1-5 per run" in docs but have no actual tracking. This would let thinktank stats show real cost data.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request