Track your AI coding sessions — tokens, models, tools, files, and cost — all in your browser.
OpenCode Insights is a local-first analytics dashboard for OpenCode. It reads your OpenCode SQLite database and visualizes every session — token usage, model breakdowns, tool calls, files edited, todos, and cost — so you can understand exactly how you work with AI.
No cloud. No telemetry. No sign-up. 100% local.
| Metric | Description |
|---|---|
| Sessions | Every AI coding session with timestamps, duration, and agent |
| Tokens | Input, output, reasoning, and cache-read tokens per session |
| Models | Which AI models you use and how much you use them |
| Tools | Every tool call (read, write, bash, etc.) with success/error counts |
| Projects | Activity breakdown across all your codebases |
| Files | Most-edited files ranked by patch count |
| Todos | Tasks created and completed during sessions |
| Agents | Per-agent session counts, tokens, and tool usage |
| Cost | Token cost per session, model, and project |
# Clone the repo
git clone https://github.com/Amanuel-Tesfaye-R/opencode-usage-tracking.git
cd opencode-usage-tracking
# Install dependencies
npm install
# Start the dashboard
npm run devOpen http://localhost:3777 in your browser.
Run this once to set up automatic launch:
npm run setupThis configures OpenCode to open the insights dashboard in your browser every time it starts.
docker run -v ~/.local/share/opencode:/data -p 3777:3777 amanuel/opencode-usage-trackingThe npm run setup command creates a launcher script that:
- Starts the OpenCode Insights server in the background
- Opens your browser automatically
- Configures OpenCode to launch it on startup
If you prefer to set up manually:
- Build the app:
npm run build - Create a launcher script (see
scripts/launch.shorscripts/launch.ps1) - Configure OpenCode to run it on startup via your OpenCode config
OpenCode Insights reads your local OpenCode database:
| Platform | Default Path |
|---|---|
| Linux/macOS | ~/.local/share/opencode/opencode.db |
| Windows | %USERPROFILE%\.local\share\opencode\opencode.db |
The database is opened with PRAGMA query_only — the dashboard never modifies your OpenCode data.
OPENCODE_DB_PATH="/path/to/opencode.db" npm run dev| Route | Description |
|---|---|
/ |
Overview — KPIs, activity chart, token flow, cache rate, models, tools, projects |
/sessions |
Sessions — searchable table with project filters and range selection |
/sessions/[id] |
Session Detail — full message timeline, tool calls, files changed, todos |
/tools |
Tool Calls — every tool call across all sessions, filterable and paginated |
/projects |
Projects — activity breakdown across your codebases |
/models |
Models — model usage distribution and cost breakdown |
/files |
Files — most-edited files across all sessions |
/todos |
Todos — tracked tasks with status and priority |
/agents |
Agents — per-agent usage statistics |
- Framework: Next.js 16 App Router (React Server Components)
- Runtime: Node.js with
node:sqlite(zero native dependencies) - Styling: Tailwind CSS v4 with custom design tokens
- Charts: Recharts
- UI: shadcn/ui + Radix UI primitives
- Fonts: Geist Sans + Geist Mono
Works best in Chromium-based browsers (Chrome, Edge, Arc). Firefox and Safari are supported but may have minor rendering differences.
Is my data uploaded anywhere? No. Everything stays on your machine. The dashboard reads your local SQLite file and never sends data anywhere.
Does it modify my OpenCode database?
No. It opens the database with PRAGMA query_only and never writes to it.
Which OpenCode version is required?
Any version that writes to the standard SQLite database at ~/.local/share/opencode/opencode.db.
Can I use this without OpenCode? Not really — the dashboard reads the OpenCode database. But if you have the database file, it works standalone.
Why port 3777? Because OpenCode uses 3777 by default. The dashboard sits alongside it on the same port.
- Fork the repo
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
MIT — see LICENSE for details.