aboutsummaryrefslogtreecommitdiffstats
path: root/deckit
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-11-10 18:16:32 +0100
committerDanilo M. <danix@danix.xyz>2026-11-10 18:16:32 +0100
commitb22003b6a86f16f3de6f77093fb94d8b89203dc2 (patch)
tree4ebd032f6c92751d2749f6a7bc78d1f3c1ab23e8 /deckit
parent9f6f909d696c2f8b1e1e8261431e3d815baf277e (diff)
downloaddeck-it-b22003b6a86f16f3de6f77093fb94d8b89203dc2.tar.gz
deck-it-b22003b6a86f16f3de6f77093fb94d8b89203dc2.zip
feat(llm): desktop-assistant usage as Local Agent
The LLM usage card gets a third section, the desktop-assistant program from llm-cost-dashboard, with the same session and total stats as opencode. The per-program aggregation now takes the program. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'deckit')
-rw-r--r--deckit/modules/llm.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/deckit/modules/llm.py b/deckit/modules/llm.py
index 7856603..2d697bf 100644
--- a/deckit/modules/llm.py
+++ b/deckit/modules/llm.py
@@ -14,7 +14,7 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-"""Claude Code and opencode usage, relayed from llm-cost-dashboard's API.
+"""Claude Code, opencode and desktop-assistant usage, relayed from llm-cost-dashboard's API.
Everything here is read-only. The dashboard stays the owner of the data and the
pricing; deck-it only renders it.
@@ -35,9 +35,9 @@ def _fetch_for(base):
return fetch
-def _opencode(rows) -> dict:
- """Aggregate /api/summary's per-model rows into opencode's cost and tokens."""
- picked = [r for r in rows if isinstance(r, dict) and r.get("program") == "opencode"]
+def _program(rows, program) -> dict:
+ """Aggregate /api/summary's per-model rows into one program's cost and tokens."""
+ picked = [r for r in rows if isinstance(r, dict) and r.get("program") == program]
models = [
{"provider": r.get("provider") or "", "model": r.get("model") or "",
"cost": r.get("total_cost_usd") or 0, "tokens": r.get("tokens") or 0,
@@ -58,10 +58,10 @@ def _claude_model(session) -> str | None:
return models[0].get("model") if models else None
-def _opencode_session(sessions) -> dict:
- """The latest opencode session's dominant model from /api/last_session."""
+def _session(sessions, program) -> dict:
+ """A program's latest session and its dominant model from /api/last_session."""
for block in sessions or []:
- if not isinstance(block, dict) or block.get("program") != "opencode":
+ if not isinstance(block, dict) or block.get("program") != program:
continue
rows = block.get("rows") or []
top = max(rows, key=lambda r: r.get("calls") or 0) if rows else {}
@@ -108,8 +108,8 @@ def make(cfg: dict) -> Module:
"extra_currency": latest.get("extra_currency"),
"model": _claude_model(claude_session),
},
- "opencode": {**_opencode(data.get("/api/summary") or []),
- **_opencode_session(sessions)},
+ **{p: {**_program(data.get("/api/summary") or [], p), **_session(sessions, p)}
+ for p in ("opencode", "assistant")},
}
return Module(name="llm", title="LLM usage", state=state)