M2.5.2: Cost ledger with price table #28
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/cost-ledger"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes Issue #25
Summary
Append-only JSONL ledger of every
research()call at~/.marchwarden/costs.jsonl. Supplements (does not replace) the per-callcost_metadatafield onResearchResult. Operators query it via the upcomingmarchwarden costscommand (M2.5.3 / Issue #26).Ledger entry fields
timestamp,trace_id,question(truncated to 200 chars),model_id,tokens_used,tokens_input,tokens_output,iterations_run,wall_time_sec,tavily_searches,estimated_cost_usd,budget_exhausted,confidence.Price table
~/.marchwarden/prices.toml, auto-seeded with current Anthropic (Sonnet 4.6, Opus 4.6, Haiku 4.5) + Tavily rates on first runestimated_cost_usd: nullinstead of crashingIntegration
cost_recordedlog line via the M2.5.1 logger, so cost data ships to OpenSearch alongside the fileagent.pynow trackstokens_input/tokens_outputseparately (not just total) and countstavily_searchesacross iterations_synthesizereturns(result, synth_in, synth_out)so the caller can attribute synthesis tokens to the running countersEnd-to-end verified
Real Anthropic+Tavily call from inside the docker test env:
Tests
10 new tests covering price table seeding, no-overwrite of existing files, cost estimation for known/unknown models, tavily-only cost, ledger appends, question truncation, and env var override. 104/104 passing.
Out of scope
marchwarden costsCLI command (M2.5.3 / Issue #26).