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

opencode-throughput

v2.1.0

Published

Real-time LLM performance monitoring plugin for OpenCode. Tracks TTFT, TPS, latency, token usage and cost per model with a TUI sidebar display.

Readme

opencode-throughput

Real-time LLM performance monitoring plugin for OpenCode. Tracks latency, throughput, token usage, and cost per model with toast notifications and JSONL logging.

Features

  • TTFT (Time To First Token) — measures how fast the model starts generating
  • TPS (Tokens Per Second) — generation throughput during streaming
  • Total Latency — end-to-end request time
  • Token Usage — input, output, reasoning, cache read/write
  • Cost Tracking — per-request and cumulative cost
  • Toast Notifications — real-time performance summary after each LLM response
  • JSONL Logging — persistent logs at ~/.opencode/throughput.jsonl
  • Benchmark Tool — query historical stats on demand from the AI agent

Installation

需要在两个配置文件中分别声明插件:

1. opencode.json — 服务端插件(事件监听、数据采集)

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["opencode-throughput"]
}

2. .opencode/tui.json — TUI 插件(侧边栏显示)

{
  "$schema": "https://opencode.ai/tui.json",
  "plugin": ["opencode-throughput"]
}

OpenCode 会自动从 npm 安装插件。

Usage

Once installed, the plugin runs automatically:

  1. After each LLM response, a toast notification appears with metrics:

    claude-sonnet-4 | 2.1s TTFT | 58.3 tok/s | 4.2s | ↑1.2k ↓892
  2. Logs are written to ~/.opencode/throughput.jsonl (one JSON object per line)

  3. Query benchmarks — ask the AI agent to use the benchmark tool:

    "Show me the benchmark stats for claude" "Compare model performance" "Show the last 10 requests"

Benchmark Tool Args

| Arg | Type | Description | |-----|------|-------------| | model | string (optional) | Filter by model name (partial match) | | last | number (optional) | Only show the last N entries |

Log Format

Each line in ~/.opencode/throughput.jsonl:

{
  "ts": "2026-03-21T10:00:00.000Z",
  "model": "anthropic/claude-sonnet-4",
  "providerID": "anthropic",
  "modelID": "claude-sonnet-4",
  "sessionID": "abc123",
  "messageID": "def456",
  "ttft_ms": 2100,
  "tps": 58.3,
  "latency_ms": 4200,
  "inputTokens": 1200,
  "outputTokens": 892,
  "reasoningTokens": 0,
  "cacheReadTokens": 500,
  "cacheWriteTokens": 200,
  "cost": 0.0234,
  "finish": "stop"
}

How It Works

The plugin hooks into OpenCode's event system:

  • message.updated — captures AssistantMessage.time.completed, tokens, and cost
  • message.part.updated — captures the first TextPart.time.start for TTFT calculation

Development

Local development

{
  "plugin": ["file:///absolute/path/to/opencode-throughput/src/index.ts"]
}

Build

bun install
bun run build

Publish

npm publish --access public

License

MIT