{"id":51085420,"url":"https://github.com/sleipi/opencode-usage-stats-plugin","last_synced_at":"2026-06-23T21:30:39.298Z","repository":{"id":356946278,"uuid":"1233862923","full_name":"sleipi/opencode-usage-stats-plugin","owner":"sleipi","description":"Know where your tokens go. OpenCode plugin that tracks and visualizes AI usage across sessions.","archived":false,"fork":false,"pushed_at":"2026-06-19T19:00:39.000Z","size":796,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-19T21:05:00.367Z","etag":null,"topics":["dashboard","opencode","opencode-plugin","token-usage","usage-stats"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sleipi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":"ROADMAP.md","authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-05-09T13:01:00.000Z","updated_at":"2026-06-19T19:00:42.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/sleipi/opencode-usage-stats-plugin","commit_stats":null,"previous_names":["sleipi/opencode-usage-stats-plugin"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sleipi/opencode-usage-stats-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sleipi%2Fopencode-usage-stats-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sleipi%2Fopencode-usage-stats-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sleipi%2Fopencode-usage-stats-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sleipi%2Fopencode-usage-stats-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sleipi","download_url":"https://codeload.github.com/sleipi/opencode-usage-stats-plugin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sleipi%2Fopencode-usage-stats-plugin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34708271,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-23T02:00:07.161Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dashboard","opencode","opencode-plugin","token-usage","usage-stats"],"created_at":"2026-06-23T21:30:38.354Z","updated_at":"2026-06-23T21:30:39.287Z","avatar_url":"https://github.com/sleipi.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# opencode-usage-stats\n\nWhere do all your tokens go? Find out with a real-time dashboard that tracks every token, model, and session across your [OpenCode](https://opencode.ai) projects.\n\n![Dashboard screenshot](assets/screenshot/plugin-0-2-0.png)\n\n## Features\n\n- **Token tracking** — input, output, reasoning, and cache-read tokens per message\n- **Session tracking** — titles, directories, timestamps, parent/child relationships\n- **Agent tracking** — subagent types (explore, product-manager, software-architect, etc.) with per-agent token breakdowns\n- **Cost tracking** — per-message cost as reported by the provider\n- **Local storage** — all data stored in a single SQLite file (`~/.config/opencode/usage-stats.db`), no external services\n\n## Requirements\n\n- [Bun](https://bun.sh) runtime (uses `bun:sqlite` for zero-dependency SQLite)\n- [OpenCode](https://opencode.ai) with plugin support\n\n## Installation\n\nAdd the plugin to your `opencode.json`:\n\n```json\n{\n  \"plugin\": [\"@sleipi/opencode-usage-stats\"]\n}\n```\n\nRestart OpenCode to load the plugin. The plugin starts tracking immediately.\n\n### Manual installation (alternative)\n\n```bash\ngit clone https://github.com/sleipi/opencode-usage-stats-plugin.git\ncd opencode-usage-stats-plugin\nbun install\nln -s \"$(pwd)/src/plugin.ts\" ~/.config/opencode/plugins/opencode-usage-stats.ts\n```\n\n## Configuration\n\nThe plugin reads configuration from `~/.config/opencode/usage-stats.jsonc` (or `.json`). If no config file is found, environment variables are used as fallback.\n\nExample config file:\n\n```jsonc\n{\n  // Start the dashboard automatically when the plugin loads (default: true)\n  \"dashboardEnabled\": true,\n  // Port for the dashboard web server (default: 3333)\n  \"dashboardPort\": 3333\n}\n```\n\nEnvironment variable fallbacks (for backward compatibility):\n\n| Variable | Description | Default |\n|---|---|---|\n| `OPENCODE_USAGE_STATS_DASHBOARD` | Set to `\"false\"` to disable auto-start | `true` |\n| `OPENCODE_USAGE_STATS_PORT` | Dashboard port | `3333` |\n\n## Dashboard\n\nBy default the dashboard starts automatically with the plugin. To run it manually instead, disable auto-start in the config and use:\n\n```bash\nbunx @sleipi/opencode-usage-stats\n```\n\nOr with a custom port:\n\n```bash\nOPENCODE_USAGE_STATS_PORT=3334 bunx @sleipi/opencode-usage-stats\n```\n\nOpens at [http://localhost:3333](http://localhost:3333).\n\nThe dashboard auto-refreshes every 5 seconds and shows:\n- Token summary bar (Today / This Week / This Month / Last Month)\n- Session cards with token breakdown and agent details\n- Cache hit percentages with explanatory tooltips\n\n## Development\n\nSee [AGENTS.md](AGENTS.md) for coding standards, test commands, and architecture details.\n\n```bash\nbun test tests/unit     # unit tests\nbun run test:e2e        # Playwright e2e tests\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsleipi%2Fopencode-usage-stats-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsleipi%2Fopencode-usage-stats-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsleipi%2Fopencode-usage-stats-plugin/lists"}