A live usage dashboard for OpenCode, served by a single Python file — no framework, no build step, no dependencies.
- Single file:
opencode_dashboard.pyis the whole server and page. - Auto-refreshing every 15s; shows session history, per-day token/message charts, cost by model, tool usage, and a work-hour heatmap.
- Click to filter: days, tools, agents, models. Hover for tooltips.
- Standalone app: the included
OpenCode Dashboard.commandlauncher opens a dedicated Chrome window and shuts the server down when the window closes.
- Python 3.9+
- An OpenCode installation (it reads the SQLite db that OpenCode maintains)
- Chrome (optional, for the
.commandlauncher's dedicated window)
python3 opencode_dashboard.py --port 8765
# open http://localhost:8765Or double-click OpenCode Dashboard.command for a dedicated app window.
| Flag | Default | Description |
|---|---|---|
--port |
8765 |
HTTP port to serve on |
--path |
auto | Path to the directory containing OpenCode's SQLite db |
--open |
— | Launch the app window immediately |
--time |
0 | Also re-render a plain-text stats file every N seconds |
GET /api/stats— everything the page renders, as JSONGET /— the dashboard pagePOST /api/close— stop the server (used by the launcher on quit)
Copy opencode_dashboard.py (and, optionally, the .command launcher) to any machine with a Python 3 and an OpenCode db. Point it at that db and you're done. Everything — HTML, CSS, JS, SVG charts, KPI math, HTTP server, graceful shutdown — lives in one importable file you can read end to end.
From the dashboard you can export the full stats JSON with the Export button.
- The
sessions.costcolumn is not always populated by every session; the dashboard estimates the per-session cost as the model's share of that session's tokens instead. - Reasoning tokens are counted as output ("Output · reasoning"); cached tokens are shown separately from the input/output bars.
