Commit Graph

3 Commits

Author SHA1 Message Date
NCBM a61b536243 core/agent+cli: separate last-request usage from billed turn totals
Tool-loop rounds re-send history, so summed prompt tokens are billing
not context size. Track last_request_usage and label turn/session as
billed; clarify /status and end-of-turn lines.
2026-07-15 11:04:41 +08:00
NCBM 0a3127454d core/agent: char-based token estimate fallback for usage
When API usage is missing, estimate prompt/completion tokens at ~4
chars per token and mark source as estimate (or mixed when combined).
2026-07-15 10:52:37 +08:00
NCBM 2ae7aa0e05 core/agent: add TokenUsage and API usage parser
Parse OpenAI-compatible usage dicts into prompt/completion/total counts
for session and turn aggregation.
2026-07-15 10:47:51 +08:00