v2 Phase 4: add "generated" (output) tokens under the total on Session
The total is ~97% cache reads, which reads as implausibly large on its own.
Show the cache-inclusive total as the headline token number and the output
tokens ("what Claude actually generated", ~1.1M) as a small line beneath it —
impressive total, believable sub-number. Daemon sends a new `to` field; firmware
parses output_today and renders it. Re-spaced the Session layout for the 5th row.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -90,6 +90,7 @@ def compute_today_usage() -> dict:
|
||||
today = datetime.date.today()
|
||||
midnight = datetime.datetime.combine(today, datetime.time.min)
|
||||
total_tokens = 0
|
||||
output_tokens = 0
|
||||
cost = 0.0
|
||||
messages = 0
|
||||
try:
|
||||
@@ -133,13 +134,15 @@ def compute_today_usage() -> dict:
|
||||
cw = usage.get("cache_creation_input_tokens", 0) or 0
|
||||
cr = usage.get("cache_read_input_tokens", 0) or 0
|
||||
total_tokens += inp + out + cw + cr
|
||||
output_tokens += out
|
||||
messages += 1
|
||||
p = _price_for(msg.get("model"))
|
||||
cost += (inp * p["in"] + out * p["out"]
|
||||
+ cw * p["cache_w"] + cr * p["cache_r"]) / 1_000_000
|
||||
except OSError:
|
||||
continue
|
||||
return {"tk": int(total_tokens), "tc": int(round(cost * 100)), "tn": messages}
|
||||
return {"tk": int(total_tokens), "tc": int(round(cost * 100)),
|
||||
"tn": messages, "to": int(output_tokens)}
|
||||
|
||||
|
||||
def _build_file_logger() -> logging.Logger | None:
|
||||
|
||||
Reference in New Issue
Block a user