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> |
||
|---|---|---|
| .. | ||
| runfilestore.go | ||
| session.go | ||
| sessionfile.go | ||
| skill.go | ||
| store.go | ||
| store_test.go | ||