npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ocinsights

v0.1.2

Published

opencode plugin for session analytics — track tokens, tools, costs across all your sessions

Readme

ocinsights

opencode plugin that automatically syncs every session to your ocinsights dashboard — track tokens, tools, MCP usage, and cost across all your AI sessions.

Install

npm i -g ocinsights
ocinsights setup

You'll be asked for two things:

  1. Insights API URL — where your ocinsights frontend is running (default http://localhost:3001).
  2. API key — get it from the ocinsights dashboard (Settings → API key).

The CLI then:

  • copies the plugin to .opencode/plugins/ocinsights.js
  • writes OC_INSIGHTS_API_KEY and OC_INSIGHTS_API_BASE to .env

Restart opencode and you're done — every session is synced on session.idle.

Non-interactive mode

ocinsights setup --api-key=oc_xxx --api-base=http://localhost:3001

Other commands

ocinsights import   # batch import existing sessions from running opencode server
ocinsights help

Manual install (without the CLI)

If you prefer to wire it up by hand:

  1. Install the package as a dev dependency:

    npm i -D ocinsights
  2. Add it to your opencode.json:

    {
      "plugin": ["ocinsights"]
    }
  3. Add to .env:

    OC_INSIGHTS_API_KEY=oc_xxx
    OC_INSIGHTS_API_BASE=http://localhost:3001
  4. Restart opencode.

How it works

When a session goes idle, the plugin:

  1. reads all messages + tool calls from opencode
  2. aggregates tokens (input, output, cache read/write, reasoning)
  3. POSTs the session to {OC_INSIGHTS_API_BASE}/api/sync

Your dashboard then shows the session with full token breakdown, tool usage, MCP servers, and cost.

Local development

git clone https://github.com/anomalyco/opencode-ai-insights
cd opencode-ai-insights
npm install
npm run build

The plugin will be at dist/index.js. To test locally without publishing, copy it into your project's .opencode/plugins/ and restart opencode.

License

MIT