open-index/open-npm huggingface dataset:
npm package: @nguyenhoanrv/claude-analytics
Description: CLI tool for collecting Claude Code session analytics. Parses local `.jsonl` session files, calculates token costs, and sends daily metrics to your team's analytics API.
Latest version: 0.1.16

# @nguyenhoanrv/claude-analytics

CLI tool for collecting Claude Code session analytics. Parses local `.jsonl` session files, calculates token costs, and sends daily metrics to your team's analytics API.

## Install & Setup

```bash
npx @nguyenhoanrv/claude-analytics setup
```

Prompts for API URL, display name, and privacy preferences. Config saved to `~/.claude-analytics/config.json`.

## Usage

```bash
# Collect today's sessions
npx @nguyenhoanrv/claude-analytics collect

# Collect date range
npx @nguyenhoanrv/claude-analytics collect --since 2026-04-01 --until 2026-04-07

# Preview payload without sending
npx @nguyenhoanrv/claude-analytics collect --dry-run

# Collect GitHub PR/issue data
npx @nguyenhoanrv/claude-analytics github

# View current config
npx @nguyenhoanrv/claude-analytics config --show
```

## Requirements

- Node.js >= 20
- Claude Code CLI installed and configured (`~/.claude/projects/` must exist)

## What It Collects

- Token usage per model (input, output, cache)
- Session cost (via LiteLLM pricing)
- Tool usage counts
- Error classifications
- Completion rates and turn counts
- Git project identity (owner/repo)

All data is aggregated per-day. Prompts are **not** shared by default.

## Part of

[claude-code-analytics](https://github.com/anthropics/claude-code-analytics) — team analytics platform for Claude Code.