aboutsummaryrefslogtreecommitdiffstats
path: root/deckit/modules
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-11-09 19:31:13 +0100
committerDanilo M. <danix@danix.xyz>2026-11-09 19:31:13 +0100
commit33060a4aab87a79d222b10d088e01acf6ac8be29 (patch)
tree5a5cc2c73f0c6814919541f40f93f78456f33fca /deckit/modules
parent7a985a14d440acdda93dc7a43ee7c6bdecc2bf44 (diff)
downloaddeck-it-33060a4aab87a79d222b10d088e01acf6ac8be29.tar.gz
deck-it-33060a4aab87a79d222b10d088e01acf6ac8be29.zip
feat: opencode session spend and brand marks in the LLM card
Diffstat (limited to 'deckit/modules')
-rw-r--r--deckit/modules/llm.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/deckit/modules/llm.py b/deckit/modules/llm.py
index fb45097..1b40a6f 100644
--- a/deckit/modules/llm.py
+++ b/deckit/modules/llm.py
@@ -49,8 +49,15 @@ def _opencode_session(sessions) -> dict:
continue
rows = block.get("rows") or []
top = max(rows, key=lambda r: r.get("calls") or 0) if rows else {}
- return {"model": top.get("model"), "provider": top.get("provider")}
- return {"model": None, "provider": None}
+ return {
+ "model": top.get("model"),
+ "provider": top.get("provider"),
+ "session_cost": round(sum(r.get("cost_usd") or 0 for r in rows), 4),
+ "session_tokens": sum(r.get("tokens") or 0 for r in rows),
+ "session_calls": sum(r.get("calls") or 0 for r in rows),
+ }
+ return {"model": None, "provider": None, "session_cost": None,
+ "session_tokens": 0, "session_calls": 0}
def make(cfg: dict) -> Module: