feat(dashboard): show Claude usage (tokens + requests) since server start
ClaudeBrain now returns per-reply token usage (Reply.usage from the API response), the dashboard accumulates it (monitor.add_claude_usage), and the header shows a "클로드 토큰" stat (input+output total, with a tooltip breaking down input/output tokens and request count). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -176,4 +176,9 @@ class ClaudeBrain:
|
||||
messages=msgs,
|
||||
)
|
||||
text = "".join(b.text for b in resp.content if b.type == "text")
|
||||
return Reply(text=text.strip(), ts=time.monotonic())
|
||||
usage = None
|
||||
u = getattr(resp, "usage", None)
|
||||
if u is not None:
|
||||
usage = {"input": getattr(u, "input_tokens", 0) or 0,
|
||||
"output": getattr(u, "output_tokens", 0) or 0}
|
||||
return Reply(text=text.strip(), ts=time.monotonic(), usage=usage)
|
||||
|
||||
Reference in New Issue
Block a user