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.
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
..
anthropic.go
backend: stream extended thinking / reasoning tokens
2026-04-26 19:01:27 +02:00
anthropic_stream_test.go
backend: 100% coverage for buildAnthropicMessages and streamAnthropicSSE
2026-04-21 15:45:46 +02:00
backend.go
agent: per-turn and session cost tracking in USD
2026-04-27 18:14:12 +02:00
backend_test.go
agent: retry on transient backend errors and mid-stream drops
2026-04-27 17:54:27 +02:00
codewhisperer.go
kiro: implement social token refresh via desktop.kiro.dev
2026-04-26 18:11:21 +02:00
codewhisperer_internal.go
kiro: implement social token refresh via desktop.kiro.dev
2026-04-26 18:11:21 +02:00
copilot.go
backend: extract stream parsers, shared HTTP, url.URL, comprehensive tests
2026-04-21 15:32:03 +02:00
new.go
backend: require OLLIE_BACKEND/OLLIE_MODEL; no silent ollama default
2026-04-26 18:25:39 +02:00
new_test.go
backend: require OLLIE_BACKEND/OLLIE_MODEL; no silent ollama default
2026-04-26 18:25:39 +02:00
ollama.go
backend: remove unreachable NewRequestWithContext guards (URL validated in ctor)
2026-04-21 15:47:34 +02:00
ollama_stream_test.go
backend: extract parseOllamaContextLength, 100% coverage
2026-04-21 15:39:52 +02:00
openai.go
agent: per-turn and session cost tracking in USD
2026-04-27 18:14:12 +02:00
openai_encode_test.go
backend: extract stream parsers, shared HTTP, url.URL, comprehensive tests
2026-04-21 15:32:03 +02:00
openai_stream_test.go
backend: extract stream parsers, shared HTTP, url.URL, comprehensive tests
2026-04-21 15:32:03 +02:00
openai_test.go
backend: extract stream parsers, shared HTTP, url.URL, comprehensive tests
2026-04-21 15:32:03 +02:00
testhelper_test.go
backend: extract stream parsers, shared HTTP, url.URL, comprehensive tests
2026-04-21 15:32:03 +02:00