This repository has been archived on 2026-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
ollie-core/pkg/store
Levi Neely 59ee25b010 agent: per-turn and session cost tracking in USD
Usage events now carry a 4th field (costUSD) so OpenRouter's reported
cost flows through unchanged. For backends that only report token counts
(Anthropic, direct OpenAI, Ollama), cost is computed from a prefix-keyed
pricing table. The higher-fidelity source always wins.

Per turn:
- turnInputTokens/turnOutputTokens/turnCostUSD reset before each turn
- recordTurnCost() stores LastTurnCostUSD, adds to SessionCostUSD
- "costLast=$X.XXXX" emitted as an info event at turn end

Session file "cost" returns costLast/costSession key=value pairs.
Agent interface gains Cost() string.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 18:14:12 +02:00
..
runfilestore.go fix: statewait blocking and bfg composability 2026-04-24 14:00:27 +02:00
session.go backend: stream extended thinking / reasoning tokens 2026-04-26 19:01:27 +02:00
sessionfile.go agent: per-turn and session cost tracking in USD 2026-04-27 18:14:12 +02:00
skill.go store: replace Get/Put with Store+StoreEntry model 2026-04-21 20:07:27 +02:00
store.go store: replace Get/Put with Store+StoreEntry model 2026-04-21 20:07:27 +02:00
store_test.go agent: per-turn and session cost tracking in USD 2026-04-27 18:14:12 +02:00