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

@niebaopeng/ocusage

v1.0.6

Published

Usage analysis tool for OpenCode / Kimi CLI sessions

Readme

ocusage

Usage analysis tool for Kimi CLI and OpenCode sessions. Inspired by ccusage.

ocusage reads your local session data, aggregates token usage, and estimates costs — all locally, with zero data leaving your machine.

Supported Data Sources

  • Kimi CLI: ~/.kimi/sessions/<md5(cwd)>/<uuid>/wire.jsonl
  • OpenCode: ~/.local/share/opencode/opencode.db (SQLite)

Features

  • 📊 Multiple Reports — daily, monthly, session, and project-level breakdowns (day × CLI × model)
  • 💰 Cost Estimation — built-in pricing for Kimi, DeepSeek, MiniMax, GLM, etc.
  • 🌐 External Pricing — fetch live prices from OpenRouter API or LiteLLM local cache
  • 📍 Project Mapping — automatically resolves session directory hashes to actual project paths
  • 🖥️ Statusline Integration — compact one-line output for shell prompts
  • 🔒 100% Local — no network calls, no data upload
  • 📦 Zero Runtime Dependencies — single-file executable (~17 KB)

Installation

# Run directly without installing
npx ocusage

# Or install globally
npm install -g ocusage

Usage

# Daily report (default)
ocusage daily

# Monthly report
ocusage monthly

# Per-session breakdown
ocusage session

# Per-project breakdown
ocusage project

# Compact one-line summary (great for shell prompts)
ocusage statusline

Options

| Option | Description | |--------|-------------| | --json | Output raw JSON | | --since <YYYY-MM-DD> | Filter start date | | --until <YYYY-MM-DD> | Filter end date | | --project <name> | Filter by project path substring | | --compact | Use compact table mode |

Examples

ocusage daily --since 2026-01-01 --json
ocusage session --project myapp --compact
ocusage monthly --project ocusage

Configuration

Create ~/.ocusage.json to customize pricing source or override specific model prices:

{
  "pricingProvider": "openrouter",
  "litellmPath": "~/.venv/lib/python3.12/site-packages/litellm/model_prices_and_context_window_backup.json"
}

Pricing Providers

| Provider | Description | |----------|-------------| | "openrouter" | Fetch live prices from openrouter.ai/api/v1/models (default) | | "litellm" | Read from local LiteLLM pricing JSON (auto-detected) | | "default" | Use built-in hardcoded prices (zero network) |

Pricing Priority

  1. ~/.ocusage.json pricing field (user manual override)
  2. External provider (openrouter or litellm)
  3. Built-in DEFAULT_PRICING
  4. Special rules (e.g., MiniMax highspeed = 3× standard)

Custom Model Prices

{
  "pricing": {
    "kimi-k2.5": {
      "input": 0.50,
      "output": 2.00,
      "cacheRead": 0.10,
      "cacheCreation": 0.50
    }
  }
}

How It Works

Kimi CLI

  1. Scans ~/.kimi/sessions/<md5(cwd)>/<conversation>/wire.jsonl
  2. Extracts StatusUpdate events containing token_usage
  3. Default model is k2.5 when not explicitly recorded

OpenCode

  1. Reads ~/.local/share/opencode/opencode.db via built-in node:sqlite
  2. Queries message table for assistant responses with token data
  3. Maps sessions to projects via session and project tables

License

MIT